diff options
author | Tomas Bzatek <tbzatek@redhat.com> | 2013-12-20 15:34:18 +0100 |
---|---|---|
committer | Tomas Bzatek <tbzatek@redhat.com> | 2013-12-20 15:34:18 +0100 |
commit | c98f09a865f1b2246c320e9a80c452ca38a4f9ea (patch) | |
tree | 0d83a84892023d083d8008fc2a4b07e87bca4055 | |
parent | 5a8d8f3619ca041aae1c232479aad1aeea747980 (diff) | |
download | openlmi-providers-c98f09a865f1b2246c320e9a80c452ca38a4f9ea.tar.gz openlmi-providers-c98f09a865f1b2246c320e9a80c452ca38a4f9ea.tar.xz openlmi-providers-c98f09a865f1b2246c320e9a80c452ca38a4f9ea.zip |
indmanager: Code annotation cleanup
- annotate functions that are supposed to be called with mutex held
- mark functions static if not exported public
- remove unused declarations
-rw-r--r-- | src/indmanager/ind_manager.c | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/src/indmanager/ind_manager.c b/src/indmanager/ind_manager.c index fcd232f..aae061a 100644 --- a/src/indmanager/ind_manager.c +++ b/src/indmanager/ind_manager.c @@ -68,8 +68,7 @@ typedef enum _IMIDiff { IM_I_CHANGE // Instances are different in non-key properties } IMIDiff; -IMIDiff compare_instances(CMPIInstance *, CMPIInstance *); -bool maybe_remove_polled(IMManager *, CMPIObjectPath *, IMError *); +static IMIDiff compare_instances(CMPIInstance *, CMPIInstance *); /* CMPI rc handler */ CMPIStatus im_rc; @@ -79,7 +78,7 @@ CMPIStatus im_rc; * return true if they are same, false otherwise * is using ft->toString() */ -bool compare_objectpaths(CMPIObjectPath *op1, CMPIObjectPath *op2) +static bool compare_objectpaths(CMPIObjectPath *op1, CMPIObjectPath *op2) { return (strcmp(CMGetCharsPtr(CMObjectPathToString(op1, NULL), NULL), CMGetCharsPtr(CMObjectPathToString(op2, NULL), NULL)) == 0); @@ -90,7 +89,7 @@ bool compare_objectpaths(CMPIObjectPath *op1, CMPIObjectPath *op2) * return true if they are the same, false otherwise * note: inspired by value.c:sfcb_comp_CMPIValue() from sblim-sfcb */ -bool compare_values(CMPIValue *v1, CMPIValue *v2, CMPIType type) +static bool compare_values(CMPIValue *v1, CMPIValue *v2, CMPIType type) { // Checks for NULL, but it is incorrect #define CHECK_PTRS \ @@ -161,7 +160,7 @@ bool compare_values(CMPIValue *v1, CMPIValue *v2, CMPIType type) * Compare 2 instances. * They can be same, different in key properties or different in non-key props */ -IMIDiff compare_instances(CMPIInstance *i1, CMPIInstance *i2) +static IMIDiff compare_instances(CMPIInstance *i1, CMPIInstance *i2) { CMPIString *prop_name = NULL; // At first compare key properties. They will differ in most cases @@ -213,7 +212,8 @@ IMIDiff compare_instances(CMPIInstance *i1, CMPIInstance *i2) * returns nothing * Does not perform any checks */ -void remove_diff(IMPolledDiffs *d) +/* Called with lock held */ +static void remove_diff(IMPolledDiffs *d) { IMPolledDiff *first = d->first; if (first) { @@ -227,8 +227,9 @@ void remove_diff(IMPolledDiffs *d) * First argument is diffs list. * Returns true when ok, false if not and set IMError */ -bool add_diff(IMPolledDiffs *d, CMPIInstance *newi, CMPIInstance *oldi, - IMError *err) +/* Called with lock held */ +static bool add_diff(IMPolledDiffs *d, CMPIInstance *newi, CMPIInstance *oldi, + IMError *err) { IMPolledDiff *nd = malloc(sizeof(IMPolledDiff)); if (!nd) { @@ -256,7 +257,8 @@ bool add_diff(IMPolledDiffs *d, CMPIInstance *newi, CMPIInstance *oldi, * - old value and new NULL => instance deletion * Return true when ok, false if not and set IMError */ -bool gen_diffs(IMManager *manager, IMPolledDiffs *d, IMError *err) +/* Called with lock held */ +static bool gen_diffs(IMManager *manager, IMPolledDiffs *d, IMError *err) { DEBUG("gen diffs called"); if (!manager) { @@ -350,7 +352,7 @@ bool gen_diffs(IMManager *manager, IMPolledDiffs *d, IMError *err) * Extract object path from select expression * returns match for the first occurence of ISA operator */ -CMPIObjectPath *get_object_path(const CMPIBroker *broker, CMPISelectExp *se) +static CMPIObjectPath *get_object_path(const CMPIBroker *broker, CMPISelectExp *se) { CMPISelectCond *sc = CMGetDoc(se, NULL); CMPICount scount = CMGetSubCondCountAndType(sc,NULL,NULL); @@ -376,7 +378,7 @@ CMPIObjectPath *get_object_path(const CMPIBroker *broker, CMPISelectExp *se) // compare 2 object paths, return true when equal, false if not // equality is set by comparing class names and namespaces -bool equal_ops(CMPIObjectPath *op1, CMPIObjectPath *op2) +static bool equal_ops(CMPIObjectPath *op1, CMPIObjectPath *op2) { return (strcmp(NS_STR_FROM_OP(op1), NS_STR_FROM_OP(op2)) == 0 && strcmp(CN_STR_FROM_OP(op1), CN_STR_FROM_OP(op2)) == 0); @@ -384,7 +386,8 @@ bool equal_ops(CMPIObjectPath *op1, CMPIObjectPath *op2) // Pair enumerations. This enum will become prev enum and new this enum // will be created by new obtained by object path -bool pair_enumeration(IMManager *manager, IMEnumerationPair *epair) +/* Called with lock held */ +static bool pair_enumeration(IMManager *manager, IMEnumerationPair *epair) { CMPIEnumeration *aux_e = CBEnumInstances(manager->broker, manager->ctx_manage, epair->op, NULL, NULL); @@ -407,7 +410,8 @@ bool pair_enumeration(IMManager *manager, IMEnumerationPair *epair) // When the filter is added there is no enum pairs created // This function will generate pairs where they are missing -bool first_poll(IMManager *manager, IMError *err) +/* Called with lock held */ +static bool first_poll(IMManager *manager, IMError *err) { DEBUG("IM first poll called"); if (!manager) { @@ -432,7 +436,8 @@ bool first_poll(IMManager *manager, IMError *err) // Try to find enumeration with given object path // if found increase reference count // if not found add it to the end of list with ref count = 1 -bool add_enumeration(IMManager *manager, CMPIObjectPath *op, IMError *err) +/* Called with lock held */ +static bool add_enumeration(IMManager *manager, CMPIObjectPath *op, IMError *err) { if (!manager) { *err = IM_ERR_MANAGER; @@ -482,7 +487,8 @@ bool add_enumeration(IMManager *manager, CMPIObjectPath *op, IMError *err) return true; } -bool _im_poll(IMManager *manager, IMError *err) +/* Called with lock held */ +static bool _im_poll(IMManager *manager, IMError *err) { DEBUG("IM poll called"); if (!manager) { @@ -509,7 +515,7 @@ bool _im_poll(IMManager *manager, IMError *err) /* * Fill ind_inst with properties and send it */ -bool send_creation_indication(CMPIInstance *ind_inst, CMPIInstance *new_inst, +static bool send_creation_indication(CMPIInstance *ind_inst, CMPIInstance *new_inst, IMManager *manager) { DEBUG("Instance creation indication to be send"); @@ -526,7 +532,7 @@ bool send_creation_indication(CMPIInstance *ind_inst, CMPIInstance *new_inst, /* * Fill ind_inst with properties and send it */ -bool send_deletion_indication(CMPIInstance *ind_inst, CMPIInstance *old_inst, +static bool send_deletion_indication(CMPIInstance *ind_inst, CMPIInstance *old_inst, IMManager *manager) { DEBUG("Instance deletion indication to be send"); @@ -543,7 +549,7 @@ bool send_deletion_indication(CMPIInstance *ind_inst, CMPIInstance *old_inst, /* * Fill ind_inst with properties and send it */ -bool send_modification_indication(CMPIInstance *ind_inst, CMPIInstance *new, +static bool send_modification_indication(CMPIInstance *ind_inst, CMPIInstance *new, CMPIInstance *old, IMManager *manager) { DEBUG("Instance modification indication to be send"); @@ -565,7 +571,7 @@ bool send_modification_indication(CMPIInstance *ind_inst, CMPIInstance *new, * returns NULL when not found or on error * Caller has to free memory. */ -char *get_classname(CMPISelectExp *se) +static char *get_classname(CMPISelectExp *se) { if (!se) { return NULL; @@ -604,7 +610,8 @@ char *get_classname(CMPISelectExp *se) * to send. * Returns true when everything is OK. False otherwise. */ -bool send_indication(CMPIInstance *old, CMPIInstance *new, IMManager *manager) +/* Called with lock held */ +static bool send_indication(CMPIInstance *old, CMPIInstance *new, IMManager *manager) { if (!manager) { return false; @@ -753,6 +760,7 @@ static void *manage_wrapper(void *data) * It is going thru all polled instances. If there is some pair (previous enum * and this enum) */ +/* Called with lock held */ static bool default_gather (const IMManager *manager, CMPIInstance **old_inst, CMPIInstance **new_inst, void* data) { @@ -975,7 +983,8 @@ bool im_verify_filter(IMManager *manager, const CMPISelectExp *filter, * Return true when ok, or NULL and error set * appropiately */ -bool _im_add_filter(IMManager *manager, CMPISelectExp *se, IMError *err) +/* Called with lock held */ +static bool _im_add_filter(IMManager *manager, CMPISelectExp *se, IMError *err) { if (!se) { *err = IM_ERR_SELECT_EXP; @@ -1109,7 +1118,8 @@ bool im_register_filter_classes(IMManager *manager, * the whole enumerations. * Returns true/false on success/fail and set err. */ -bool maybe_remove_polled(IMManager *manager, CMPIObjectPath *op, IMError *err) +/* Called with lock held */ +static bool maybe_remove_polled(IMManager *manager, CMPIObjectPath *op, IMError *err) { if (!manager->enums || !manager->enums->first) { *err = IM_ERR_NOT_FOUND; |