diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2013-08-15 14:33:30 +0200 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2013-08-15 14:33:30 +0200 |
commit | ccbd146d63917eeaed49eb2479f2f69ac4ea6ad0 (patch) | |
tree | dc53a5d7f9d79d23a32ecbb97a00dd38f44e27d9 /src/indmanager | |
parent | 22d7f285f0df3cb9c4e12e817bee00194e7ff79d (diff) | |
download | openlmi-providers-ccbd146d63917eeaed49eb2479f2f69ac4ea6ad0.tar.gz openlmi-providers-ccbd146d63917eeaed49eb2479f2f69ac4ea6ad0.tar.xz openlmi-providers-ccbd146d63917eeaed49eb2479f2f69ac4ea6ad0.zip |
indmanager: Pass IMManager* instance in the IMInstGather callback
Manual instance creation in the gather callback sometimes requires access
to the CMPIBroker instance, stored in the indication manager struct.
Diffstat (limited to 'src/indmanager')
-rw-r--r-- | src/indmanager/ind_manager.c | 6 | ||||
-rw-r--r-- | src/indmanager/ind_manager.h | 9 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/indmanager/ind_manager.c b/src/indmanager/ind_manager.c index 4a8c06c..737dc78 100644 --- a/src/indmanager/ind_manager.c +++ b/src/indmanager/ind_manager.c @@ -708,7 +708,7 @@ static void *manage(void *data) manager->data = &diffs; } DEBUG("manage thread calling gather"); - while (manager->gather(&iold, &inew, manager->data)) { + while (manager->gather(manager, &iold, &inew, manager->data)) { send_indication(iold, inew, manager); } pthread_mutex_unlock(&_t_mutex); @@ -720,8 +720,8 @@ static void *manage(void *data) * It is going thru all polled instances. If there is some pair (previous enum * and this enum) */ -static bool default_gather (CMPIInstance **old_inst, CMPIInstance **new_inst, - void* data) +static bool default_gather (const IMManager *manager, CMPIInstance **old_inst, + CMPIInstance **new_inst, void* data) { // passed data is a list of diffs // It is going to be called in loop diff --git a/src/indmanager/ind_manager.h b/src/indmanager/ind_manager.h index 27a4cd7..b82fa69 100644 --- a/src/indmanager/ind_manager.h +++ b/src/indmanager/ind_manager.h @@ -75,8 +75,11 @@ * im_stop_ind() in provider's disable indications */ +// forward definitions +typedef struct _IMManager IMManager; + // callback functions -typedef bool (*IMInstGather) (CMPIInstance **old, CMPIInstance **new, void *data); +typedef bool (*IMInstGather) (const IMManager *manager, CMPIInstance **old, CMPIInstance **new, void *data); typedef bool (*IMFilterChecker) (const CMPISelectExp *filter); typedef bool (*IMEventWatcher) (void **data); @@ -121,7 +124,7 @@ typedef struct _IMEnumerations { IMEnumerationPair *first; } IMEnumerations; -typedef struct _IMManager { +struct _IMManager { // callback functions IMEventWatcher watcher; IMInstGather gather; @@ -138,7 +141,7 @@ typedef struct _IMManager { IMEnumerations *enums; // passed data, used for communication between gather/watcher/etc. void *data; -} IMManager; +}; typedef enum { IM_ERR_OK, |