static ClRcT clLogMasterFileEntrySecIdGet(ClLogFileKeyT *pFileKey, ClCkptSectionIdT *pSecId) { ClRcT rc = CL_OK; CL_LOG_DEBUG_TRACE(("Enter: namelen: %u locationlen: %u", pFileKey->fileName.length, pFileKey->fileLocation.length)); CL_LOG_PARAM_CHK((NULL == pFileKey->fileName.pValue), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pFileKey->fileLocation.pValue), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pSecId), CL_LOG_RC(CL_ERR_NULL_POINTER)); /* * ClString: Assuming length includes NULL terminator also. * So we idLen will include 2 more than the characters. * One we will use for / so we need to decrement it by 1 */ pSecId->idLen = pFileKey->fileName.length + pFileKey->fileLocation.length + 1; pSecId->id = (ClUint8T*) clHeapCalloc(pSecId->idLen, sizeof(ClCharT)); if( NULL == pSecId->id ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } snprintf((ClCharT *) pSecId->id, pSecId->idLen, "%s/%s", pFileKey->fileLocation.pValue, pFileKey->fileName.pValue); CL_LOG_DEBUG_TRACE(("Exit [%*s]", pSecId->idLen, pSecId->id)); return rc; }
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 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; }
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; }
ClRcT clLogClntIdlHandleFinalize(ClIdlHandleT *phClntIdl) { ClRcT rc = CL_OK; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == phClntIdl), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clIdlHandleFinalize(*phClntIdl); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clIdlHandleInitialize(): rc[0x %x]", rc)); return rc; } CL_LOG_DEBUG_TRACE(("Enter")); return rc; }
/* - clLogClntCompInfoGet * - Gets the component name and id */ ClRcT clLogClntCompInfoGet(ClLogCompInfoT *pCompInfo) { ClRcT rc = CL_OK; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pCompInfo), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clCpmComponentNameGet(0, &pCompInfo->compName); if( CL_OK != rc) { CL_LOG_DEBUG_ERROR(("clCpmComponentNameGet(): rc[0x %x]", rc)); return rc; } clEoMyEoIocPortGet(&pCompInfo->compId); CL_LOG_DEBUG_TRACE(("Exit: %.*s %u", pCompInfo->compName.length, pCompInfo->compName.value, pCompInfo->compId)); return rc; }
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 clLogFileRecordsGet(ClLogFileHandleT hFileHdlr, ClTimeT *pStartTime, ClTimeT *pEndTime, ClUint32T *pNumRecords, ClPtrT *pLogRecords) { ClRcT rc = CL_OK; ClIocAddressT address = {{0}}; ClIdlHandleT hLogIdl = CL_HANDLE_INVALID_VALUE; ClLogClntFileKeyT *pFileKey = NULL; ClBoolT isDelete = CL_FALSE; ClUint32T version = 0; ClUint64T startRec = 0; ClUint32T buffLen = 0; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pNumRecords), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pLogRecords), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogFileHdlrHandleInfoGet(hFileHdlr, &isDelete, &version, &startRec, &pFileKey); if( CL_OK != rc ) { return rc; } rc = clLogFileHdlrAddressGet(&pFileKey->fileLocation, &address); if( CL_OK != rc ) { return rc; } rc = clLogClntIdlHandleInitialize(address, &hLogIdl); if( CL_OK != rc ) { return rc; } CL_LOG_DEBUG_ERROR(("fileName: %s fileLoc: %s", pFileKey->fileName.pValue, pFileKey->fileLocation.pValue)); CL_LOG_DEBUG_ERROR(("Version: %d isDelete: %d startRec: %llu", version, isDelete, startRec)); rc = VDECL_VER(clLogFileHdlrFileRecordsGetClientSync, 4, 0, 0)(hLogIdl, &pFileKey->fileName, &pFileKey->fileLocation, isDelete, &startRec, &version, pNumRecords, &buffLen, (ClUint8T **) pLogRecords); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrFileHdlrFileMetaDataGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("NumRecords: %d", *pNumRecords)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); if( (CL_FALSE == isDelete)) { rc = clLogClntFileHdlrHandleUpdate(hFileHdlr, version, startRec); if( CL_OK != rc ) { return rc; } updateVersion = CL_TRUE; } rc = clLogClntFileHdlrTimeStampGet(*pNumRecords, buffLen, *pLogRecords, pStartTime, pEndTime); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogClntFileHdlrTimeStampGet(): rc[0x %x]", rc)); } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogFileMetaDataGet(ClLogFileHandleT hFileHdlr, ClLogStreamAttributesT *pStreamAttr, ClUint32T *pNumStreams, ClLogStreamMapT **ppLogStreams) { ClRcT rc = CL_OK; ClIocAddressT address = {{0}}; ClIdlHandleT hLogIdl = CL_HANDLE_INVALID_VALUE; ClLogClntFileKeyT *pFileKey = NULL; ClLogStreamAttrIDLT streamAttrIdl = {{0}}; ClBoolT isDelete = CL_FALSE; ClUint32T version = 0; ClUint64T startRec = 0; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pStreamAttr), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pNumStreams), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == ppLogStreams), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogFileHdlrHandleInfoGet(hFileHdlr, &isDelete, &version, &startRec, &pFileKey); if( CL_OK != rc ) { return rc; } rc = clLogFileHdlrAddressGet(&pFileKey->fileLocation, &address); if( CL_OK != rc ) { return rc; } CL_LOG_DEBUG_ERROR(("FileOwner's Address: %d", address.iocPhyAddress.nodeAddress)); rc = clLogClntIdlHandleInitialize(address, &hLogIdl); if( CL_OK != rc ) { return rc; } CL_LOG_DEBUG_ERROR(("fileName: %s fileLoc: %s", pFileKey->fileName.pValue, pFileKey->fileLocation.pValue)); rc = VDECL_VER(clLogFileHdlrFileMetaDataGetClientSync, 4, 0, 0)(hLogIdl, &pFileKey->fileName, &pFileKey->fileLocation, &version, &streamAttrIdl, pNumStreams, ppLogStreams); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrFileHdlrFileMetaDataGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); return rc; } CL_LOG_DEBUG_ERROR(("NumStreams: %d", *pNumStreams)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); { rc = clLogClntFileHdlrHandleUpdate(hFileHdlr, version, 0); if( CL_OK != rc ) { clHeapFree(streamAttrIdl.fileLocation.pValue); clHeapFree(streamAttrIdl.fileName.pValue); clHeapFree(ppLogStreams); return rc; } updateVersion = CL_TRUE; } rc = clLogFileHdlrStreamAttributesCopy(&streamAttrIdl, pStreamAttr); if( CL_OK != rc ) { clHeapFree(streamAttrIdl.fileLocation.pValue); clHeapFree(streamAttrIdl.fileName.pValue); clHeapFree(ppLogStreams); return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogFileOpen(ClLogHandleT hLog, ClCharT *fileName, ClCharT *fileLocation, ClBoolT isDelete, ClLogFileHandleT *phFile) { ClRcT rc = CL_OK; ClLogClntFileKeyT *pFileKey = NULL; ClUint32T operatingLvl = 0; ClIocAddressT address = {{0}}; ClIdlHandleT hLogIdl = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == fileName), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == fileLocation), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == phFile), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogHandleCheck(hLog, CL_LOG_INIT_HANDLE); if( CL_OK != rc ) { return rc; } rc = clLogClntFileKeyCreate(fileName, fileLocation, &pFileKey); if( CL_OK != rc ) { return rc; } rc = clLogFileHdlrAddressGet(&pFileKey->fileLocation, &address); if( CL_OK != rc ) { clLogClntFileKeyDestroy(pFileKey); return rc; } CL_LOG_DEBUG_ERROR(("FileOwner's Address: %d", address.iocPhyAddress.nodeAddress)); rc = clLogClntIdlHandleInitialize(address, &hLogIdl); if( CL_OK != rc ) { clLogClntFileKeyDestroy(pFileKey); return rc; } rc = VDECL_VER(clLogFileHdlrFileOpenClientSync, 4, 0, 0)(hLogIdl, &pFileKey->fileName, &pFileKey->fileLocation, &operatingLvl); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("VDECL_VER(clLogFileHdlrFileOpen, 4, 0, 0)(): rc[0x %x]", rc)); clLogClntFileKeyDestroy(pFileKey); return rc; } rc = clLogFileHdlrHandleCreate(hLog, isDelete, operatingLvl, pFileKey, phFile); if( CL_OK != rc ) { clLogClntFileKeyDestroy(pFileKey); return rc; } rc = clLogHandleInitHandleStreamAdd(hLog, *phFile); if( CL_OK != rc ) { CL_LOG_CLEANUP(clLogFileHdlrFileHandleDelete(*phFile, &hLog), CL_OK); return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogStreamListGet(ClLogHandleT hLog, ClUint32T *pNumStreams, ClLogStreamInfoT **ppLogStreams) { ClRcT rc = CL_OK; ClIocAddressT address = {{0}}; ClIdlHandleT hLogIdl = CL_HANDLE_INVALID_VALUE; ClUint8T *pBuffer = NULL; ClUint32T buffLen = 0; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == pNumStreams), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == ppLogStreams), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogHandleCheck(hLog, CL_LOG_INIT_HANDLE); if( CL_OK != rc ) { return rc; } rc = clLogMasterAddressGet(&address); if( CL_OK != rc ) { return rc; } rc = clLogClntIdlHandleInitialize(address, &hLogIdl); if( CL_OK != rc ) { return rc; } rc = VDECL_VER(clLogMasterStreamListGetClientSync, 4, 0, 0)(hLogIdl, pNumStreams, &buffLen, &pBuffer); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("VDECL_VER(clLogMasterStreamListGet, 4, 0, 0)(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); return rc; } CL_LOG_DEBUG_VERBOSE(("NumRecords: %d", *pNumStreams)); CL_LOG_CLEANUP(clIdlHandleFinalize(hLogIdl), CL_OK); if(!*pNumStreams) { if(pBuffer) clHeapFree(pBuffer); if(ppLogStreams) *ppLogStreams = NULL; return CL_OK; } rc = clLogClntStreamListUnpack(*pNumStreams, buffLen, pBuffer, ppLogStreams); if( CL_OK != rc ) { clHeapFree(pBuffer); return rc; } clHeapFree(pBuffer); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
static ClRcT clLogSvrStreamEntryPack(ClUint32T dsId, ClAddrT *ppBuffer, ClUint32T *pBuffSize, ClPtrT cookie) { ClRcT rc = CL_OK; ClBufferHandleT msg = CL_HANDLE_INVALID_VALUE; ClCntNodeHandleT svrStreamNode = cookie; ClLogSvrEoDataT *pSvrEoEntry = NULL; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == ppBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pBuffSize), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrEoEntryGet(): rc[0x %x]\n", rc)); return rc; } rc = clBufferCreate(&msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clLogSvrStreamInfoPack(pSvrEoEntry, svrStreamNode, msg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrStreamInfoPack(): rc[0x %x]", rc)); clBufferDelete(&msg); return rc; } rc = clBufferLengthGet(msg, pBuffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferLengthGet(): rc[0x %x]", rc)); clBufferDelete(&msg); return rc; } *ppBuffer = (ClAddrT) clHeapCalloc(*pBuffSize, sizeof(ClUint8T)); if( NULL == *ppBuffer ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc(): rc[0x %x]", rc)); clBufferDelete(&msg); return rc; } rc = clBufferNBytesRead(msg, (ClUint8T *)*ppBuffer, pBuffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); clHeapFree(*ppBuffer); clBufferDelete(&msg); return rc; } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
static ClRcT clLogSvrDsIdMapPack(ClUint32T dsId, ClAddrT *ppBuffer, ClUint32T *pBuffSize, ClPtrT cookie) { ClRcT rc = CL_OK; ClLogSvrEoDataT *pSvrEoEntry = (ClLogSvrEoDataT *) cookie; ClBufferHandleT inMsg = CL_HANDLE_INVALID_VALUE; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK((NULL == ppBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((NULL == pSvrEoEntry), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK((CL_LOG_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); rc = clBufferCreate(&inMsg); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); return rc; } rc = clXdrMarshallClUint32T(&pSvrEoEntry->nextDsId, inMsg, 0); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferCreate(): rc[0x %x]", rc)); clBufferDelete(&inMsg); return rc; } rc = clLogBitmapPack(pSvrEoEntry->hDsIdMap, inMsg); if( CL_OK != rc ) { clBufferDelete(&inMsg); return rc; } rc = clBufferLengthGet(inMsg, pBuffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferLengthGet(): rc[0x %x]", rc)); clBufferDelete(&inMsg); return rc; } *ppBuffer = (ClAddrT) clHeapCalloc(*pBuffSize, sizeof(ClUint8T)); if( NULL == *ppBuffer ) { clBufferDelete(&inMsg); CL_LOG_DEBUG_ERROR(("clHeapCalloc(): rc[0x %x]", rc)); return rc; } rc = clBufferNBytesRead(inMsg,(ClUint8T *) *ppBuffer, pBuffSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesWrite(): rc[0x %x]", rc)); clHeapFree(*ppBuffer); clBufferDelete(&inMsg); return rc; } CL_LOG_CLEANUP(clBufferDelete(&inMsg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogSODsIdMapPack(ClUint32T dsId, ClAddrT *pBuffer, ClUint32T *pSize, ClPtrT cookie) { ClRcT rc = CL_OK; ClLogSOEoDataT *pSoEoEntry = NULL; ClBufferHandleT msg = 0; CL_LOG_DEBUG_TRACE(("Enter")); CL_LOG_PARAM_CHK( (CL_LOG_DSID_START != dsId), CL_LOG_RC(CL_ERR_INVALID_PARAMETER)); CL_LOG_PARAM_CHK( (NULL == pBuffer), CL_LOG_RC(CL_ERR_NULL_POINTER)); CL_LOG_PARAM_CHK( (NULL == pSize), CL_LOG_RC(CL_ERR_NULL_POINTER)); rc = clLogStreamOwnerEoEntryGet(&pSoEoEntry, NULL); 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 = clXdrMarshallClUint32T(&pSoEoEntry->dsIdCnt, msg, 0); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrMarshallClUint32T(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clLogBitmapPack(pSoEoEntry->hDsIdMap, msg); if( CL_OK != rc ) { CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clBufferLengthGet(msg, pSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferLengthGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } *pBuffer = (ClAddrT)clHeapCalloc(*pSize, sizeof(ClInt8T)); if( NULL == *pBuffer ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } rc = clBufferNBytesRead(msg, (ClUint8T *) *pBuffer, pSize); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBufferNBytesRead(): rc[0x %x]", rc)); clHeapFree(*pBuffer); CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); return rc; } CL_LOG_CLEANUP(clBufferDelete(&msg), CL_OK); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }