ClRcT _clTxnAgentAppendActiveJob(CL_IN ClBufferHandleT outMsg) { ClRcT rc = CL_OK; ClTxnDefnT *pTxnDefn; ClCntNodeHandleT currTxnNode; ClCharT pOutMsg[1024]; CL_FUNC_ENTER(); rc = clCntFirstNodeGet(clTxnAgntCfg->activeTxnMap, &currTxnNode); while (rc == CL_OK) { ClCntNodeHandleT nodeTxn; ClCntNodeHandleT currJobNode; ClTxnAppJobDefnT *pNewTxnJob; /* Retrieve data-node for node */ rc = clCntNodeUserDataGet(clTxnAgntCfg->activeTxnMap, currTxnNode, (ClCntDataHandleT *)&pTxnDefn); if(CL_OK != rc) { clLogError("AGT", "CLI", "User data get failed with error [0x%x]", rc); return rc; } rc = clCntFirstNodeGet(pTxnDefn->jobList, &currJobNode); while (rc == CL_OK) { ClCntNodeHandleT nodeJob; /* Retrieve data-node for node */ rc = clCntNodeUserDataGet(pTxnDefn->jobList, currJobNode, (ClCntDataHandleT *)&pNewTxnJob); pOutMsg[0] = '\0'; sprintf(pOutMsg, " 0x%x:0x%x\t| 0x%x\t| %30s \n", pTxnDefn->serverTxnId.txnMgrNodeAddress, pTxnDefn->serverTxnId.txnId, pNewTxnJob->jobId.jobId, gCliTxnStatusStr[pNewTxnJob->currentState]); clXdrMarshallArrayClUint8T(&pOutMsg, strlen((char*)pOutMsg), outMsg, 0); nodeJob = currJobNode; rc = clCntNextNodeGet(pTxnDefn->jobList, nodeJob, &currJobNode); } nodeTxn = currTxnNode; rc = clCntNextNodeGet(clTxnAgntCfg->activeTxnMap, nodeTxn, &currTxnNode); } if(CL_GET_ERROR_CODE(rc) == CL_ERR_NOT_EXIST) rc = CL_OK; CL_FUNC_EXIT(); return(rc); }
ClRcT cpmInvocationGetWithLock(ClInvocationT invocationId, ClUint32T *cbType, void **data) { ClRcT rc = CL_OK; ClCntNodeHandleT cntNodeHandle = 0; ClCpmInvocationT *invocationData = NULL; /* * Check the input parameter */ if ((data == NULL) || (cbType == NULL)) CL_CPM_CHECK(CL_LOG_SEV_ERROR, ("Invalid parameter passed \n"), CL_CPM_RC(CL_ERR_NULL_POINTER)); rc = clCntNodeFind(gpClCpm->invocationTable, (ClCntKeyHandleT)&invocationId, &cntNodeHandle); if (rc != CL_OK) goto failure; rc = clCntNodeUserDataGet(gpClCpm->invocationTable, cntNodeHandle, (ClCntDataHandleT *) &invocationData); if (rc != CL_OK) goto failure; *data = invocationData->data; CL_CPM_INVOCATION_CB_TYPE_GET(invocationId, *cbType); return rc; failure: return rc; }
ClRcT _clGmsDbFind( CL_IN const ClGmsDbT* const gmsDb, CL_IN const ClGmsDbTypeT type, /* Suppressing coverity warning for pass by value with below comment */ // coverity[pass_by_value] CL_IN const ClGmsDbKeyT key, CL_INOUT void** const data) { ClRcT rc = CL_OK; ClCntKeyHandleT cntKey = NULL; ClCntNodeHandleT nodeData = NULL; if (gmsDb == (const void *)NULL) return CL_ERR_NULL_POINTER; rc = _clGmsDbGetKey(type, key, &cntKey); if (rc != CL_OK) return rc; rc = clCntNodeFind(gmsDb->htbl[type], cntKey, (ClCntNodeHandleT*) &nodeData); if (rc != CL_OK) return rc; rc = clCntNodeUserDataGet((ClCntHandleT) gmsDb->htbl[type], nodeData, (ClCntDataHandleT*)data); return rc; }
/* * Insert the class tab entry into the class id table. */ static ClRcT omClassEntryReload (ClCharT *pClassName, ClOmClassTypeT classId) { ClRcT rc = CL_OK; ClOmClassControlBlockT *pClassTab = NULL; ClCntNodeHandleT nodeHandle = 0; CL_FUNC_ENTER(); if(!pClassName) { rc = CL_OM_SET_RC(CL_OM_ERR_NULL_PTR); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("NULL PTR PASSED")); CL_FUNC_EXIT(); return rc; } CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("OM entry reload for class = %s, class type %d", pClassName, classId)); /* * First check if the class id entry is already present in the om class id table. */ if(clCntNodeFind(ghOmClassHashTbl, (ClCntKeyHandleT)(ClWordT)classId, &nodeHandle) == CL_OK) return CL_OK; /* Add this class entry into the OM class lookup table */ rc = clCntNodeFind(ghOmClassNameHashTbl, (ClCntKeyHandleT)pClassName, &nodeHandle); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Unable to find OM Class name [%s] entry in om class table", pClassName)); return (rc); } rc = clCntNodeUserDataGet(ghOmClassNameHashTbl, nodeHandle, (ClCntDataHandleT*)&pClassTab); if(rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Unable to get data for OM Class [%s] from om class name table", pClassName)); return rc; } /* * Insert this entry into the class id table. */ pClassTab->eMyClassType = classId; rc = clCntNodeAdd(ghOmClassHashTbl, (ClCntKeyHandleT)(ClWordT)pClassTab->eMyClassType, (ClCntDataHandleT)pClassTab, NULL); if(rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Unable to add entry [%#x] for class [%s] to OM class id table", classId, pClassName)); return rc; } CL_FUNC_EXIT(); return (rc); }
static ClRcT clLogSvrSOFGResponseProcess(ClLogFilterT *pStreamFilter, ClPtrT pCookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClCntNodeHandleT hStreamOwnerNode = (ClCntNodeHandleT) pCookie; ClLogSvrStreamDataT *pStreamData = NULL; ClLogSvrCommonEoDataT *pSvrCommonEoEntry = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogSvrEoEntryGet(&pSvrEoEntry, &pSvrCommonEoEntry); if( CL_OK != rc ) { return rc; } rc = clOsalMutexLock_L(&pSvrEoEntry->svrStreamTableLock); if( CL_OK != rc ) { return rc; } rc = clCntNodeUserDataGet(pSvrEoEntry->hSvrStreamTable, hStreamOwnerNode, (ClCntDataHandleT *) &pStreamData); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeUserDataGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clOsalMutexUnlock_L(&pSvrEoEntry->svrStreamTableLock), CL_OK); return rc; } rc = clLogServerStreamMutexLock(pStreamData); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalMutexLock(): rc[0x %x]\n", rc)); CL_LOG_CLEANUP(clOsalMutexUnlock_L(&pSvrEoEntry->svrStreamTableLock), CL_OK); return rc; } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&pSvrEoEntry->svrStreamTableLock), CL_OK); /* * Log Server will not intimate the client about this filter update, * as it is recreating the state for itself and filter may or may * not have been updated during that transient period. */ rc = clLogFilterAssign(pStreamData->pStreamHeader, pStreamFilter); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogFilterAssign(): rc[0x %x]\n", rc)); } CL_LOG_CLEANUP(clLogServerStreamMutexUnlock(pStreamData),CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT _clCorNodeNameToMoIdGet(ClNameT *nodeName, ClCorNodeDataPtrT *dataNode) { ClRcT rc = CL_OK; ClCntNodeHandleT nodeHandle = 0; ClNameT *tempName = NULL; if(nodeName == NULL) return CL_COR_SET_RC(CL_COR_ERR_NULL_PTR); /* Get the data from the hash table */ CL_DEBUG_PRINT(CL_DEBUG_TRACE,(" Node find for node Name %s", nodeName->value)); /* Do the node find and get the node handle for a particular node name. Now walk all the * node for that particular node handle type. */ rc = clCntNodeFind(nodeNameToMoIdTableHandle, (ClCntKeyHandleT)nodeName, &nodeHandle); if(CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_TRACE,("Failed to get the node Handle for the Node Name %s. rc [0x%x]", nodeName->value, rc)); return rc; } while(nodeHandle != 0) { rc = clCntNodeUserKeyGet(nodeNameToMoIdTableHandle, nodeHandle, (ClCntKeyHandleT *) &tempName); if (rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Failed to get the user key from the node handle. rc[0x%x]", rc)); break; } CL_DEBUG_PRINT(CL_DEBUG_TRACE,("Got the Nodename %s", tempName->value)); rc = clCntNodeUserDataGet(nodeNameToMoIdTableHandle, nodeHandle, (ClCntDataHandleT *)dataNode); if(rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Failed to get the user data from the node handle. rc [0x%x]", rc)); break; } if((strcmp (nodeName->value, (*dataNode)->nodeName.value)) == 0) { CL_DEBUG_PRINT(CL_DEBUG_TRACE,("Got the MoId for a Node Name %s", (*dataNode)->nodeName.value)); return CL_OK; } rc = clCntNextNodeGet(nodeNameToMoIdTableHandle, nodeHandle, &nodeHandle); if(rc != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_TRACE,("Failed to get the next node handle. rc[0x%x]", rc)); break; } } if(CL_OK != rc) CL_COR_RETURN_ERROR(CL_DEBUG_TRACE, "Could not get MOId from the node name", rc); return CL_OK; }
ClRcT cpmNodeFindLocked(SaUint8T *name, ClCpmLT **cpmL) { ClUint16T nodeKey = 0; ClCntNodeHandleT hNode = 0; ClCpmLT *tempNode = NULL; ClUint32T rc = CL_OK, numNode=0; rc = clCksm16bitCompute((ClUint8T *) name, strlen((const ClCharT*)name), &nodeKey); CL_CPM_CHECK_2(CL_LOG_SEV_ERROR, CL_CPM_LOG_2_CNT_CKSM_ERR, name, rc, rc, CL_LOG_HANDLE_APP); rc = clCntNodeFind(gpClCpm->cpmTable, (ClPtrT)(ClWordT)nodeKey, &hNode); CL_CPM_CHECK_3(CL_LOG_SEV_ERROR, CL_CPM_LOG_3_CNT_ENTITY_SEARCH_ERR, "node", name, rc, rc, CL_LOG_HANDLE_APP); rc = clCntKeySizeGet(gpClCpm->cpmTable, (ClPtrT)(ClWordT)nodeKey, &numNode); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_CNT_KEY_SIZE_GET_ERR, rc, rc, CL_LOG_HANDLE_APP); while (numNode > 0) { rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntDataHandleT *) &tempNode); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_CNT_NODE_USR_DATA_GET_ERR, rc, rc, CL_LOG_HANDLE_APP); if (!strcmp(tempNode->nodeName, (const ClCharT*)name)) { *cpmL = tempNode; goto done; } if(--numNode) { rc = clCntNextNodeGet(gpClCpm->cpmTable,hNode,&hNode); if(rc != CL_OK) { break; } } } rc = CL_CPM_RC(CL_ERR_DOESNT_EXIST); CL_CPM_CHECK_3(CL_LOG_SEV_ERROR, CL_CPM_LOG_3_CNT_ENTITY_SEARCH_ERR, "node", name, rc, rc, CL_LOG_HANDLE_APP); done: return CL_OK; failure: return rc; }
/** * Returns an OM class entry. * * This function returns a pointer to an OM class entry given * OM class Id. * * @param omClassKey - OM class type * * @returns * Pointer to class control block */ ClOmClassControlBlockT * clOmClassEntryGet(ClOmClassTypeT omClassKey) { ClRcT rc = CL_OK; #ifdef CL_DEBUG ClUint8T aFuncName[] = "clOmClassEntryGet()"; #endif ClCntNodeHandleT tempNodeHandle = 0; ClOmClassControlBlockT *pClassEntry = 0; CL_FUNC_ENTER(); if ((rc = omClassTypeValidate(omClassKey)) != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("%s: Invalid input OM class (rc = 0x%x)!\r\n", aFuncName, rc)); CL_ASSERT(NULL); CL_FUNC_EXIT(); return NULL; } /* find the node for this MO ID */ if ((rc = clCntNodeFind(ghOmClassHashTbl, (ClCntKeyHandleT)(ClWordT)omClassKey, &tempNodeHandle)) != CL_OK) { if (CL_GET_ERROR_CODE(rc) == CL_ERR_NOT_EXIST) { CL_DEBUG_PRINT(CL_DEBUG_INFO, ("%s: Node does not exist for OM class " "(0x%x), with rc 0x%x!\r\n", aFuncName, omClassKey, rc)); } else { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("%s: Failed to find node for OM class " "(0x%x), with rc 0x%x!\r\n", aFuncName, omClassKey, rc)); } return NULL; } /* now get the OM handle for this MO ID */ if ((rc = clCntNodeUserDataGet(ghOmClassHashTbl, tempNodeHandle, (ClCntDataHandleT *)&pClassEntry)) != CL_OK) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("%s: Failed to get the OM class entry from the " "node for OM class 0x%x, with rc 0x%x!\r\n", aFuncName, omClassKey, rc)); CL_ASSERT(NULL); return NULL; } return pClassEntry; }
ClRcT _clTxnAgentAppendServices(CL_IN ClBufferHandleT outMsg) { ClRcT rc = CL_OK; ClTxnAgentCompServiceInfoT *pCompInstance; ClCntNodeHandleT currNode; ClCharT pOutMsg[1024]; CL_FUNC_ENTER(); rc = clCntFirstNodeGet(clTxnAgntCfg->compServiceMap, &currNode); while (rc == CL_OK) { ClCntNodeHandleT node; /* Retrieve data-node for node */ rc = clCntNodeUserDataGet(clTxnAgntCfg->compServiceMap, currNode, (ClCntDataHandleT *)&pCompInstance); if(CL_OK != rc) { clLogError("AGT", "CLI", "User data get failed with error [0x%x]", rc); return rc; } pOutMsg[0] = '\0'; if(pCompInstance->serviceCapability == CL_TXN_AGENT_SERVICE_2PC) { sprintf(pOutMsg, " %6d\t| 2PC Capable \n", pCompInstance->serviceType); } else if(pCompInstance->serviceCapability == CL_TXN_AGENT_SERVICE_1PC) { sprintf(pOutMsg, " %6d\t| 1PC Capable \n", pCompInstance->serviceType); } clXdrMarshallArrayClUint8T(&pOutMsg, strlen((char*)pOutMsg), outMsg, 0); node = currNode; rc = clCntNextNodeGet(clTxnAgntCfg->compServiceMap, node, &currNode); } if(CL_GET_ERROR_CODE(rc) == CL_ERR_NOT_EXIST) rc = CL_OK; CL_FUNC_EXIT(); return(rc); }
ClUint32T cpmNodeFindByNodeId(ClUint32T nodeId, ClCpmLT **cpmL) { ClRcT rc = CL_OK; ClCntNodeHandleT cpmNode = 0; ClUint32T cpmLCount = 0; ClCpmLT *tempCpmL = NULL; ClUint32T found = 0; cpmLCount = gpClCpm->noOfCpm; if (gpClCpm->pCpmConfig->cpmType == CL_CPM_GLOBAL && cpmLCount != 0) { rc = clCntFirstNodeGet(gpClCpm->cpmTable, &cpmNode); CL_CPM_CHECK_2(CL_LOG_SEV_ERROR, CL_CPM_LOG_2_CNT_FIRST_NODE_GET_ERR, "CPM-L", rc, rc, CL_LOG_HANDLE_APP); while (cpmLCount) { rc = clCntNodeUserDataGet(gpClCpm->cpmTable, cpmNode, (ClCntDataHandleT *) &tempCpmL); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_CNT_NODE_USR_DATA_GET_ERR, rc, rc, CL_LOG_HANDLE_APP); if (tempCpmL->pCpmLocalInfo) { if ((ClUint32T) tempCpmL->pCpmLocalInfo->nodeId == nodeId) { *cpmL = tempCpmL; found = 1; break; } } cpmLCount--; if (cpmLCount) { rc = clCntNextNodeGet(gpClCpm->cpmTable, cpmNode, &cpmNode); CL_CPM_CHECK_2(CL_LOG_SEV_ERROR, CL_CPM_LOG_2_CNT_NEXT_NODE_GET_ERR, "CPM-L", rc, rc, CL_LOG_HANDLE_APP); } } } if(found == 1) return CL_OK; else return CL_CPM_RC(CL_ERR_DOESNT_EXIST); failure: *cpmL = NULL; return rc; }
ClRcT clCntNonUniqueKeyFind(ClCntHandleT container, ClCntKeyHandleT key, ClCntDataHandleT givenData, ClInt32T (*cmp)(ClCntDataHandleT data1, ClCntDataHandleT data2), ClCntDataHandleT *pDataHandle) { ClRcT rc = CL_OK; ClCntNodeHandleT node = 0; ClCntNodeHandleT nextNode = 0; ClCntDataHandleT data = 0; ClUint32T sz = 0; if(!container || !key || !givenData || !cmp || !pDataHandle) return CL_CNT_RC(CL_ERR_INVALID_PARAMETER); *pDataHandle = 0; rc = clCntNodeFind(container, key, &node); if(rc != CL_OK) return rc; rc = clCntKeySizeGet(container, key, &sz); if(rc != CL_OK) return rc; while(sz-- > 0 && node) { rc = clCntNodeUserDataGet(container, node, &data); if(rc != CL_OK) return rc; nextNode = 0; if(sz > 0) { rc = clCntNextNodeGet(container, node, &nextNode); if(rc != CL_OK) nextNode = 0; } if(!cmp(givenData, data)) { *pDataHandle = data; return CL_OK; } node = nextNode; } return CL_CNT_RC(CL_ERR_NOT_EXIST); }
ClRcT _clGmsDbGetFirst( CL_IN const ClGmsDbT* const gmsDb, CL_IN const ClGmsDbTypeT type, CL_OUT ClCntNodeHandleT** const gmsOpaque, CL_INOUT void** const data) { ClRcT rc = CL_OK; /* Get the first node which is an internal pointer * to the container data structure. */ if ((gmsDb == (const void *)NULL) || (data == NULL) || (gmsOpaque == NULL)) { return CL_ERR_NULL_POINTER; } rc = clCntFirstNodeGet((ClCntHandleT) gmsDb->htbl[type], (ClCntNodeHandleT*) gmsOpaque); if (rc == CL_CNT_RC(CL_ERR_NOT_EXIST)) { *data = NULL; return CL_OK; } if (rc != CL_OK) return rc; /* Get the real data */ rc = clCntNodeUserDataGet((ClCntHandleT) gmsDb->htbl[type], (ClCntNodeHandleT)*gmsOpaque, (ClCntDataHandleT*)(data)); if (rc == CL_CNT_RC(CL_ERR_NOT_EXIST)) { *data = NULL; return CL_OK; } return rc; }
ClRcT _clGmsNameIdDbFind(ClCntHandleT *dbPtr, ClNameT *name, ClGmsGroupIdT *id) { ClRcT rc = CL_OK; ClGmsDbKeyT key = {{0}}; ClCntKeyHandleT cntKey = NULL; ClCntNodeHandleT nodeData = NULL; ClGmsNodeIdPairT* node = NULL; if (dbPtr == NULL) { return CL_ERR_NULL_POINTER; } memcpy(&key.name, name, sizeof(ClNameT)); rc = _clGmsDbGetKey(CL_GMS_NAME_ID_DB, key, &cntKey); if (rc != CL_OK) { return rc; } rc = clCntNodeFind(*dbPtr, cntKey, (ClCntNodeHandleT*) &nodeData); if (rc != CL_OK) { return rc; } rc = clCntNodeUserDataGet(*dbPtr, nodeData, (ClCntDataHandleT*)&node); if (rc != CL_OK) { return rc; } *id =node->groupId; return rc; }
ClRcT cpmInvocationDeleteInvocation(ClInvocationT invocationId) { ClRcT rc = CL_OK; ClCntNodeHandleT cntNodeHandle = 0; ClCpmInvocationT *invocationData = NULL; clOsalMutexLock(gpClCpm->invocationMutex); rc = clCntNodeFind(gpClCpm->invocationTable, (ClCntKeyHandleT)&invocationId, &cntNodeHandle); if (rc != CL_OK) goto withLock; rc = clCntNodeUserDataGet(gpClCpm->invocationTable, cntNodeHandle, (ClCntDataHandleT *) &invocationData); if (rc != CL_OK) goto withLock; rc = clCntNodeDelete(gpClCpm->invocationTable, cntNodeHandle); if (rc != CL_OK) goto withLock; if( (invocationData->flags & CL_CPM_INVOCATION_DATA_COPIED)) { clHeapFree(invocationData->data); } clHeapFree(invocationData); clOsalMutexUnlock(gpClCpm->invocationMutex); clLogDebug("INVOCATION", "DEL", "Deleted invocation [%#llx]", invocationId); return rc; withLock: clOsalMutexUnlock(gpClCpm->invocationMutex); return rc; }
ClRcT _clGmsDbGetNext( CL_IN const ClGmsDbT* const gmsDb, CL_IN const ClGmsDbTypeT type, CL_INOUT ClCntNodeHandleT** const gmsOpaque, CL_OUT void** const data) { ClRcT rc = CL_OK; ClCntNodeHandleT *gmsOldOpaque = NULL; if ((gmsDb == (const void *)NULL) || (data == NULL) || (gmsOpaque == NULL)) { return CL_ERR_NULL_POINTER; } gmsOldOpaque = *gmsOpaque; rc = clCntNextNodeGet(gmsDb->htbl[type], (ClCntNodeHandleT) gmsOldOpaque, (ClCntNodeHandleT*)gmsOpaque); if (rc == CL_CNT_RC(CL_ERR_NOT_EXIST)) { *data = NULL; return CL_OK; } if (rc != CL_OK) return rc; rc = clCntNodeUserDataGet((ClCntHandleT) gmsDb->htbl[type], (ClCntNodeHandleT)*gmsOpaque, (ClCntDataHandleT*)(data)); if (rc == CL_CNT_RC(CL_ERR_NOT_EXIST)) { *data = NULL; return CL_OK; } return rc; }
ClRcT clCntDataForKeyGet(ClCntHandleT containerHandle, ClCntKeyHandleT userKey, ClCntDataHandleT *pUserData) { ClCntNodeHandleT containerNode = CL_HANDLE_INVALID_VALUE; CclContainer_t *pContainer = NULL; ClRcT errorCode = CL_OK; nullChkRet(pUserData); *pUserData = CL_HANDLE_INVALID_VALUE; pContainer = (CclContainer_t *) containerHandle; nullChkRet(pContainer); if(pContainer->validContainer != CONTAINER_ID) { returnCntError(CL_ERR_INVALID_HANDLE, "Passed container handle is invalid"); } if(pContainer->isUniqueFlag == 0) { returnCntError(CL_ERR_NOT_IMPLEMENTED, "This feature is not applicaple for non unique container"); } errorCode = clCntNodeFind(containerHandle, userKey, &containerNode); if(errorCode != CL_OK) { returnCntError(CL_ERR_NOT_EXIST, "Key doesn't exist"); } errorCode = clCntNodeUserDataGet(containerHandle, containerNode, pUserData); if(errorCode != CL_OK) { return(errorCode); } return(CL_OK); }
/* * Function - clLogStreamOwnerCheckpoint() * - Based on scope , Checkpoint the data */ ClRcT clLogStreamOwnerCheckpoint(ClLogSOEoDataT *pSoEoEntry, ClLogStreamScopeT streamScope, ClCntNodeHandleT hStreamOwnerNode, ClLogStreamKeyT *pStreamKey) { ClRcT rc = CL_OK; ClCntHandleT hStreamTable = CL_HANDLE_INVALID_VALUE; ClLogStreamOwnerDataT *pStreamOwnerData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); hStreamTable = (CL_LOG_STREAM_GLOBAL == streamScope) ? pSoEoEntry->hGStreamOwnerTable : pSoEoEntry->hLStreamOwnerTable ; rc = clCntNodeUserDataGet(hStreamTable, hStreamOwnerNode, (ClCntDataHandleT *) &pStreamOwnerData); if( CL_OK != rc ) { CL_LOG_DEBUG_TRACE(("clCntNodeFind(): rc[0x %x]", rc)); return rc; } if( CL_LOG_STREAM_GLOBAL == streamScope ) { clLogStreamOwnerGlobalCheckpoint(pSoEoEntry, &pStreamKey->streamName, &pStreamKey->streamScopeNode, pStreamOwnerData); } else { clLogStreamOwnerLocalCheckpoint(pSoEoEntry, &pStreamKey->streamName, &pStreamKey->streamScopeNode, pStreamOwnerData); } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogStreamDataDump(ClHandleDatabaseHandleT hDb, ClLogStreamHandleT hStream, ClPtrT pCookie) { ClRcT rc = CL_OK; ClLogStreamHandleDataT *pData = NULL; ClLogClntStreamDataT *pStreamInfo = NULL; ClLogClntEoDataT *pClntEoEntry = NULL; ClCharT **ppRet = (ClCharT**) pCookie; ClCharT ret[MAX_DEBUG_DISPLAY]; ClCharT p[MAX_DEBUG_DISPLAY]; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogClntEoEntryGet(&pClntEoEntry); if( CL_OK != rc ) { return rc; } rc = clHandleCheckout(hDb, hStream, (void **) (&pData)); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clHandleCheckout(): rc[0x %x]", rc)); return rc; } memset(ret, '\0', MAX_DEBUG_DISPLAY); memset(p, '\0', MAX_DEBUG_DISPLAY); if( CL_LOG_STREAM_HANDLE == pData->type ) { snprintf(ret, MAX_DEBUG_DISPLAY, "Stream handle: %#llX\nStreamNode: %p\n", hStream, (ClPtrT) pData->hClntStreamNode); rc = clCntNodeUserDataGet(pClntEoEntry->hClntStreamTable, pData->hClntStreamNode, (ClCntDataHandleT *) &pStreamInfo); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeUserDataGet(): rc[0x %x]", rc)); return rc; } snprintf(p,MAX_DEBUG_DISPLAY, "Stream Header: %p\n", (ClCharT *) pStreamInfo->pStreamHeader); strncat(ret, p, CL_MIN(strlen(p), (MAX_DEBUG_DISPLAY-strlen(ret)-1))); snprintf(p,MAX_DEBUG_DISPLAY, "Shm Name: %.*s", pStreamInfo->shmName.length, pStreamInfo->shmName.pValue); strncat(ret, p, CL_MIN(strlen(p), (MAX_DEBUG_DISPLAY-strlen(ret)-1))); rc = clHandleCheckin(hDb, hStream); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clHandleCheckin(): rc[0x %x]", rc)); return rc; } *ppRet = (ClCharT*) clHeapAllocate(strlen(ret) + 1); if( NULL == *ppRet ) { CL_LOG_DEBUG_ERROR(("clHeapAllocate(): rc[0x %x]", rc)); return rc; } snprintf(*ppRet, strlen(ret)+1, ret); } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogHandlerDataDump(ClHandleDatabaseHandleT hDb, ClStreamHandleT hHandler, void *pCookie) { ClRcT rc = CL_OK; ClLogHandlerHandleDataT *pData = NULL; ClLogClntHandlerNodeT *pHandlerInfo = NULL; ClLogClntEoDataT *pClntEoEntry = NULL; ClUint32T bitmapLen = 0; ClCharT s[256]; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogClntEoEntryGet(&pClntEoEntry); if( CL_OK != rc ) { return rc; } rc = clHandleCheckout(hDb, hHandler, (void **) (&pData)); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clHandleCheckout(): rc[0x %x]", rc)); return rc; } if( CL_LOG_HANDLER_HANDLE == pData->type ) { CL_LOG_DEBUG_TRACE(("Handler handle: %d\nInit handle: %d" " Handler Flag%d\n" , hStream, pData->hLog, pData->handlerFlags)); rc = clCntNodeUserDataGet(pClntEoEntry->hStreamHandlerTable, pData->hClntHandlerNode, (ClCntDataHandleT *) &pHandlerInfo); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeUserDataGet(): rc[0x %x]", rc)); return rc; } sprintf(s, pHandlerInfo->streamName.length, "%s", pHandlerInfo->streamName.value); CL_LOG_DEBUG_TRACE(("Stream Name: %s\n", s)); sprintf(s, pHandlerInfo->nodeName.length, "%s", pHandlerInfo->nodeName.value); CL_LOG_DEBUG_TRACE(("Node Name: %s\n", s)); bitmapLen = clBitmapLen(pStreamInfo->hStreamBitmap); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBitmapLen(): rc[0x %x]", rc)); return rc; } CL_LOG_DEBUG_TRACE(("hStreamBitmap:\n")); for( i = 0; i < bitmapLen; i++ ) { if( clBitmapIsBitSet(pData->hStreamBitmap, i, &rc) ) { CL_LOG_DEBUG_TRACE(("%d ", 1)); } else { CL_LOG_DEBUG_TRACE(("%d ", 0)); } } } rc = clHandleCheckin(hDb, hStream); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clHandleCheckin(): rc[0x %x]", rc)); return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
static ClRcT __clCntWalk(ClCntHandleT containerHandle, ClCntWalkCallbackT fpUserWalkCallback, ClCntArgHandleT userDataArg, ClInt32T dataLength, ClBoolT failSafe) { CclContainer_t *pContainer = NULL; ClCntNodeHandleT containerNode = CL_HANDLE_INVALID_VALUE; ClCntNodeHandleT nextContainerNode = CL_HANDLE_INVALID_VALUE; ClCntDataHandleT userData = CL_HANDLE_INVALID_VALUE; ClCntKeyHandleT userKey = CL_HANDLE_INVALID_VALUE; BaseLinkedListNode_t *pTemp = NULL; ClRcT errorCode = CL_OK; nullChkRet(fpUserWalkCallback); pContainer = (CclContainer_t *) containerHandle; nullChkRet(pContainer); if(pContainer->validContainer != CONTAINER_ID) { returnCntError(CL_ERR_INVALID_HANDLE, "Passed container handle is invalid"); } errorCode = clCntFirstNodeGet (containerHandle, &containerNode); if(errorCode != CL_OK) { if((CL_GET_ERROR_CODE(errorCode)) == CL_ERR_NOT_EXIST) { /* If the container is empty it means we dont have to walk anymore. * Hence return OK. */ return (CL_OK); } return(errorCode); } while (containerNode) { pTemp = (BaseLinkedListNode_t*) containerNode; if(clCntNextNodeGet(containerHandle, containerNode, &nextContainerNode) != CL_OK) { nextContainerNode = 0; } if ((pTemp->pRbeExpression == NULL) || (clRuleExprEvaluate(pTemp->pRbeExpression, (ClUint32T*) userDataArg, dataLength))) { errorCode = clCntNodeUserKeyGet (containerHandle, containerNode, &userKey); errorCode = clCntNodeUserDataGet (containerHandle, containerNode, &userData); errorCode = fpUserWalkCallback(userKey, userData, userDataArg,dataLength); if(!failSafe && (CL_OK != errorCode)) { return (errorCode); } } containerNode = nextContainerNode; } return(CL_OK); }
static ClRcT rmdSendTimerFunc(void *pData) { ClCntNodeHandleT nodeHandle; ClRmdRecordSendT *rec = NULL; ClRcT rc; ClRcT retCode = 0; ClRmdObjT *pRmdObject; ClRmdAsyncCallbackT fpTempPtr; void *cookie; ClBufferHandleT outMsgHdl; ClEoExecutionObjT *pThis = NULL; ClUint64T msgId = (ClUint32T)(ClWordT) pData; CL_FUNC_ENTER(); if (pData == NULL) { return (CL_RMD_RC(CL_ERR_INVALID_BUFFER)); } rc = clEoMyEoObjectGet(&pThis); if ( CL_OK != rc ) { return rc; } pRmdObject = (ClRmdObjT *) (pThis->rmdObj); if (pRmdObject == NULL) { return (CL_RMD_RC(CL_ERR_INVALID_BUFFER)); } rc = clOsalMutexLock(pRmdObject->semaForSendHashTable); CL_ASSERT(rc == CL_OK); clLogNotice("CALLBACK", "TASKS","Enter rmdSendTimerFunc 0"); rc = clCntNodeFind(pRmdObject->sndRecContainerHandle, (ClPtrT)(ClWordT)msgId, &nodeHandle); if (rc == CL_OK) { clLogNotice("CALLBACK", "TASKS","Enter rmdSendTimerFunc 1"); rc = clCntNodeUserDataGet(pRmdObject->sndRecContainerHandle, nodeHandle, (ClCntDataHandleT *) &rec); if (rc == CL_OK) { clLogNotice("CALLBACK", "TASKS","Enter rmdSendTimerFunc 2"); if (rec) { /* * Disabling retries for ASYNC since we dont want * to land up in duplicate send mess as anyway we have * accounted for the retries while creating the async timer. */ if (0 && rec->recType.asyncRec.noOfRetry > 0) { /* * key is part of record so no need to free just reuse */ retCode = resendMsg(rec, pRmdObject, pThis); } else { /* * key is part of record so no need to free, it will be * freed by hash delete callback */ RMD_STAT_INC(pRmdObject->rmdStats.nCallTimeouts); retCode = clTimerDeleteAsync(&rec->recType.asyncRec.timerID); if (rec->recType.asyncRec.func) { /* * unlocking it as callback func can make the rmd call */ ClBufferHandleT message; fpTempPtr = rec->recType.asyncRec.func; cookie = rec->recType.asyncRec.cookie; outMsgHdl = rec->recType.asyncRec.outMsgHdl; message = rec->recType.asyncRec.sndMsgHdl; clBufferHeaderTrim(message, rec->hdrLen); rc = clCntNodeDelete(pRmdObject->sndRecContainerHandle, nodeHandle); rc = clOsalMutexUnlock(pRmdObject-> semaForSendHashTable); fpTempPtr((CL_RMD_RC(CL_ERR_TIMEOUT)), cookie, message, outMsgHdl); clBufferDelete(&(message)); rc = clOsalMutexLock(pRmdObject->semaForSendHashTable); } } } } } rc = clOsalMutexUnlock(pRmdObject->semaForSendHashTable); CL_ASSERT(rc == CL_OK); CL_FUNC_EXIT(); return CL_OK; }
static ClRcT cpmNodeRmv(ClCharT *nodeName) { ClRcT rc = CL_OK; ClUint16T nodeKey = 0; ClCntNodeHandleT hNode = 0; ClUint32T numNode = 0; ClCpmLT *cpm = NULL; ClBoolT done = CL_NO; if (!nodeName) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "NULL pointer passed."); goto failure; } rc = clCksm16bitCompute((ClUint8T *)nodeName, strlen(nodeName), &nodeKey); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Failed to compute checksum for node, " "error [%#x]", rc); goto failure; } clOsalMutexLock(gpClCpm->cpmTableMutex); rc = clCntNodeFind(gpClCpm->cpmTable, (ClCntKeyHandleT)(ClWordT)nodeKey, &hNode); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Failed to find node [%s], error [%#x]", nodeName, rc); goto unlock; } rc = clCntKeySizeGet(gpClCpm->cpmTable, (ClCntKeyHandleT)(ClWordT)nodeKey, &numNode); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Unable to get key size, error [%#x]", rc); goto unlock; } while (numNode > 0) { rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntNodeHandleT *) &cpm); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Unable to get user data, error [%#x]", rc); goto unlock; } if (!strncmp(nodeName, cpm->nodeName, CL_MAX_NAME_LENGTH-1)) { clCntNodeDelete(gpClCpm->cpmTable, hNode); done = CL_YES; break; } if (--numNode) { rc = clCntNextNodeGet(gpClCpm->cpmTable, hNode, &hNode); if (CL_OK != rc) { break; } } } if (!done) { rc = CL_CPM_RC(CL_ERR_DOESNT_EXIST); goto unlock; } --gpClCpm->noOfCpm; clOsalMutexUnlock(gpClCpm->cpmTableMutex); /* * Delete from slot table */ clOsalMutexLock(&gpClCpm->cpmMutex); if(cpmSlotClassDelete(nodeName) != CL_OK) { clLogWarning("CPM", "MGMT", "Slot class delete failed for node [%s]", nodeName); } clOsalMutexUnlock(&gpClCpm->cpmMutex); return CL_OK; unlock: clOsalMutexUnlock(gpClCpm->cpmTableMutex); failure: return rc; }
ClRcT cpmPrintDBXML(FILE *fp) { ClRcT rc = CL_OK; ClCntNodeHandleT cpmNode = 0; ClUint32T cpmLCount = 0; ClCpmLT *cpmL = NULL; fprintf(fp,"<cpm>\n"); /* * Walk through the cpm table to find and display SCs */ clOsalMutexLock(gpClCpm->cpmTableMutex); cpmLCount = gpClCpm->noOfCpm; if (gpClCpm->pCpmConfig->cpmType == CL_CPM_GLOBAL && cpmLCount != 0) { rc = clCntFirstNodeGet(gpClCpm->cpmTable, &cpmNode); if(rc != CL_OK) { clLogError(CPM_LOG_AREA_DB,CPM_LOG_CTX_DB_XML,CL_CPM_LOG_2_CNT_FIRST_NODE_GET_ERR, "CPM-L", rc); clLogWrite((CL_LOG_HANDLE_APP), (CL_LOG_SEV_DEBUG), NULL, CL_CPM_LOG_2_CNT_FIRST_NODE_GET_ERR, ("CPM-L"), (rc)); goto out_unlock; } while (cpmLCount) { rc = clCntNodeUserDataGet(gpClCpm->cpmTable, cpmNode, (ClCntDataHandleT *) &cpmL); if(rc != CL_OK) { clLogError(CPM_LOG_AREA_DB,CPM_LOG_CTX_DB_XML,CL_CPM_LOG_1_CNT_NODE_USR_DATA_GET_ERR, rc); clLogWrite((CL_LOG_HANDLE_APP), (CL_LOG_SEV_DEBUG), NULL, CL_CPM_LOG_1_CNT_NODE_USR_DATA_GET_ERR, rc); goto out_unlock; } if (cpmL->pCpmLocalInfo) { /* * If the node is a SC, display its data */ if(!strcmp((const ClCharT *)cpmL->nodeType.value, (const ClCharT *)gpClCpm->pCpmLocalInfo->nodeType.value) || (ClUint32T) cpmL->pCpmLocalInfo->nodeId == gpClCpm->activeMasterNodeId || (ClUint32T) cpmL->pCpmLocalInfo->nodeId == gpClCpm->deputyNodeId) { fprintf(fp,"<node value=\"%s\">\n",cpmL->pCpmLocalInfo->nodeName); fprintf(fp,"<id value=\"%d\"/>\n",cpmL->pCpmLocalInfo->nodeId); fprintf(fp,"<ha_state value=\"%s\"/>\n",(ClUint32T) cpmL->pCpmLocalInfo->nodeId == gpClCpm->activeMasterNodeId ? "active" : "standby"); fprintf(fp,"</node>\n"); } } cpmLCount--; if (cpmLCount) { rc = clCntNextNodeGet(gpClCpm->cpmTable, cpmNode, &cpmNode); if(rc != CL_OK) { clLogError(CPM_LOG_AREA_DB,CPM_LOG_CTX_DB_XML,CL_CPM_LOG_2_CNT_NEXT_NODE_GET_ERR, "CPM-L", rc); clLogWrite((CL_LOG_HANDLE_APP), (CL_LOG_SEV_DEBUG), NULL, CL_CPM_LOG_2_CNT_NEXT_NODE_GET_ERR, ("CPM-L"), (rc)); goto out_unlock; } } } } rc = CL_OK; out_unlock: clOsalMutexUnlock(gpClCpm->cpmTableMutex); fprintf(fp,"</cpm>\n"); return rc; }
ClRcT _cpmClusterConfigList(ClInt32T argc, ClCharT **retStr) { ClCpmLT *cpmL = NULL; ClRcT rc = CL_OK; ClCntNodeHandleT hNode = 0; ClUint32T cpmLCount = 0; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to create message \n"), rc); if (argc != ONE_ARGUMENT) { sprintf(tempStr, "Usage: clusterList"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); goto done; } /* * Print the local stuff first */ sprintf(tempStr, "%s\n", "nodeName | status | iocAddress | iocPort "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); sprintf(tempStr, "%s\n", "-----------------------------------------------------------------------"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); /* * Now even the CPM/G information is stored in the list. * So no need of printing the above information. */ #if 0 if (gpClCpm->pCpmLocalInfo->status == CL_CPM_EO_DEAD) sprintf(tempStr, "%10s | DEAD | %8d | 0x%x\n", gpClCpm->pCpmLocalInfo->nodeName, gpClCpm->pCpmLocalInfo->cpmAddress.nodeAddress, gpClCpm->pCpmLocalInfo->cpmAddress.portId); else sprintf(tempStr, "%10s | ALIVE | %8d | 0x%x\n", gpClCpm->pCpmLocalInfo->nodeName, gpClCpm->pCpmLocalInfo->cpmAddress.nodeAddress, gpClCpm->pCpmLocalInfo->cpmAddress.portId); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); #endif /*_cpmListAllSU();*/ /* * Get all the CPMs one by one and delete the stuff. */ rc = clCntFirstNodeGet(gpClCpm->cpmTable, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first cpmTable Node %x\n", rc), rc); rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntDataHandleT *) &cpmL); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get container Node data %x\n", rc), rc); cpmLCount = gpClCpm->noOfCpm; while (cpmLCount) { if (cpmL->pCpmLocalInfo != NULL) { if (cpmL->pCpmLocalInfo->status == CL_CPM_EO_DEAD) { sprintf(tempStr, "%10s | DEAD | %8d | 0x%x\n", cpmL->nodeName, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); } else { sprintf(tempStr, "%10s | ALIVE | %8d | 0x%x\n", cpmL->nodeName, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); } rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } else { sprintf(tempStr, "%10s \n", cpmL->nodeName); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } #if 0 rc = clCntFirstNodeGet(cpmL->suTable, &hSU); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first su Node in cpmL %x\n", rc), rc); if (cpmL->pCpmLocalInfo != NULL) clOsalPrintf("%10s | %8d | %8d | 0x%8x| 0x%8x \n", cpmL->pCpmLocalInfo->nodeName, cpmL->pCpmLocalInfo->status, cpmL->pCpmLocalInfo->nodeId, cpmL->pCpmLocalInfo->cpmAddress.nodeAddress, cpmL->pCpmLocalInfo->cpmAddress.portId); else clOsalPrintf("%10s \n", cpmL->nodeName); suCount = cpmL->noOfsu; while (suCount) { rc = clCntNodeUserDataGet(cpmL->suTable, hSU, (ClCntDataHandleT *) &su); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get first container su Node data %x\n", rc), rc); clOsalPrintf("\t %10s |%15s |%11s |%16s \n", su->suName, _cpmPresenceStateNameGet(su->suPresenceState), _cpmOperStateNameGet(su->suOperState), _cpmReadinessStateNameGet(su->suReadinessState)); tempCompRef = su->suCompList; while (tempCompRef != NULL) { clOsalPrintf ("-----------------------------------------------------------------------\n"); clOsalPrintf("\t\t%10s %14d |%15s |%11s |%16s \n", tempCompRef->ref->compConfig->compName, tempCompRef->ref->compRestartCount, _cpmPresenceStateNameGet(tempCompRef->ref-> compPresenceState), _cpmOperStateNameGet(tempCompRef->ref-> compOperState), _cpmReadinessStateNameGet(tempCompRef->ref-> compReadinessState)); tempCompRef = tempCompRef->pNext; } suCount--; if (suCount) { rc = clCntNextNodeGet(cpmL->suTable, hSU, &hSU); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); } } #endif sprintf(tempStr, "%s", "-----------------------------------------------------------------------\n"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); cpmLCount--; if (cpmLCount) { rc = clCntNextNodeGet(gpClCpm->cpmTable, hNode, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->cpmTable, hNode, (ClCntDataHandleT *) &cpmL); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to get container Node data %d\n", rc), rc); } } /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ sprintf(tempStr, "%s", "\0"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to flatten message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return rc; failure: clBufferDelete(&message); return rc; }
static ClRcT cpmComponentRmv(ClCharT *compName) { ClRcT rc = CL_OK; ClUint16T compKey = 0; ClCntNodeHandleT hNode = 0; ClUint32T numNode = 0; ClCpmComponentT *comp = NULL; ClBoolT done = CL_NO; SaNameT entity = {0}; if (!compName) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "NULL pointer passed."); goto failure; } rc = clCksm16bitCompute((ClUint8T *)compName, strlen(compName), &compKey); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Failed to compute checksum for component, " "error [%#x]", rc); goto failure; } saNameSet(&entity, compName); /* * Clear pending invocations for the component being removed. */ (void)cpmInvocationClearCompInvocation(&entity); clOsalMutexLock(gpClCpm->compTableMutex); clOsalMutexLock(&gpClCpm->compTerminateMutex); rc = clCntNodeFind(gpClCpm->compTable, (ClCntKeyHandleT)(ClWordT)compKey, &hNode); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Failed to find component [%s], error [%#x]", compName, rc); goto unlock; } rc = clCntKeySizeGet(gpClCpm->compTable, (ClCntKeyHandleT)(ClWordT)compKey, &numNode); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Unable to get key size, error [%#x]", rc); goto unlock; } while (numNode > 0) { rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntNodeHandleT *) &comp); if (CL_OK != rc) { clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM, "Unable to get user data, error [%#x]", rc); goto unlock; } if (!strncmp(compName, comp->compConfig->compName, CL_MAX_NAME_LENGTH-1)) { clCntNodeDelete(gpClCpm->compTable, hNode); done = CL_YES; break; } if (--numNode) { rc = clCntNextNodeGet(gpClCpm->compTable, hNode, &hNode); if (CL_OK != rc) { break; } } } if (!done) { rc = CL_CPM_RC(CL_ERR_DOESNT_EXIST); goto unlock; } --gpClCpm->noOfComponent; clOsalMutexUnlock(&gpClCpm->compTerminateMutex); clOsalMutexUnlock(gpClCpm->compTableMutex); return CL_OK; unlock: clOsalMutexUnlock(&gpClCpm->compTerminateMutex); clOsalMutexUnlock(gpClCpm->compTableMutex); failure: return rc; }
ClRcT _clCpmComponentListAll(ClInt32T argc, ClCharT **retStr) { ClCntNodeHandleT hNode = 0; ClCpmComponentT *comp = NULL; ClUint32T rc = CL_OK, count; ClCpmEOListNodeT *eoList = NULL; ClCharT state[10] = "\0"; ClCharT status[10] = "\0"; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message; ClCharT cpmCompName[CL_MAX_NAME_LENGTH] = {0}; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to create message %x\n", rc), rc); if (argc != ONE_ARGUMENT) { rc = clBufferNBytesWrite(message, (ClUint8T *) STR_AND_SIZE("Usage: compList")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); rc = CL_CPM_RC(CL_ERR_INVALID_PARAMETER); goto done; } count = gpClCpm->noOfComponent; snprintf(cpmCompName, CL_MAX_NAME_LENGTH-1, "%s_%s", CL_CPM_COMPONENT_NAME, gpClCpm->pCpmLocalInfo->nodeName); rc = clCntFirstNodeGet(gpClCpm->compTable, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get First component \n"), rc); rc = clBufferNBytesWrite(message, (ClUint8T *) STR_AND_SIZE("################### List Of Components ########################\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode,(ClCntDataHandleT *) &comp); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE(" CompName | compId | eoPort | PID | RestartCount | PresenceState\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE("\t\t ID | Port | Name | Health |Recv Threads \n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferNBytesWrite(message, STR_AND_SIZE("========================================================================================\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); while (count) { if (strcmp(comp->compConfig->compName, cpmCompName)!=0) /* Skip if it is the CPM component */ { eoList = comp->eoHandle; int len = sprintf(tempStr, "%30s| 0x%x | 0x%x |%8d |%14d |%15s\n", comp->compConfig->compName, comp->compId, comp->eoPort, comp->processId, comp->compRestartCount, _cpmPresenceStateNameGet(comp->compPresenceState)); if (comp->compConfig->compProperty != CL_AMS_COMP_PROPERTY_SA_AWARE) { if(!eoList || !eoList->eoptr) { len += snprintf(tempStr + len, sizeof(tempStr) - len, "\t\t 0x%x | 0x%x |%10s |%10s |%04d \n", 0, 0, "-", "-", 0); } } rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr,len); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); while (eoList != NULL && eoList->eoptr != NULL) { compMgrStateStatusGet(eoList->status, eoList->eoptr->state, status, sizeof(status), state, sizeof(state)); int noOfThreads = (eoList->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) ? eoList->eoptr->noOfThreads + 1: eoList->eoptr->noOfThreads; int len = sprintf(tempStr, "\t\t 0x%llx | 0x%x |%10s |%10s |%04d \n", eoList->eoptr->eoID, eoList->eoptr->eoPort, eoList->eoptr->name, status, noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, len); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); eoList = eoList->pNext; } rc = clBufferNBytesWrite(message, STR_AND_SIZE("-----------------------------------------------------------------------------------------\n")); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); } count--; if (count) { rc = clCntNextNodeGet(gpClCpm->compTable, hNode, &hNode); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node Data %x\n", rc), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node user Data %x\n", rc), rc); } } /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ rc = clBufferNBytesWrite(message, (ClUint8T *) "\0", 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to flatten the message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return rc; failure: clBufferDelete(&message); return rc; }
ClRcT clCpmExecutionObjectListShow(ClInt32T argc, ClIocNodeAddressT compAddr, ClUint32T flag, ClEoIdT eoId, ClCharT **retStr) { /* * ClCpmEOListNodeT* ptr = gpClCpm->eoList; */ ClCpmEOListNodeT *ptr = NULL; ClCharT name[32] = "\0"; ClCharT state[10] = "\0"; ClCharT status[10] = "\0"; ClUint32T compCount = 0; ClCntNodeHandleT hNode = 0; ClCpmComponentT *comp = NULL; ClRcT rc = CL_OK; ClCharT tempStr[256]; ClCharT *tmpStr = NULL; ClBufferHandleT message = 0; rc = clBufferCreate(&message); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to create message %x\n", rc), rc); if (argc != ONE_ARGUMENT) { sprintf(tempStr, "Usage: EOShow"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); goto done; } sprintf(tempStr, "\n ID | Port | Name | Health | EO State | Recv Threads "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); sprintf(tempStr, "\n ===================================================================== "); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to write message %x\n", rc), rc); /* * take the semaphore */ if ((rc = clOsalMutexLock(gpClCpm->eoListMutex)) != CL_OK) CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Could not get Lock successfully------\n")); rc = clCntFirstNodeGet(gpClCpm->compTable, &hNode); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("Unable to Get First component \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("Unable to Get Node Data \n"), rc); compCount = gpClCpm->noOfComponent; while (compCount != 0) { ptr = comp->eoHandle; if (flag == 0) { while (ptr != NULL && ptr->eoptr != NULL) { strcpy(name, ptr->eoptr->name); /* * Obtain the state and status in string format */ compMgrStateStatusGet(ptr->status, ptr->eoptr->state, status, sizeof(status), state, sizeof(state)); if (ptr->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, (ptr->eoptr->noOfThreads + 1)); else sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); ptr = ptr->pNext; } } else { while (ptr != NULL && ptr->eoptr != NULL) { if (ptr->eoptr->eoID == eoId) { /* * obtain the state and status in string format */ compMgrStateStatusGet(ptr->status, ptr->eoptr->state, status, sizeof(status), state, sizeof(state)); strcpy(name, ptr->eoptr->name); if (ptr->eoptr->appType == CL_EO_USE_THREAD_FOR_RECV) sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d | ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads + 1); else sprintf(tempStr, "\n 0x%llx| 0x%x | %10s | %10s | %10s | %04d | ", ptr->eoptr->eoID, ptr->eoptr->eoPort, name, status, state, ptr->eoptr->noOfThreads); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, strlen(tempStr)); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); break; } ptr = ptr->pNext; } #if 0 if (ptr == NULL) CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("EOID not found\n")); #endif } compCount--; if (compCount) { rc = clCntNextNodeGet(gpClCpm->compTable, hNode, &hNode); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); rc = clCntNodeUserDataGet(gpClCpm->compTable, hNode, (ClCntDataHandleT *) &comp); CL_CPM_LOCK_CHECK(CL_DEBUG_ERROR, ("\n Unable to Get Node Data \n"), rc); } } /* * Release the semaphore */ rc = clOsalMutexUnlock(gpClCpm->eoListMutex); CL_CPM_CHECK(CL_DEBUG_ERROR, ("COMP_MGR: Could not UnLock successfully------\n"), rc); /* * Bug 4986 : * Moved the code to NULL terminate the string * below the done: label, so that the usage string * written to the buffer is also NULL terminated. */ done: /* * NULL terminate the string */ sprintf(tempStr, "%s", "\0"); rc = clBufferNBytesWrite(message, (ClUint8T *) tempStr, 1); CL_CPM_CHECK(CL_DEBUG_ERROR, ("\n Unable to write message \n"), rc); /* * Construct the return buffer */ rc = clBufferFlatten(message, (ClUint8T **) &tmpStr); CL_CPM_CHECK(CL_DEBUG_ERROR, ("Unable to flatten the message \n"), rc); *retStr = tmpStr; clBufferDelete(&message); return (CL_OK); withlock: /* * Release the semaphore */ rc = clOsalMutexUnlock(gpClCpm->eoListMutex); CL_CPM_CHECK(CL_DEBUG_ERROR, ("COMP_MGR: Could not UnLock successfully------\n"), rc); failure: clBufferDelete(&message); return rc; }
ClRcT clLogClntStreamWriteWithHeader(ClLogClntEoDataT *pClntEoEntry, ClLogSeverityT severity, ClUint16T serviceId, ClUint16T msgId, const ClCharT *pMsgHeader, va_list args, ClCntNodeHandleT hClntStreamNode) { ClRcT rc = CL_OK; ClLogClntStreamDataT *pClntData = NULL; ClLogStreamHeaderT *pStreamHeader = NULL; ClUint8T *pStreamRecords = NULL; ClUint32T nUnAcked = 0; ClUint32T nDroppedRecords = 0; ClUint8T *pBuffer = NULL; ClUint32T recordSize = 0; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_DEBUG_VERBOSE(("Severity: %d ServiceId: %hu MsgId: %hu CompId: %u", severity, serviceId, msgId, pClntEoEntry->compId)); rc = clCntNodeUserDataGet(pClntEoEntry->hClntStreamTable, hClntStreamNode, (ClCntDataHandleT *) &pClntData); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeUserDataGet(): rc[0x %x]", rc)); return rc; } pStreamHeader = pClntData->pStreamHeader; pStreamRecords = pClntData->pStreamRecords; #ifdef NO_SAF ClLogStreamKeyT *pUserKey = NULL; rc = clCntNodeUserKeyGet(pClntEoEntry->hClntStreamTable, hClntStreamNode, (ClCntKeyHandleT *) &pUserKey); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeUserKeyGet(): rc[0x %x]", rc)); return rc; } ClInt32T recSize= pClntData->recSize; #define __UPDATE_RECORD_SIZE do { \ if(recSize < nbytes ) \ recSize = nbytes; \ recSize -= nbytes; \ if(!recSize) \ return CL_OK; \ }while(0) ClUint16T streamId = 10; ClUint64T sequenceNum = pUserKey->sequenceNum; ClUint32T clientId = pClntEoEntry->clientId; ClUint8T* pRecord=clHeapAllocate(recSize); ClTimeT timeStamp = 0; ClUint8T *pRecStart = pRecord; ClUint16T tmp = 1; ClUint8T endian = *(ClUint8T *) &tmp; memset(pRecord, 0, recSize); if( CL_LOG_MSGID_PRINTF_FMT == msgId ) { ClInt32T nbytes = 0; if(recSize < LOG_ASCII_MIN_REC_SIZE ) /* just a minimum record size taking care of the headers*/ { printf("LOG record size has to be minimum [%d] bytes. Got [%d] bytes\n", LOG_ASCII_MIN_REC_SIZE, recSize); return CL_LOG_RC(CL_ERR_INVALID_PARAMETER); } /* * In ASCII logging, we dont need header, so just keeping only the * required fields */ nbytes = snprintf((ClCharT *)pRecord, recSize, LOG_ASCII_HDR_FMT, endian, severity & 0x1f); pRecord += nbytes; __UPDATE_RECORD_SIZE; { ClCharT *pSeverity = (ClCharT *)clLogSeverityStrGet(severity); ClCharT c = 0; ClInt32T hdrLen = 0; ClInt32T len = 0; va_list argsCopy; ClCharT *pFmtStr ; va_copy(argsCopy, args); pFmtStr = va_arg(argsCopy, ClCharT *); if(pMsgHeader && pMsgHeader[0]) { hdrLen = snprintf(&c, 1, "%s.%05lld : %6s) ", pMsgHeader, sequenceNum, pSeverity ? pSeverity : "DEBUG"); if(hdrLen < 0) hdrLen = 0; } len = vsnprintf(&c, 1, pFmtStr, argsCopy); va_end(argsCopy); if(len < 0) len = 0; hdrLen = CL_MIN(hdrLen, recSize - LOG_ASCII_HDR_LEN - LOG_ASCII_DATA_LEN - 1); len = CL_MIN(len, recSize - LOG_ASCII_HDR_LEN - LOG_ASCII_DATA_LEN - hdrLen - 1); nbytes = snprintf((ClCharT*)pRecord, recSize - 1, LOG_ASCII_HDR_LEN_FMT, hdrLen); pRecord += nbytes; __UPDATE_RECORD_SIZE; nbytes = snprintf((ClCharT*)pRecord, recSize - 1, LOG_ASCII_DATA_LEN_DELIMITER_FMT, len); pRecord += nbytes; __UPDATE_RECORD_SIZE; if(pMsgHeader && pMsgHeader[0]) { nbytes = snprintf((ClCharT*)pRecord, recSize - 1, "%s.%05lld : %6s) ", pMsgHeader, sequenceNum, pSeverity ? pSeverity : "DEBUG"); if(nbytes < 0) nbytes = 0; pRecord += nbytes; __UPDATE_RECORD_SIZE; } pFmtStr = va_arg(args, ClCharT *); nbytes = vsnprintf((ClCharT*)pRecord, recSize - 1, pFmtStr, args); if(nbytes < 0) nbytes = 0; } }
ClRcT clLogClntStreamOpen(ClLogHandleT hLog, SaNameT *pStreamName, SaNameT *pNodeName, ClStringT *pShmName, ClUint32T shmSize, ClLogStreamHandleT *phStream, ClUint32T recSize) { ClRcT rc = CL_OK; ClLogClntEoDataT *pClntEoEntry = NULL; ClBoolT addedTable = CL_FALSE; ClBoolT addedEntry = CL_FALSE; ClCntNodeHandleT hClntStreamNode = CL_HANDLE_INVALID_VALUE; ClLogClntStreamDataT *pUserData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pStreamName), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pNodeName), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pShmName), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((sizeof(ClLogStreamHeaderT) > shmSize), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); CL_LOG_PARAM_CHK((NULL == phStream), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogClntEoEntryGet(&pClntEoEntry); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogClntEoEntryGet(): rc[0x %x]", rc)); return rc; } rc = clOsalMutexLock_L(&(pClntEoEntry->clntStreamTblLock)); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalMutexLock(): rc[0x %x]", rc)); return rc; } if( CL_HANDLE_INVALID_VALUE == pClntEoEntry->hClntStreamTable ) { rc = clCntHashtblCreate(pClntEoEntry->maxStreams, clLogStreamKeyCompare, clLogStreamHashFn, clLogClntStreamDeleteCb, clLogClntStreamDeleteCb, CL_CNT_UNIQUE_KEY, &(pClntEoEntry->hClntStreamTable)); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntHashtblCreate(): rc[0x %x]", rc)); CL_LOG_CLEANUP( clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)),CL_OK); return rc; } addedTable = CL_TRUE; CL_LOG_DEBUG_VERBOSE(("Created the HashTable")); } rc = clLogClntStreamEntryGet(pClntEoEntry, pStreamName, pNodeName, pShmName, shmSize, &hClntStreamNode, &addedEntry); if( CL_OK != rc) { if( CL_TRUE == addedTable ) { CL_LOG_CLEANUP(clCntDelete(pClntEoEntry->hClntStreamTable), CL_OK); } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("Got the stream entry")); rc = clLogHandleStreamHandleCreate(hLog, hClntStreamNode, phStream); if( CL_OK != rc) { if( CL_TRUE == addedEntry ) { CL_LOG_CLEANUP(clCntNodeDelete(pClntEoEntry->hClntStreamTable, hClntStreamNode), CL_OK); } if( CL_TRUE == addedTable ) { CL_LOG_CLEANUP(clCntDelete(pClntEoEntry->hClntStreamTable), CL_OK); } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("Created the streamhandle")); rc = clCntNodeUserDataGet(pClntEoEntry->hClntStreamTable, hClntStreamNode, (ClCntDataHandleT *) &pUserData); if( CL_OK != rc ) { CL_LOG_CLEANUP(clHandleDestroy(pClntEoEntry->hClntHandleDB, *phStream), CL_OK); *phStream = CL_HANDLE_INVALID_VALUE; if( CL_TRUE == addedEntry ) { CL_LOG_CLEANUP(clCntNodeDelete(pClntEoEntry->hClntStreamTable, hClntStreamNode), CL_OK); } if( CL_TRUE == addedTable ) { CL_LOG_CLEANUP(clCntDelete(pClntEoEntry->hClntStreamTable), CL_OK); } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)), CL_OK); return rc; } #ifdef NO_SAF pUserData->recSize=recSize; #endif CL_LOG_DEBUG_VERBOSE(("Got stream entry")); rc = clBitmapBitSet(pUserData->hStreamBitmap, CL_HDL_IDX(*phStream)); if( CL_OK != rc ) { CL_LOG_CLEANUP(clHandleDestroy(pClntEoEntry->hClntHandleDB, *phStream), CL_OK); *phStream = CL_HANDLE_INVALID_VALUE; if( CL_TRUE == addedEntry ) { CL_LOG_CLEANUP(clCntNodeDelete(pClntEoEntry->hClntStreamTable, hClntStreamNode), CL_OK); } if( CL_TRUE == addedTable ) { CL_LOG_CLEANUP(clCntDelete(pClntEoEntry->hClntStreamTable), CL_OK); } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("Updated stream bitmap")); rc = clLogHandleInitHandleStreamAdd(hLog, *phStream); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBitmapBitClear(pUserData->hStreamBitmap, CL_HDL_IDX(*phStream)), CL_OK); CL_LOG_CLEANUP(clHandleDestroy(pClntEoEntry->hClntHandleDB, *phStream), CL_OK); *phStream = CL_HANDLE_INVALID_VALUE; if( CL_TRUE == addedEntry ) { CL_LOG_CLEANUP(clCntNodeDelete(pClntEoEntry->hClntStreamTable, hClntStreamNode), CL_OK); } if( CL_TRUE == addedTable ) { CL_LOG_CLEANUP(clCntDelete(pClntEoEntry->hClntStreamTable), CL_OK); } CL_LOG_CLEANUP(clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("Updated init handle")); rc = clOsalMutexUnlock_L(&(pClntEoEntry->clntStreamTblLock)); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalMutexUnlock(): rc[0x %x]", rc)); return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT cpmInvocationClearCompInvocation(SaNameT *compName) { ClRcT rc = CL_OK; ClCntNodeHandleT nodeHandle, nextNodeHandle; ClCpmInvocationT *invocationData = NULL; void *data = NULL; /* * Check the input parameter */ if (!compName) { CL_CPM_CHECK(CL_LOG_SEV_ERROR, ("Invalid parameter passed \n"), CL_CPM_RC(CL_ERR_NULL_POINTER)); } clOsalMutexLock(gpClCpm->invocationMutex); rc = clCntFirstNodeGet(gpClCpm->invocationTable, &nodeHandle); if (rc != CL_OK) goto withLock; while (nodeHandle) { rc = clCntNodeUserDataGet(gpClCpm->invocationTable, nodeHandle, (ClCntDataHandleT *) &invocationData); if (rc != CL_OK) goto withLock; rc = clCntNextNodeGet(gpClCpm->invocationTable, nodeHandle, &nextNodeHandle); if((data = invocationData->data)) { ClUint32T matched = 0; if ((invocationData->flags & CL_CPM_INVOCATION_AMS)) { matched = !strncmp((const ClCharT *) (((ClAmsInvocationT*) data)->compName.value), (const ClCharT *) compName->value, ((ClAmsInvocationT*) data)->compName.length); } else if ((invocationData->flags & CL_CPM_INVOCATION_CPM)) { matched = !strncmp((const ClCharT *) (((ClCpmComponentT*) data)->compConfig->compName), (const ClCharT *) compName->value, compName->length); } if(matched) { clLogDebug("INVOCATION", "CLEAR", "Clearing invocation for component [%.*s] " "invocation [%#llx]", compName->length, compName->value, invocationData->invocation); if (clCntNodeDelete(gpClCpm->invocationTable, nodeHandle) != CL_OK) goto withLock; if( (invocationData->flags & CL_CPM_INVOCATION_DATA_COPIED) ) clHeapFree(data); clHeapFree(invocationData); } } if (CL_GET_ERROR_CODE(rc) == CL_ERR_NOT_EXIST) break; if (rc != CL_OK) goto withLock; nodeHandle = nextNodeHandle; } clOsalMutexUnlock(gpClCpm->invocationMutex); return CL_OK; withLock: failure: clOsalMutexUnlock(gpClCpm->invocationMutex); return rc; }