From: Chris B. <buc...@us...> - 2013-10-18 20:16:31
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "sfcb - Small Footprint CIM Broker". The branch, master has been updated via 745f4b0f678c54e41236b77fcd7b9fee6c9f9898 (commit) via 62474f798c1169d55340edde46e0789d8e649572 (commit) via 92848afea74d84332acd3e7d4dcc7daf1c7baec1 (commit) from f769c13d5e6a1e8db3b4766fa6916bcdd87c607d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 745f4b0f678c54e41236b77fcd7b9fee6c9f9898 Author: buccella <buc...@li...> Date: Fri Oct 18 16:15:59 2013 -0400 [sfcb-tix:#85] SFCB: SfcbLocal interface should expose markHeap() and releaseHeap() commit 62474f798c1169d55340edde46e0789d8e649572 Author: buccella <buc...@li...> Date: Fri Oct 18 15:42:56 2013 -0400 [sfcb-tix:#84] Upcall mutex not freed on shutdown commit 92848afea74d84332acd3e7d4dcc7daf1c7baec1 Author: buccella <buc...@li...> Date: Fri Oct 18 15:08:31 2013 -0400 [sfcb-tix:#83] Add Alternate getObjectPath() for SfcbLocal Connections ----------------------------------------------------------------------- Summary of changes: brokerUpc.c | 10 ++++++- cimcClientSfcbLocal.c | 12 ++++++++ cimcClientSfcbLocal.h | 2 + instance.c | 76 ++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 98 insertions(+), 2 deletions(-) diff --git a/brokerUpc.c b/brokerUpc.c index 2f50ef8..ad70035 100644 --- a/brokerUpc.c +++ b/brokerUpc.c @@ -67,10 +67,18 @@ void closeProviderContext(BinRequestContext * ctx); static CMPI_MUTEX_TYPE mtx = NULL; void +freeUpCallMtx() +{ + free(mtx); +} + +void lockUpCall(const CMPIBroker * mb) { - if (mtx == NULL) + if (mtx == NULL) { mtx = mb->xft->newMutex(0); + atexit(freeUpCallMtx); + } mb->xft->lockMutex(mtx); } diff --git a/cimcClientSfcbLocal.c b/cimcClientSfcbLocal.c index 66f195b..b8286a8 100644 --- a/cimcClientSfcbLocal.c +++ b/cimcClientSfcbLocal.c @@ -168,6 +168,7 @@ cloneClient(Client __attribute__ ((unused)) *cl, CMPIStatus *st) return NULL; } +/* releases the Client created in CMPIConnect2() */ static CMPIStatus releaseClient(Client * mb) { @@ -2097,6 +2098,15 @@ newIndicationListener(ClientEnv *ce, int sslMode, int *portNumber, char **socket return NULL; } +void * _markHeap() { + return markHeap(); +} + +void _releaseHeap(void* heap) { + releaseHeap(heap); + return; +} + /* called by SFCC's NewCIMCEnv() */ ClientEnv * _Create_SfcbLocal_Env(char __attribute__ ((unused)) *id, unsigned int options, @@ -2117,6 +2127,8 @@ _Create_SfcbLocal_Env(char __attribute__ ((unused)) *id, unsigned int options, newDateTimeFromBinary, newDateTimeFromChars, newIndicationListener, + _markHeap, + _releaseHeap }; // localClientMode=1; diff --git a/cimcClientSfcbLocal.h b/cimcClientSfcbLocal.h index 6886b63..16d0957 100644 --- a/cimcClientSfcbLocal.h +++ b/cimcClientSfcbLocal.h @@ -178,6 +178,8 @@ extern "C" { void *(*newIndicationListener) (ClientEnv *ce, int sslMode, int *portNumber, char **socketName, void (*fp) (CMPIInstance *indInstance), CMPIStatus* rc); + void *(*markHeap)(); + void (*releaseHeap) (void* heap); } ClientEnvFT; struct _ClientEnv { diff --git a/instance.c b/instance.c index 3d97c03..bb6418b 100644 --- a/instance.c +++ b/instance.c @@ -576,6 +576,80 @@ __ift_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc) return cop; } +/* same as ift_gOP(), but used for SfcbLocal clients + eliminated klt hashtable, call mm to release tracked + CMPI objects before exiting */ +static CMPIObjectPath * +__iftLocal_getObjectPath(const CMPIInstance *instance, CMPIStatus *rc) +{ + int j, + f = 0; + CMPIStatus tmp; + const char *cn; + const char *ns; + void* hc; + + if (!instance->hdl) { + if (rc) + CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE); + return NULL; + } + + cn = ClInstanceGetClassName((ClInstance *) instance->hdl); + ns = ClInstanceGetNameSpace((ClInstance *) instance->hdl); + + CMPIObjectPath *cop = TrackedCMPIObjectPath(ns, cn, rc); + + if (rc && rc->rc != CMPI_RC_OK) + return NULL; + + j = __ift_getPropertyCount(instance, NULL); + + hc = markHeap(); + while (j--) { + char *keyName; + CMPIData d = + __ift_internal_getPropertyAt(instance, j, &keyName, &tmp, 1, NULL); + if (d.state & CMPI_keyValue) { + CMAddKey(cop, keyName, &d.value, d.type); + f++; + } + if (d.type & CMPI_ARRAY && (d.state & CMPI_nullValue) == 0) { + d.value.array->ft->release(d.value.array); + } + } + + if (f == 0) { + CMPIArray *kl; + CMPIData d; + unsigned int e, + m; + + CMPIConstClass *cc = getConstClass(ns, cn); + if (cc) { + kl = cc->ft->getKeyList(cc); + } else { + if (rc) { + CMSetStatus(rc, CMPI_RC_ERR_INVALID_CLASS); + } + releaseHeap(hc); + return NULL; + } + m = kl->ft->getSize(kl, NULL); + + for (e = 0; e < m; e++) { + CMPIString *n = kl->ft->getElementAt(kl, e, NULL).value.string; + d = __ift_getProperty(instance, CMGetCharPtr(n), &tmp); + if (tmp.rc == CMPI_RC_OK) { + CMAddKey(cop, CMGetCharPtr(n), &d.value, d.type); + } + } + CMRelease(kl); + } + releaseHeap(hc); + return cop; +} + static CMPIStatus __ift_internal_setPropertyFilter(CMPIInstance *instance, const char **propertyList, const char **keys) @@ -852,7 +926,7 @@ NATIVE_FT_VERSION, __ift_getPropertyAt, __ift_getPropertyCount, __ift_setProperty, - __ift_getObjectPath, + __iftLocal_getObjectPath, __ift_setPropertyFilter, __ift_getQualifier, __ift_getQualifierAt, hooks/post-receive -- sfcb - Small Footprint CIM Broker |