static ClRcT clLogSvrDsIdMapRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T buffSize, ClPtrT pCookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClBufferHandleT inMsg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((CL_LOG_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *) pBuffer, buffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(inMsg, &pSvrEoEntry->nextDsId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[0x %x]\n", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("DsIdCnt: %d", pSvrEoEntry->nextDsId)); rc = clLogBitmapUnpack(inMsg, pSvrEoEntry->hDsIdMap); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogBitmapUnpack(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clCorAmfMoIdGet(const ClCharT *name, ClAmsEntityTypeT type, ClCorMOIdT *pMoId) { ClAmsEntityT entity = {0}; ClBufferHandleT msg = 0; ClRcT rc = CL_OK; ClVersionT version = {'B', 0x1, 0x1}; ClCharT *data = NULL; ClUint32T dataLen = 0; ClCorObjectHandleT objHandle; if(!name || !pMoId) return CL_COR_SET_RC(CL_ERR_INVALID_PARAMETER); if(!mgmtHandle) { rc = clAmsMgmtInitialize(&mgmtHandle, NULL, &version); if(rc != CL_OK) return rc; } entity.type = type; clNameSet(&entity.name, name); ++entity.name.length; rc = clAmsMgmtEntityUserDataGetKey(mgmtHandle, &entity, &entity.name, &data, &dataLen); if(rc != CL_OK) { clLogError("FLT", "REPAIR", "Entity data get for [%s] returned [%#x]", entity.name.value, rc); goto out_free; } rc = clBufferCreate(&msg); CL_ASSERT(rc == CL_OK); rc = clBufferNBytesWrite(msg, (ClUint8T*)data, dataLen); CL_ASSERT(rc == CL_OK); rc = VDECL_VER(clXdrUnmarshallClCorMOIdT, 4, 0, 0)(msg, pMoId); CL_ASSERT(rc == CL_OK); clBufferDelete(&msg); clLogNotice("COR", "AMF", "MOID for faulty entity [%s] ", entity.name.value); clCorMoIdShow(pMoId); /* * Validating moid */ rc = clCorObjectHandleGet(pMoId, &objHandle); CL_ASSERT(rc == CL_OK); out_free: if(msg) clBufferDelete(&msg); if(data) clHeapFree(data); return rc; }
static ClRcT clLogMasterFileEntryRecover(ClLogMasterEoDataT *pMasterEoEntry, ClCkptIOVectorElementT *pIoVector, ClUint32T *pErrIndex) { ClRcT rc = CL_OK; ClBufferHandleT hFileEntryBuf = CL_HANDLE_INVALID_VALUE; ClVersionT version = {0}; CL_LOG_DEBUG_TRACE(("Enter: size %lld", pIoVector->readSize)); rc = clBufferCreate(&hFileEntryBuf); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(hFileEntryBuf, (ClUint8T*) pIoVector->dataBuffer, pIoVector->readSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); return rc; } rc = clXdrUnmarshallClVersionT(hFileEntryBuf, &version); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClVersionT(): rc[%#x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); return rc; } switch(CL_VERSION_CODE(version.releaseCode, version.majorVersion, version.minorVersion)) { case CL_VERSION_CODE(CL_RELEASE_VERSION, CL_MAJOR_VERSION, CL_MINOR_VERSION): { rc = fileEntryRecoverBaseVersion(pMasterEoEntry, hFileEntryBuf); } break; default: rc = CL_LOG_RC(CL_ERR_VERSION_MISMATCH); clLogError("FILE", "RECOVER", "Version [%d.%d.%d] unsupported", version.releaseCode, version.majorVersion, version.minorVersion); break; } CL_LOG_CLEANUP(clBufferDelete(&hFileEntryBuf), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogMasterCompData2BufferGet(ClLogCompDataT *pCompData, ClUint8T **ppBuffer, ClUint32T *pDataSize) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); rc = clBufferCreate(&msg); if(CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = VDECL_VER(clXdrMarshallClLogCompDataT, 4, 0, 0)(pCompData, msg, 0); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogMarshallClLogCompDataT(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clBufferLengthGet(msg, pDataSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferLengthGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } *ppBuffer = (ClUint8T*) clHeapCalloc(*pDataSize, sizeof(ClUint8T)); if( NULL == *ppBuffer ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return CL_LOG_RC(CL_ERR_NO_MEMORY); } rc = clBufferNBytesRead(msg, *ppBuffer, pDataSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesRead(): rc[0x %x]", rc)); clHeapFree(*ppBuffer); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return CL_OK; }
ClRcT clLogSODsIdMapRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClLogSOEoDataT *pSoEoEntry = NULL; ClLogSvrCommonEoDataT *pCommonEoData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((CL_LOG_SO_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogStreamOwnerEoEntryGet(&pSoEoEntry, &pCommonEoData); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(msg, (ClUint8T *) pBuffer, size); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesRead(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(msg, &pSoEoEntry->dsIdCnt); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("dsIdCnt : %d", pSoEoEntry->dsIdCnt)); rc = clLogBitmapUnpack(msg, pSoEoEntry->hDsIdMap); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit: rc[0x %x]", rc)); return rc; }
ClRcT clLogMasterCompTableStateRecover(ClLogMasterEoDataT *pMasterEoEntry, ClUint8T *pBuffer, ClUint32T dataSize) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClUint32T versionCode = 0; CL_LOG_DEBUG_TRACE(("Enter")); rc = clBufferCreate(&msg); if(CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(msg, pBuffer, dataSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clXdrUnmarshallClUint32T(msg, &versionCode); if( CL_OK != rc) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[%#x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } switch(versionCode) { case CL_VERSION_CODE(CL_RELEASE_VERSION, CL_MAJOR_VERSION, CL_MINOR_VERSION): { rc = compTableStateRecoverBaseVersion(msg); } break; default: clLogError("COMP", "TBL-RECOVER", "Version [%d.%d.%d] is not supported", CL_VERSION_RELEASE(versionCode), CL_VERSION_MAJOR(versionCode), CL_VERSION_MINOR(versionCode)); rc = CL_LOG_RC(CL_ERR_VERSION_MISMATCH); } clBufferDelete(&msg); return rc; }
ClRcT clNameContextCkptDeserializer(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT inMsg = 0; CL_NAME_DEBUG_TRACE(("Enter")); if( CL_NAME_CONTEXT_GBL_DSID != dsId ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("dsId is not proper\n")); return CL_NS_RC(CL_ERR_INVALID_PARAMETER); } if( NULL == pBuffer ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Passed Value is NULL")); return CL_NS_RC(CL_ERR_NULL_POINTER); } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferCreate() : rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *)pBuffer, size); if( CL_OK != rc ) { clBufferDelete(&inMsg); CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferNBytesWrite(): rc[0x %x]", rc)); return rc; } rc = clNameContextCkptNameUnpack(inMsg); if( CL_OK != rc ) { clBufferDelete(&inMsg); return rc; } if( CL_OK != (rc = clBufferDelete(&inMsg)) ) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clBufferDelete(): rc[0x %x]", rc)); } CL_NAME_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clNodeCacheLeaderIocSend(ClIocNodeAddressT currentLeader, ClIocAddressT *dstAddr) { ClRcT rc = CL_OK; ClIocSendOptionT sendOption = {CL_IOC_HIGH_PRIORITY,0,0,CL_IOC_PERSISTENT_MSG,200 }; ClIocPhysicalAddressT compAddr = { CL_IOC_BROADCAST_ADDRESS, CL_IOC_CPM_PORT }; ClTimerTimeOutT delay = { 0, 200 }; ClUint32T i = 0; ClBufferHandleT message = 0; ClEoExecutionObjT *eoObj = NULL; ClIocNotificationT notification; memset(¬ification,0,sizeof(ClIocNotificationT)); notification.protoVersion = htonl(CL_IOC_NOTIFICATION_VERSION); notification.id = (ClIocNotificationIdT) htonl(CL_IOC_NODE_ARRIVAL_NOTIFICATION); notification.nodeAddress.iocPhyAddress.nodeAddress = htonl(clIocLocalAddressGet()); notification.nodeAddress.iocPhyAddress.portId = htonl(CL_IOC_GMS_PORT); clEoMyEoObjectGet(&eoObj); while(!eoObj && i++ <= 3) { clEoMyEoObjectGet(&eoObj); clOsalTaskDelay(delay); } if(!eoObj) { clLogWarning("CAP", "ARP", "Could not send current leader update since EO still uninitialized."); return CL_ERR_NOT_INITIALIZED; } clBufferCreate(&message); currentLeader = htonl(currentLeader); rc = clBufferNBytesWrite(message, (ClUint8T *)¬ification, sizeof(ClIocNotificationT)); rc |= clBufferNBytesWrite(message, (ClUint8T*)¤tLeader, sizeof(currentLeader)); if (rc != CL_OK) { clLogError("CAP", "ARP", "clBufferNBytesWrite failed with rc = %#x", rc); clBufferDelete(&message); return rc; } rc = clIocSend(eoObj->commObj, message, CL_IOC_PORT_NOTIFICATION_PROTO, dstAddr, &sendOption); clBufferDelete(&message); return rc; }
static ClRcT clLogSvrStreamEntryRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T buffSize, ClPtrT cookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClBufferHandleT inMsg = CL_HANDLE_INVALID_VALUE; ClLogSvrCommonEoDataT *pSvrCommonEoEntry = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogSvrEoEntryGet(&pSvrEoEntry, &pSvrCommonEoEntry); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesWrite(inMsg, (ClUint8T *) pBuffer, buffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } rc = clLogSvrStreamEntryUnpackNAdd(pSvrEoEntry, pSvrCommonEoEntry, inMsg, dsId); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
static void GetTimeAsyncCallback_4_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; acTimeT_4_0_0 current; memset(&(current), 0, sizeof(acTimeT_4_0_0)); if (CL_OK == rc) { retVal = clXdrUnmarshallacTimeT_4_0_0(outMsgHdl, &(current)); if (CL_OK != retVal) { goto L0; } } if (rc != CL_OK) { retVal = rc; } clprintf(CL_LOG_SEV_INFO,"Get Time RPC Async [ From External App]: [%02d:%02d:%02d]",current.hour,current.minute,current.second); ((Alarm_clock_EOGetTimeAsyncCallbackT_4_0_0)(pCookie->actualCallback))(pCookie->handle, &(current), retVal, pCookie->pCookie); goto L1; L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
ClRcT clDebugResponseSend(ClRmdResponseContextHandleT responseHandle, ClBufferHandleT *pOutMsgHandle, ClCharT *respBuffer, ClRcT retCode) { ClRcT rc = CL_OK; ClBufferHandleT outMsgHandle = 0; if(!responseHandle) return CL_DEBUG_RC(CL_ERR_INVALID_PARAMETER); if(pOutMsgHandle) { outMsgHandle = *pOutMsgHandle; *pOutMsgHandle = 0; } rc = clDebugResponseMarshall(respBuffer, retCode, outMsgHandle); if(rc != CL_OK) { if(outMsgHandle) { if(clBufferDelete(&outMsgHandle) != CL_OK) clHeapFree((void*)outMsgHandle); } return rc; } rc = clRmdSyncResponseSend(responseHandle, outMsgHandle, retCode); return rc; }
ClRcT clLogClntStreamListUnpack(ClUint32T numStreams, ClUint32T buffLen, ClUint8T *pBuffer, ClLogStreamInfoT **ppLogStreams) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); *ppLogStreams = clHeapCalloc(numStreams, sizeof(ClLogStreamInfoT)); if( NULL == *ppLogStreams ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); clHeapFree(*ppLogStreams); return rc; } rc = clBufferNBytesWrite(msg, pBuffer, buffLen); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); clHeapFree(*ppLogStreams); return rc; } rc = clLogClntStreamListGet(msg, *ppLogStreams); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); clHeapFree(*ppLogStreams); return rc; } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clRmdReceiveAsyncReply(ClEoExecutionObjT *pThis, ClBufferHandleT rmdRecvMsg, ClUint8T priority, ClUint8T protoType, ClUint32T length, ClIocPhysicalAddressT srcAddr) { ClRmdPktT msg = {{ {0} }}; ClRcT rc = CL_OK; ClRmdAckSendContextT sendContext = {0}; ClUint32T size = 0; clRmdDumpPkt("received async reply", rmdRecvMsg); RMD_DBG4((" RMD receive Async Reply\n")); rc = clBufferReadOffsetSet(rmdRecvMsg, 0, CL_BUFFER_SEEK_SET); rc = clRmdUnmarshallRmdHdr(rmdRecvMsg, &msg.ClRmdHdr, &size); if(rc != CL_OK) { clBufferDelete(&rmdRecvMsg); RMD_DBG3((" %s: Bad Message, rc 0x%x", __FUNCTION__, rc)); return rc; } CL_RMD_VERSION_VERIFY(msg.ClRmdHdr, rc); if (rc != CL_OK) { clBufferDelete(&rmdRecvMsg); return CL_OK; } rc = rmdHandleAsyncReply(pThis, &msg, size, &srcAddr, priority, protoType, rmdRecvMsg); sendContext.srcAddr = srcAddr; sendContext.priority = priority; sendContext.ClRmdHdr = msg.ClRmdHdr; rc = rmdAckSend(pThis,&sendContext); if(rc != CL_OK) { clLogTrace("ACK","ASYN","Error in rmdAckSend for async. rc = 0x%x.\n",rc); } #if RMD_FILTER_CLEANUP clRMDCheckAndCallCommPortCleanup(pThis); #endif return CL_OK; }
static void clMsgGroupMembershipUpdateAsyncCallback_4_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; ClMsgSyncActionT_4_0_0 syncAct; ClNameT pGroupName; ClNameT pQueueName; ClUint16T updateCkpt; memset(&(syncAct), 0, sizeof(ClMsgSyncActionT_4_0_0)); memset(&(pGroupName), 0, sizeof(ClNameT)); memset(&(pQueueName), 0, sizeof(ClNameT)); memset(&(updateCkpt), 0, sizeof(ClUint16T)); retVal = clXdrUnmarshallClMsgSyncActionT_4_0_0(inMsgHdl, &(syncAct)); if (CL_OK != retVal) { goto L0; } retVal = clXdrUnmarshallClNameT(inMsgHdl, &(pGroupName)); if (CL_OK != retVal) { goto L1; } retVal = clXdrUnmarshallClNameT(inMsgHdl, &(pQueueName)); if (CL_OK != retVal) { goto L2; } retVal = clXdrUnmarshallClUint16T(inMsgHdl, &(updateCkpt)); if (CL_OK != retVal) { goto L3; } if (rc != CL_OK) { retVal = rc; } ((MsgIdlClMsgGroupMembershipUpdateAsyncCallbackT_4_0_0)(pCookie->actualCallback))(pCookie->handle, syncAct, &(pGroupName), &(pQueueName), updateCkpt, retVal, pCookie->pCookie); goto L4; L4: L3: L2: L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
/* * Function - clLogStreamOwnerLocalCheckpoint() * - Do Local Checkpointing. * - If the dataset is not yet created, create the dataSet * - Write onto it. */ ClRcT clLogStreamOwnerLocalCheckpoint(ClLogSOEoDataT *pSoEoEntry, SaNameT *pStreamName, SaNameT *pStreamScopeNode, ClLogStreamOwnerDataT *pStreamOwnerData) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClLogSvrCommonEoDataT *pCommonEoData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogStreamOwnerEoEntryGet(NULL, &pCommonEoData); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clLogStreamOwnerEntryPack(pStreamName, pStreamScopeNode, pStreamOwnerData, msg); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clCkptLibraryCkptDataSetWrite(pCommonEoData->hLibCkpt, (SaNameT *) &gSOLocalCkptName, pStreamOwnerData->dsId, msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(( "clCkptLibraryCkptDataSetWrite(): rc[0x %x]", rc)); } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clCpmEventPayLoadExtract(ClEventHandleT eventHandle, ClSizeT eventDataSize, ClCpmEventTypeT cpmEventType, void *payLoad) { ClRcT rc = CL_OK; ClBufferHandleT payLoadMsg = 0; void *eventData = NULL; eventData = clHeapAllocate(eventDataSize); if (eventData == NULL) { clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_SEV_DEBUG, CL_CPM_CLIENT_LIB, CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED); CPM_CLIENT_CHECK(CL_LOG_SEV_ERROR, ("Unable to malloc \n"), CL_CPM_RC(CL_ERR_NO_MEMORY)); } rc = clEventDataGet (eventHandle, eventData, &eventDataSize); if (rc != CL_OK) { clOsalPrintf("Event Data Get failed. rc=[0x%x]\n", rc); goto failure; } rc = clBufferCreate(&payLoadMsg); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_BUF_CREATE_ERR, rc, rc, CL_LOG_HANDLE_APP); rc = clBufferNBytesWrite(payLoadMsg, (ClUint8T *)eventData, eventDataSize); CL_CPM_CHECK_1(CL_LOG_SEV_ERROR, CL_CPM_LOG_1_BUF_WRITE_ERR, rc, rc, CL_LOG_HANDLE_APP); switch(cpmEventType) { case CL_CPM_COMP_EVENT: rc = VDECL_VER(clXdrUnmarshallClCpmEventPayLoadT, 4, 0, 0)(payLoadMsg, payLoad); CL_CPM_CHECK_0(CL_LOG_SEV_ERROR, CL_LOG_MESSAGE_0_INVALID_BUFFER, rc, CL_LOG_HANDLE_APP); break; case CL_CPM_NODE_EVENT: rc = VDECL_VER(clXdrUnmarshallClCpmEventNodePayLoadT, 4, 0, 0)(payLoadMsg, payLoad); CL_CPM_CHECK_0(CL_LOG_SEV_ERROR, CL_LOG_MESSAGE_0_INVALID_BUFFER, rc, CL_LOG_HANDLE_APP); break; default: clOsalPrintf("Invalid event type received.\n"); goto failure; break; } failure: clBufferDelete(&payLoadMsg); clHeapFree(eventData); return rc; }
ClRcT clAmsMgmtCCBBatchFinalize(ClAmsMgmtCCBBatchHandleT *batchHandle) { ClAmsMgmtCCBBatchT *batch = NULL; if(!batchHandle || !(batch = (ClAmsMgmtCCBBatchT*)*batchHandle)) return CL_AMS_RC(CL_ERR_INVALID_PARAMETER); if(batch->buffer) clBufferDelete(&batch->buffer); clHeapFree(batch); *batchHandle = (ClAmsMgmtCCBBatchHandleT)0; return CL_OK; }
static ClRcT amsMgmtCCBBatchBufferInitialize(ClAmsMgmtCCBBatchT *batch) { ClRcT rc = CL_OK; if(batch->buffer) { rc |= clBufferDelete(&batch->buffer); if(rc != CL_OK) goto out; batch->buffer = 0; } rc |= clBufferCreate(&batch->buffer); if(rc != CL_OK) goto out; batch->items = 0; batch->version = CL_VERSION_CURRENT; clNodeCacheMinVersionGet(NULL, &batch->version); rc = clXdrMarshallClUint32T(&batch->version, batch->buffer, 0); if(rc != CL_OK) { goto out_free; } rc = clBufferWriteOffsetGet(batch->buffer, &batch->itemsOffset); if(rc != CL_OK) { goto out_free; } rc = clXdrMarshallClUint32T(&batch->items, batch->buffer, 0); if(rc != CL_OK) { goto out_free; } goto out; out_free: clBufferDelete(&batch->buffer); batch->buffer = 0; out: return rc; }
ClRcT clLogSOStreamEntryRecreate(ClUint32T dsId, ClAddrT pBuffer, ClUint32T size, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClLogSvrCommonEoDataT *pCommonEoData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogStreamOwnerEoEntryGet(NULL, &pCommonEoData); if( CL_OK != rc ) { return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate()")); return rc; } rc = clBufferNBytesWrite(msg, (ClUint8T *) pBuffer, size); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); clBufferDelete(&msg); return rc; } rc = clLogSOStreamEntryUnpackNAdd(pCommonEoData, msg); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); if(CL_GET_ERROR_CODE(rc) == CL_ERR_DUPLICATE) rc = CL_OK; CL_LOG_DEBUG_TRACE(("Exit: rc[0x %x]", rc)); return rc; }
/* * This function was added as additional cleanup is necessary * in the case of Async calls. This was done as a part of the * fix for BUG 4080. The in and out msg handles were not * released at the time of finalize if the async callback * wasn't invoked. */ static void sendHashDestroyCallBack(ClCntKeyHandleT userKey, ClCntDataHandleT userData) { ClRmdRecordSendT *rec = (ClRmdRecordSendT *) userData; if ((userData)&&(rec->flags & CL_RMD_CALL_ASYNC)) { /* * The buffers must be deleted as the callback hasn't been * invoked. This is to avoid any leaks at the time of RMD * Finalize when responses are expected back. (BUG 4080) */ if(rec->recType.asyncRec.sndMsgHdl) clBufferDelete(&(rec->recType.asyncRec.sndMsgHdl)); if(rec->recType.asyncRec.outMsgHdl) clBufferDelete(&(rec->recType.asyncRec.outMsgHdl)); } sendHashDeleteCallBack(userKey,userData); }
ClRcT clRmdReceiveAsyncRequest(ClEoExecutionObjT *pThis, ClBufferHandleT rmdRecvMsg, ClUint8T priority, ClUint8T protoType, ClUint32T length, ClIocPhysicalAddressT srcAddr) { ClRmdPktT msg = {{ {0} }}; ClRcT rc = CL_OK; ClUint32T size = 0; clRmdDumpPkt("Received Async Req", rmdRecvMsg); RMD_DBG4((" RMD receive Request\n")); rc = clBufferReadOffsetSet(rmdRecvMsg, 0, CL_BUFFER_SEEK_SET); rc = clRmdUnmarshallRmdHdr(rmdRecvMsg, &msg.ClRmdHdr, &size); if (rc != CL_OK) /* read result is not ok */ { clBufferDelete(&rmdRecvMsg); RMD_DBG3((" %s: Bad Message\n", __FUNCTION__)); return CL_OK; } CL_RMD_VERSION_VERIFY(msg.ClRmdHdr, rc); if (rc != CL_OK) { clBufferDelete(&rmdRecvMsg); return CL_OK; } rc = rmdHandleAsyncRequest(pThis, &msg, &srcAddr, priority, protoType, rmdRecvMsg); clBufferDelete(&rmdRecvMsg); #if RMD_FILTER_CLEANUP clRMDCheckAndCallCommPortCleanup(pThis); #endif return CL_OK; }
/** * Internal function to unpack saved state of a transaction * from checkpoint */ static ClRcT _clTxnServiceCkptTxnUnpack( CL_IN ClUint32T dataSetId, CL_IN ClAddrT pData, CL_IN ClUint32T dataLen, CL_IN ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT txnStateBuf; ClTxnDefnT *pTxnDefn; CL_FUNC_ENTER(); CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("To unpack data-set 0x%x\n", dataSetId)); rc = clBufferCreate(&txnStateBuf); if (CL_OK == rc) { rc = clBufferNBytesWrite(txnStateBuf, (ClUint8T *)pData, dataLen); if (CL_OK == rc) { rc = clTxnStreamTxnCfgInfoUnpack(txnStateBuf, &pTxnDefn); } if ( (CL_OK == rc) && ((pTxnDefn->serverTxnId.txnId + CL_TXN_CKPT_TXN_DATA_SET_ID_OFFSET) == dataSetId) ) { /* Add this definition into txnDefnDb */ rc = clTxnRecoverySessionUpdate (pTxnDefn); } else { if (CL_OK == rc) rc = CL_ERR_INVALID_PARAMETER; } rc = clBufferDelete(&txnStateBuf); } if (CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to extract transaction definition from data-set[0x%x], rc:0x%x", dataSetId, rc)); rc = CL_GET_ERROR_CODE(rc); } CL_FUNC_EXIT(); return (rc); }
static void clMsgClientsTrackCallbackAsyncCallback_4_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; ClHandleT clientHandle; SaNameT pGroupName; SaMsgQueueGroupNotificationBufferT_4_0_0 pNotification; memset(&(clientHandle), 0, sizeof(ClHandleT)); memset(&(pGroupName), 0, sizeof(SaNameT)); memset(&(pNotification), 0, sizeof(SaMsgQueueGroupNotificationBufferT_4_0_0)); retVal = clXdrUnmarshallClHandleT(inMsgHdl, &(clientHandle)); if (CL_OK != retVal) { goto L0; } retVal = clXdrUnmarshallSaNameT(inMsgHdl, &(pGroupName)); if (CL_OK != retVal) { goto L1; } retVal = clXdrUnmarshallSaMsgQueueGroupNotificationBufferT_4_0_0(inMsgHdl, &(pNotification)); if (CL_OK != retVal) { goto L2; } if (rc != CL_OK) { retVal = rc; } ((MsgCltClMsgClientsTrackCallbackAsyncCallbackT_4_0_0)(pCookie->actualCallback))(pCookie->handle, clientHandle, &(pGroupName), &(pNotification), retVal, pCookie->pCookie); goto L3; L3: L2: L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
static void clMsgQDatabaseUpdateAsyncCallback_4_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; ClMsgSyncActionT_4_0_0 syncupType; ClMsgQueueCkptDataT_4_0_0 queueData; ClUint16T updateCkpt; memset(&(syncupType), 0, sizeof(ClMsgSyncActionT_4_0_0)); memset(&(queueData), 0, sizeof(ClMsgQueueCkptDataT_4_0_0)); memset(&(updateCkpt), 0, sizeof(ClUint16T)); retVal = clXdrUnmarshallClMsgSyncActionT_4_0_0(inMsgHdl, &(syncupType)); if (CL_OK != retVal) { goto L0; } retVal = clXdrUnmarshallClMsgQueueCkptDataT_4_0_0(inMsgHdl, &(queueData)); if (CL_OK != retVal) { goto L1; } retVal = clXdrUnmarshallClUint16T(inMsgHdl, &(updateCkpt)); if (CL_OK != retVal) { goto L2; } if (rc != CL_OK) { retVal = rc; } ((MsgIdlClMsgQDatabaseUpdateAsyncCallbackT_4_0_0)(pCookie->actualCallback))(pCookie->handle, syncupType, &(queueData), updateCkpt, retVal, pCookie->pCookie); goto L3; L3: L2: L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
/** * Internal Function - extracts transaction-service state from checkpoint data-set */ static ClRcT _clTxnServiceCkptAppStateUnpack( CL_IN ClUint32T dataSetId, CL_IN ClAddrT pData, CL_IN ClUint32T dataLen, CL_IN ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT txnStateMsgBuf; ClUint32T txnIdCounter; CL_FUNC_ENTER(); CL_DEBUG_PRINT(CL_DEBUG_TRACE, ("To restore state of transaction-service\n")); rc = clBufferCreate(&txnStateMsgBuf); if (CL_OK == rc) { rc = clBufferNBytesWrite(txnStateMsgBuf, (ClUint8T *) pData, dataLen); if (CL_OK == rc) { rc = clXdrUnmarshallClUint32T(txnStateMsgBuf, &txnIdCounter); } if (CL_OK == rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Updating txnId Counter to 0x%x", txnIdCounter)); clTxnServiceCfg->txnIdCounter = txnIdCounter; } if (CL_OK != rc) { CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Failed to restore transaction service state. Could result in inconsistent operation. rc:0x%x", rc)); rc = CL_GET_ERROR_CODE(rc); } rc = clBufferDelete(&txnStateMsgBuf); } CL_FUNC_EXIT(); return (rc); }
static void recvHashDeleteCallBack(ClCntKeyHandleT userKey, ClCntDataHandleT userData) { ClRmdRecordRecvT *recvRecord = (ClRmdRecordRecvT *) userData; CL_FUNC_ENTER(); if (userData) { if (recvRecord->msg) { clBufferDelete(&(recvRecord->msg)); } clHeapFree((void *) userData); } CL_FUNC_EXIT(); }
static void _ckptSectionCheckAsyncCallback_5_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; ClHandleT ckptHandle; ClCkptSectionIdT_4_0_0 pSecId; memset(&(ckptHandle), 0, sizeof(ClHandleT)); memset(&(pSecId), 0, sizeof(ClCkptSectionIdT_4_0_0)); retVal = clXdrUnmarshallClHandleT(inMsgHdl, &(ckptHandle)); if (CL_OK != retVal) { goto L0; } retVal = clXdrUnmarshallClCkptSectionIdT_4_0_0(inMsgHdl, &(pSecId)); if (CL_OK != retVal) { goto L1; } if (rc != CL_OK) { retVal = rc; } ((CkptEo_ckptSectionCheckAsyncCallbackT_5_0_0)(pCookie->actualCallback))(pCookie->handle, ckptHandle, &(pSecId), retVal, pCookie->pCookie); goto L2; L2: L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
static void clCkptLeaderAddrUpdateAsyncCallback_4_0_0(ClRcT rc, void *pIdlCookie, ClBufferHandleT inMsgHdl, ClBufferHandleT outMsgHdl) { ClIdlCookieT* pCookie = (ClIdlCookieT*)pIdlCookie; ClRcT retVal = CL_OK; ClUint32T masterAddr; ClUint32T deputyAddr; memset(&(masterAddr), 0, sizeof(ClUint32T)); memset(&(deputyAddr), 0, sizeof(ClUint32T)); retVal = clXdrUnmarshallClUint32T(inMsgHdl, &(masterAddr)); if (CL_OK != retVal) { goto L0; } retVal = clXdrUnmarshallClUint32T(inMsgHdl, &(deputyAddr)); if (CL_OK != retVal) { goto L1; } if (rc != CL_OK) { retVal = rc; } ((CkptEoClCkptLeaderAddrUpdateAsyncCallbackT_4_0_0)(pCookie->actualCallback))(pCookie->handle, masterAddr, deputyAddr, retVal, pCookie->pCookie); goto L2; L2: L1: L0: clHeapFree(pCookie); clBufferDelete(&outMsgHdl); return; }
ClRcT clAmsMgmtCCBBatchInitialize(ClAmsMgmtHandleT mgmtHandle, ClAmsMgmtCCBBatchHandleT *batchHandle) { ClAmsMgmtCCBBatchT *batch = NULL; ClRcT rc = CL_OK; batch = clHeapCalloc(1, sizeof(*batch)); CL_ASSERT(batch != NULL); rc = amsMgmtCCBBatchBufferInitialize(batch); if(rc != CL_OK) goto out_free; *batchHandle = (ClAmsMgmtCCBBatchHandleT)batch; goto out; out_free: if(batch->buffer) clBufferDelete(&batch->buffer); clHeapFree(batch); out: return rc; }
ClRcT clDebugPrintFinalize(ClDebugPrintHandleT* handle, char** buf) { ClUint32T len = 0; ClRcT rc = CL_OK; ClBufferHandleT* msg = (ClBufferHandleT*)handle; if (NULL == buf) { return CL_DEBUG_RC(CL_ERR_NULL_POINTER); } rc = clBufferLengthGet(*msg, &len); if (CL_OK != rc) { return rc; } *buf = (char*)clHeapAllocate(len + 1); if (CL_OK != rc) { return CL_DEBUG_RC(CL_ERR_NO_MEMORY); } rc = clBufferNBytesRead(*msg, (ClUint8T*)*buf, &len); if (CL_OK != rc) { clHeapFree(*buf); *buf = NULL; return rc; } (*buf)[len] = '\0'; clBufferDelete(msg); *msg = 0; return rc; }