ClRcT clLogCompEntryUnpackNAdd(ClBufferHandleT msg, ClLogStreamOwnerDataT *pStreamOwnerData) { ClRcT rc = CL_OK; ClLogCompKeyT compKey = {0}; ClLogCompKeyT *pCompKey = NULL; ClLogSOCompDataT compData = {0}; ClLogSOCompDataT *pData = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = VDECL_VER(clXdrUnmarshallClLogCompKeyT, 4, 0, 0)(msg, &compKey); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("VDECL_VER(clXdrUnmarshallClLogCompKeyT, 4, 0, 0)(): rc[0x %x]", rc)); return rc; } rc = VDECL_VER(clXdrUnmarshallClLogSOCompDataT, 4, 0, 0)(msg, &compData); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("VDECL_VER(clXdrUnmarshallClLogSOCompDataT, 4, 0, 0)(): rc[0x %x]", rc)); return rc; } pCompKey = (ClLogCompKeyT*)clHeapCalloc(1, sizeof(ClLogCompKeyT)); if( NULL == pCompKey ) { CL_LOG_DEBUG_ERROR(( "clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } *pCompKey = compKey; CL_LOG_DEBUG_VERBOSE(("compKey.nodeAddress: %u", compKey.nodeAddr)); CL_LOG_DEBUG_VERBOSE(("compKey.compId : %u", compKey.compId)); pData = (ClLogSOCompDataT*)clHeapCalloc(1, sizeof(ClLogSOCompDataT)); if( NULL == pData ) { CL_LOG_DEBUG_ERROR(( "clHeapCalloc()")); clHeapFree(pCompKey); return CL_LOG_RC(CL_ERR_NO_MEMORY); } *pData = compData; CL_LOG_DEBUG_VERBOSE(("compData.refCount : %u", pData->refCount)); CL_LOG_DEBUG_VERBOSE(("compData.ackerCnt : %u", pData->ackerCnt)); CL_LOG_DEBUG_VERBOSE(("compData.nonAckerCnt : %u", pData->nonAckerCnt)); rc = clCntNodeAdd(pStreamOwnerData->hCompTable, (ClCntKeyHandleT) pCompKey, (ClCntDataHandleT) pData, NULL); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(( "clCntNodeAdd(): rc[0x %x]", rc)); clHeapFree(pData); clHeapFree(pCompKey); } CL_LOG_DEBUG_TRACE(("Exit")); return CL_OK; }
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; }
ClRcT clLogClntFileKeyCreate(ClCharT *fileName, ClCharT *fileLocation, ClLogClntFileKeyT **pFileKey) { ClRcT rc = CL_OK; CL_LOG_DEBUG_TRACE(("Enter")); *pFileKey = clHeapCalloc(1, sizeof(ClLogClntFileKeyT)); if( NULL == *pFileKey ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } (*pFileKey)->fileName.length = strlen(fileName) + 1; (*pFileKey)->fileName.pValue = clHeapCalloc((*pFileKey)->fileName.length, sizeof(ClCharT)); if( NULL == (*pFileKey)->fileName.pValue ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); clHeapFree(*pFileKey); return CL_LOG_RC(CL_ERR_NO_MEMORY); } (*pFileKey)->fileLocation.length = strlen(fileLocation) + 1; (*pFileKey)->fileLocation.pValue = clHeapCalloc((*pFileKey)->fileLocation.length, sizeof(ClCharT)); if( NULL == (*pFileKey)->fileLocation.pValue ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); clHeapFree((*pFileKey)->fileName.pValue); clHeapFree(*pFileKey); return CL_LOG_RC(CL_ERR_NO_MEMORY); } strncpy((*pFileKey)->fileName.pValue, fileName, (*pFileKey)->fileName.length); strncpy((*pFileKey)->fileLocation.pValue, fileLocation, (*pFileKey)->fileLocation.length); CL_LOG_DEBUG_TRACE(("Exit")); 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 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 clLogFileHdlrStreamAttributesCopy(ClLogStreamAttrIDLT *pSource, ClLogStreamAttributesT *pDest) { ClRcT rc = CL_OK; CL_LOG_DEBUG_TRACE(("Enter")); pDest->fileUnitSize = pSource->fileUnitSize; pDest->recordSize = pSource->recordSize; pDest->haProperty = pSource->haProperty; pDest->fileFullAction = pSource->fileFullAction; pDest->maxFilesRotated = pSource->maxFilesRotated; pDest->flushFreq = pSource->flushFreq; pDest->flushInterval = pSource->flushInterval; pDest->waterMark = pSource->waterMark; pDest->fileName = clHeapCalloc(pSource->fileName.length, sizeof(ClCharT)); if( NULL == pDest->fileName ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } pDest->fileLocation = clHeapCalloc(pSource->fileLocation.length, sizeof(ClCharT)); if( NULL == pDest->fileLocation ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); clHeapFree(pDest->fileName); return CL_LOG_RC(CL_ERR_NO_MEMORY); } memcpy(pDest->fileName, pSource->fileName.pValue, pSource->fileName.length); memcpy(pDest->fileLocation, pSource->fileLocation.pValue, pSource->fileLocation.length); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogClntStreamListEntryGet(ClBufferHandleT msg, ClLogStreamAttrIDLT *pStreamAttr, ClLogStreamInfoT *pLogStream) { ClRcT rc = CL_OK; ClUint32T acitveStream = 0; CL_LOG_DEBUG_TRACE(("Enter")); rc = clXdrUnmarshallClUint32T(msg, &acitveStream); if( CL_OK != rc ) { return rc; } if( 0 == acitveStream ) { return CL_LOG_RC(CL_ERR_INVALID_PARAMETER); } rc = clXdrUnmarshallClNameT(msg, &pLogStream->streamName); if( CL_OK != rc ) { return rc; } rc = clXdrUnmarshallClNameT(msg, &pLogStream->streamScopeNode); if( CL_OK != rc ) { return rc; } rc = clXdrUnmarshallClUint32T(msg, &pLogStream->streamScope); if( CL_OK != rc ) { return rc; } rc = clXdrUnmarshallClUint32T(msg, &pLogStream->streamId); if( CL_OK != rc ) { return rc; } rc = clLogFileHdlrStreamAttributesCopy(pStreamAttr, &pLogStream->streamAttr); if( CL_OK != rc ) { return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogSvrCkptDataSetDelete(ClUint32T dsId) { ClRcT rc = CL_OK; ClLogSvrCommonEoDataT *pSvrCommonEoEntry = NULL; ClLogSvrEoDataT *pSvrEoEntry = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogSvrEoEntryGet(&pSvrEoEntry, &pSvrCommonEoEntry); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clLogSvrEoEntryGet(): rc[0x %x]", rc)); return rc; } if( CL_LOG_DSID_START >= dsId ) { CL_LOG_DEBUG_ERROR(("Invalid DataSet ID\n ")); return CL_LOG_RC(CL_ERR_INVALID_STATE);/*FIXME*/ } rc = clBitmapBitClear(pSvrEoEntry->hDsIdMap, dsId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCkptLibraryCkptDataSetDelete(): rc[0x %x]", rc)); return rc; } rc = clCkptLibraryCkptDataSetDelete(pSvrCommonEoEntry->hLibCkpt, (SaNameT *) &gSvrLocalCkptName, dsId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCkptLibraryCkptDataSetDelete(): rc[0x %x]", rc)); return rc; } rc = clCkptLibraryCkptDataSetWrite(pSvrCommonEoEntry->hLibCkpt, (SaNameT *) &gSvrLocalCkptName, CL_LOG_DSID_START, pSvrEoEntry); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCkptLibraryCkptDataSetWrite(): rc[0x %x]", rc)); } CL_LOG_DEBUG_TRACE(("Exit")); 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 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 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; }
ClRcT clLogBitmapUnpack(ClBufferHandleT msg, ClBitmapHandleT hBitmap) { ClRcT rc = CL_OK; ClUint32T nBytes = 0; ClUint8T *pBitMap = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clXdrUnmarshallClUint32T(msg, &nBytes); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrUnmarshallClUint32T(): rc[0x %x]", rc)); return rc; } CL_LOG_DEBUG_VERBOSE(("nBytes : %u", nBytes)); pBitMap = (ClUint8T*)clHeapCalloc(nBytes, sizeof(ClCharT)); if( NULL == pBitMap ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } rc = clXdrUnmarshallArrayClUint8T(msg, pBitMap, nBytes); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrMarshallArrayClUint8T(): rc[0x %x]", rc)); clHeapFree(pBitMap); return rc; } rc = clBitmapBufferBitsCopy(nBytes, pBitMap, hBitmap); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBitmapPositionList2BitmapGet(): rc[0x %x]", rc)); } clHeapFree(pBitMap); CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogFileHdlrFileLocationVerify(ClCharT *fileLocation) { ClRcT rc = CL_OK; ClIocAddressT address = {{0}}; ClStatusT status = 0; ClIocLogicalAddressT logLogicalAddr = 0; ClCharT nodeStr[CL_MAX_NAME_LENGTH] = {0}; ClBoolT isLogical = CL_FALSE; CL_LOG_DEBUG_TRACE(("Enter")); sscanf(fileLocation, "%[^:]", nodeStr); rc = clLogAddressForLocationGet(nodeStr, &address, &isLogical); if( CL_OK != rc ) { return rc; } if( CL_TRUE == isLogical ) { logLogicalAddr = CL_IOC_LOG_LOGICAL_ADDRESS; if( logLogicalAddr == address.iocLogicalAddress ) { return CL_OK; } } else { rc = clCpmNodeStatusGet( address.iocPhyAddress.nodeAddress, &status); if( status == CL_STATUS_UP ) { return CL_OK; } } CL_LOG_DEBUG_ERROR(("fileLocation doesn't have proper address")); CL_LOG_DEBUG_TRACE(("Exit")); return CL_LOG_RC(CL_ERR_INVALID_PARAMETER); }
/* - 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 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; } }
/* * Called with the log server flusher stream lock. held. */ static ClRcT clLogFlusherRecordsMcast(ClLogSvrStreamDataT *pStreamData, ClUint32T nRecords) { ClRcT rc = CL_OK; ClLogStreamHeaderT *pHeader = pStreamData->pStreamHeader; ClUint8T *pRecords = pStreamData->pStreamRecords; ClUint32T startIdx = 0; ClUint32T buffLen = 0; ClHandleT hFlusher = CL_HANDLE_INVALID_VALUE; ClTimerHandleT hTimer = CL_HANDLE_INVALID_VALUE; ClIdlHandleT hIdlHdl = CL_HANDLE_INVALID_VALUE; ClIocNodeAddressT localAddr = 0; ClUint8T *pBuffer = NULL; ClUint32T size = 0; ClUint32T firstBatch = 0; ClUint32T secondPatch = 0; ClBoolT doMulticast = ( (0 < (pStreamData->ackersCount + pStreamData->nonAckersCount)) && (pHeader->streamMcastAddr.iocMulticastAddress != 0) )? CL_TRUE: CL_FALSE; clLogDebug("SVR", "FLU", "Enter: nRecords: %u seqNum: %u fileOwnerAddr:[%d]", nRecords, pStreamData->seqNum, pStreamData->fileOwnerAddr); if( (pStreamData->ackersCount + pStreamData->nonAckersCount) == 1 && (pStreamData->fileOwnerAddr == clIocLocalAddressGet()) ) { doMulticast = CL_FALSE; } /* * If some fileowner has registered for this stream, if then multicast, * otherwise just send it to local guy */ if( CL_TRUE == doMulticast ) { rc = clLogIdlHandleInitialize(pHeader->streamMcastAddr, &hIdlHdl); if( CL_OK != rc ) { return rc; } if( pStreamData->ackersCount > 0 ) { rc = clLogFlusherCookieHandleCreate(nRecords, &hTimer, &hFlusher); if( CL_OK != rc ) { CL_LOG_CLEANUP(clIdlHandleFinalize(hIdlHdl), CL_OK); return rc; } CL_LOG_DEBUG_TRACE(("hFlusher: %#llX", hFlusher)); } } localAddr = clIocLocalAddressGet(); startIdx = pHeader->startAck % pHeader->maxRecordCount; if(nRecords > pHeader->maxRecordCount) nRecords = pHeader->maxRecordCount; buffLen = nRecords * pHeader->recordSize; /* * Drop the server stream mutex unlock now and grab it again after file owner writes * and before exiting out of the function */ clLogDebug(CL_LOG_AREA_SVR, "FLU", "startIdx: %u maxRec: %u nRecords: %u startIdx: %d recordIdx: %d", startIdx, pHeader->maxRecordCount, nRecords, pHeader->startAck, pHeader->recordIdx); if( (startIdx + nRecords) <= pHeader->maxRecordCount ) { pBuffer = pRecords + (startIdx * pHeader->recordSize); if( pStreamData->fileOwnerAddr == localAddr ) { /* File onwer function which flushes the data into file */ rc = clLogFileOwnerEntryFindNPersist(&pStreamData->fileName, &pStreamData->fileLocation, nRecords, pBuffer); if( CL_OK != rc ) { return rc; } } if( doMulticast == CL_TRUE ) { rc = VDECL_VER(clLogClntFileHdlrDataReceiveClientAsync, 4, 0, 0)(hIdlHdl, pHeader->streamMcastAddr.iocMulticastAddress, pStreamData->seqNum, localAddr, hFlusher, nRecords, buffLen, pBuffer, NULL, 0); CL_LOG_CLEANUP(clIdlHandleFinalize(hIdlHdl), CL_OK); } CL_LOG_DEBUG_VERBOSE(("Copied from: %p to %u", pRecords + startIdx, nRecords * pHeader->recordSize)); } else { CL_LOG_DEBUG_TRACE(("startIdx: %u maxRec: %u nRecords: %u", startIdx, pHeader->maxRecordCount, nRecords)); firstBatch = pHeader->maxRecordCount - startIdx; pBuffer = pRecords + (startIdx * pHeader->recordSize); secondPatch = nRecords - firstBatch; if( pStreamData->fileOwnerAddr == localAddr ) { /* * Make two calls to fileowner function, so that no need to * allocate memory, it just direct copy from shared memory */ rc = clLogFileOwnerEntryFindNPersist(&pStreamData->fileName, &pStreamData->fileLocation, firstBatch, pBuffer); if( CL_OK != rc ) { return rc; } rc = clLogFileOwnerEntryFindNPersist(&pStreamData->fileName, &pStreamData->fileLocation, secondPatch, pRecords); if( CL_OK != rc ) { return rc; } } if( doMulticast == CL_TRUE ) { pBuffer = clHeapCalloc(buffLen, sizeof(ClUint8T)); if( NULL == pBuffer ) { clLogError("LOG", "FLS", "clHeapCalloc() : rc[0x %x]", rc); CL_LOG_CLEANUP(clLogFlusherCookieHandleDestroy(hFlusher, CL_FALSE), CL_OK); CL_LOG_CLEANUP(clIdlHandleFinalize(hIdlHdl), CL_OK); return CL_LOG_RC(CL_ERR_NO_MEMORY); } size = firstBatch * pHeader->recordSize; memcpy(pBuffer, pRecords + (startIdx * pHeader->recordSize), size); memcpy(pBuffer + size, pRecords, buffLen - size); rc = VDECL_VER(clLogClntFileHdlrDataReceiveClientAsync, 4, 0, 0)(hIdlHdl, pHeader->streamMcastAddr.iocMulticastAddress, pStreamData->seqNum, localAddr, hFlusher, nRecords, buffLen, pBuffer, NULL, 0); clHeapFree(pBuffer); CL_LOG_CLEANUP(clIdlHandleFinalize(hIdlHdl), CL_OK); } } if( (doMulticast == CL_TRUE) && (CL_OK != rc) ) { clLogError("LOG", "FLS", "VDECL_VER(clLogClntFileHdlrDataReceiveClientAsync, 4, 0, 0)(): " "rc[0x %x]", rc); CL_LOG_CLEANUP(clLogFlusherCookieHandleDestroy(hFlusher, CL_FALSE), CL_OK); return rc; } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogClntStreamEntryAdd(ClCntHandleT hClntTable, ClLogStreamKeyT *pStreamKey, ClStringT *pShmName, ClUint32T shmSize, ClCntNodeHandleT *phStreamNode) { ClRcT rc = CL_OK; ClLogClntStreamDataT *pStreamData = NULL; #ifndef NO_SAF ClInt32T fd = 0; ClUint32T headerSize = 0; ClInt32T tries = 0; struct stat statbuf; #endif CL_LOG_DEBUG_TRACE(("Enter")); pStreamData = (ClLogClntStreamDataT*) clHeapCalloc(1, sizeof(ClLogClntStreamDataT)); if( pStreamData == NULL ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NO_MEMORY); } pStreamData->shmName.pValue = (ClCharT*) clHeapCalloc(pShmName->length, sizeof(ClCharT)); if( NULL == pStreamData->shmName.pValue ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); clHeapFree(pStreamData); return CL_LOG_RC(CL_ERR_NO_MEMORY); } memcpy(pStreamData->shmName.pValue, pShmName->pValue, pShmName->length); CL_LOG_DEBUG_VERBOSE(("Opening Shared Memory Segment: %s", pStreamData->shmName.pValue)); #ifndef NO_SAF rc = clOsalShmOpen_L(pStreamData->shmName.pValue, CL_LOG_SHM_OPEN_FLAGS, CL_LOG_SHM_MODE, &fd); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalShmOpen(): rc[0x %x]", rc)); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; return rc; } /* * Check to be safe w.r.t SIGBUS in case a parallel ftruncate from log server is in progress */ memset(&statbuf, 0, sizeof(statbuf)); while(tries++ < 3 && !fstat(fd, &statbuf)) { if((ClUint32T) statbuf.st_size < shmSize) { sleep(1); } else break; } if(!statbuf.st_size) { CL_LOG_DEBUG_ERROR(("fstat on shared segment with size 0")); CL_LOG_CLEANUP(clOsalShmClose_L(fd), CL_OK); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; return CL_LOG_RC(CL_ERR_LIBRARY); } rc = clOsalMmap_L(NULL, shmSize, CL_LOG_MMAP_PROT_FLAGS, CL_LOG_MMAP_FLAGS, fd, 0, (void **) &pStreamData->pStreamHeader); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalMmap(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clOsalShmClose_L(fd), CL_OK); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; return rc; } CL_LOG_CLEANUP(clOsalShmClose_L(fd), CL_OK); CL_LOG_DEBUG_VERBOSE(("Mmapped Shared Memory Segment")); pStreamData->pStreamHeader->shmSize = shmSize; headerSize = CL_LOG_HEADER_SIZE_GET(pStreamData->pStreamHeader->maxMsgs, pStreamData->pStreamHeader->maxComps); pStreamData->pStreamRecords = ((ClUint8T *) (pStreamData->pStreamHeader)) + headerSize; CL_LOG_DEBUG_VERBOSE(("pStreamHeader : %p", (void *) pStreamData->pStreamHeader)); CL_LOG_DEBUG_VERBOSE(("msgMap: %p", (void *) (pStreamData->pStreamHeader + 1))); CL_LOG_DEBUG_VERBOSE(("pStreamRecords: %p", pStreamData->pStreamRecords)); #endif rc = clBitmapCreate(&(pStreamData->hStreamBitmap), 0); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clBitmapCreate(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clOsalMunmap_L(pStreamData->pStreamHeader, shmSize), CL_OK); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; return rc; } /* * Create the shared lock for the sem. */ rc = clLogClientStreamSharedMutexInit(pStreamData, pShmName); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clOsalProcessSharedMutexInit(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBitmapDestroy(pStreamData->hStreamBitmap), CL_OK); CL_LOG_CLEANUP(clOsalMunmap_L(pStreamData->pStreamHeader, shmSize), CL_OK); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; return rc; } rc = clCntNodeAddAndNodeGet(hClntTable,(ClCntKeyHandleT) pStreamKey, (ClCntDataHandleT) pStreamData, NULL, phStreamNode); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeAddAndNodeGet(): rc[0x %x]", rc)); CL_LOG_CLEANUP(clBitmapDestroy(pStreamData->hStreamBitmap), CL_OK); CL_LOG_CLEANUP(clLogClientStreamMutexDestroy(pStreamData), CL_OK); CL_LOG_CLEANUP(clOsalMunmap_L(pStreamData->pStreamHeader, shmSize), CL_OK); clHeapFree(pStreamData->shmName.pValue); clHeapFree(pStreamData); pStreamData = NULL; 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; }
static ClRcT clLogFlusherCookieHandleCreate(ClUint32T numRecords, ClTimerHandleT *phTimer, ClHandleT *phFlusher) { ClRcT rc = CL_OK; ClLogFlushCookieT *pFlushCookie = NULL; ClLogSvrEoDataT *pSvrEoEntry = NULL; ClTimerTimeOutT timeout = {0, 8000L}; ClHandleT *pTimerArg = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clLogSvrEoEntryGet(&pSvrEoEntry, NULL); if( CL_OK != rc ) { return rc; } if( CL_FALSE == pSvrEoEntry->logInit ) { clLogError("LOG", "FLS", "Log Service has terminated..."); return CL_OK; } CL_LOG_DEBUG_TRACE(("hFlusherDB: %p ", (ClPtrT) pSvrEoEntry->hFlusherDB)); rc = clHandleCreate(pSvrEoEntry->hFlusherDB, sizeof(ClLogFlushCookieT), phFlusher); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCreate(): rc[0x %x]", rc); return rc; } pTimerArg = (ClHandleT*) clHeapCalloc(1, sizeof(ClHandleT)); if( NULL == pTimerArg ) { clLogError("LOG", "FLS", "clHeapCalloc() : rc[0x %x]", rc); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); return CL_LOG_RC(CL_ERR_NO_MEMORY); } *pTimerArg = *phFlusher; rc = clTimerCreateAndStart(timeout, CL_TIMER_ONE_SHOT, CL_TIMER_SEPARATE_CONTEXT, clLogFlusherTimerCallback, (ClPtrT)(ClWordT) pTimerArg, phTimer); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clTimerCreate(): rc[0x %x]", rc); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); clHeapFree(pTimerArg); return rc; } rc = clHandleCheckout(pSvrEoEntry->hFlusherDB, *phFlusher, (void **) &pFlushCookie); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCheckout(): rc[0x %x]", rc); CL_LOG_CLEANUP(clTimerDelete(phTimer), CL_OK); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); return rc; } pFlushCookie->numRecords = numRecords; pFlushCookie->hTimer = *phTimer; rc = clHandleCheckin(pSvrEoEntry->hFlusherDB, *phFlusher); if( CL_OK != rc ) { clLogError("LOG", "FLS", "clHandleCheckin(): rc[0x %x]", rc); CL_LOG_CLEANUP(clTimerDelete(phTimer), CL_OK); CL_LOG_CLEANUP(clHandleDestroy(pSvrEoEntry->hFlusherDB, *phFlusher), CL_OK); } 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 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; }
static ClRcT clLogSvrCompEntryRecreate(ClLogSvrCommonEoDataT *pSvrCommonEoEntry, ClLogSvrEoDataT *pSvrEoEntry, ClCntNodeHandleT hSvrStreamNode, ClBufferHandleT msg, ClUint32T compTableSize) { ClRcT rc = CL_OK; ClUint32T count = 0; ClLogSvrStreamDataT *pSvrStreamData = NULL; ClLogSvrCompDataT *pCompData = NULL; ClLogSvrCompKeyT *pCompKey = NULL; CL_LOG_DEBUG_TRACE(("Enter")); rc = clCntNodeUserDataGet(pSvrEoEntry->hSvrStreamTable, hSvrStreamNode, (ClCntDataHandleT *) &pSvrStreamData); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntDataForNodeGet(): rc[0x %x]\n", rc)); return rc; } for( count = 0; count < compTableSize; count++ ) { pCompKey = (ClLogSvrCompKeyT*) clHeapCalloc(1, sizeof(ClLogSvrCompKeyT)); if( NULL == pCompKey ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); return CL_LOG_RC(CL_ERR_NULL_POINTER); } rc = clXdrUnmarshallClUint32T(msg, &pCompKey->componentId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrMarshallClUint32T(): rc[0x %x]", rc)); clHeapFree(pCompKey); return rc; } pCompKey->hash = pCompKey->componentId % pSvrCommonEoEntry->maxComponents; pCompData = (ClLogSvrCompDataT*) clHeapCalloc(1, sizeof(ClLogSvrCompDataT)); if( NULL == pCompData ) { CL_LOG_DEBUG_ERROR(("clHeapCalloc()")); clHeapFree(pCompKey); return CL_LOG_RC(CL_ERR_NULL_POINTER); } rc = clXdrUnmarshallClUint32T(msg, &pCompData->refCount); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrMarshallClUint32T(): rc[0x %x]", rc)); clHeapFree(pCompData); clHeapFree(pCompKey); return rc; } rc = clXdrUnmarshallClUint32T(msg, &pCompData->portId); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clXdrMarshallClUint32T(): rc[0x %x]", rc)); clHeapFree(pCompData); clHeapFree(pCompKey); return rc; } rc = clCntNodeAdd(pSvrStreamData->hComponentTable, (ClCntKeyHandleT) pCompKey, (ClCntDataHandleT) pCompData, NULL); if( CL_OK != rc ) { CL_LOG_DEBUG_ERROR(("clCntNodeAdd(): rc[0x %x]\n", rc)); clHeapFree(pCompData); clHeapFree(pCompKey); return rc; } } CL_LOG_DEBUG_TRACE(("Exit")); return rc; }
ClRcT clLogClntStreamListGet(ClBufferHandleT msg, ClLogStreamInfoT *pLogStreams) { ClRcT rc = CL_OK; ClLogStreamInfoT *pTempBuffer = pLogStreams; ClUint32T count = 0; ClUint32T strmCnt = 0; ClUint32T numFiles = 0; ClUint32T numStreams = 0; ClUint32T numStreamsUnpacked = 0; ClLogStreamAttrIDLT streamAttr = {{0}}; CL_LOG_DEBUG_TRACE(("Enter")); rc = clXdrUnmarshallClUint32T(msg, &numFiles); if( CL_OK != rc ) { return rc; } for( count = 0; count < numFiles; count++) { memset(&streamAttr, '\0', sizeof(ClLogStreamAttrIDLT)); rc = VDECL_VER(clXdrUnmarshallClLogStreamAttrIDLT, 4, 0, 0)(msg, &streamAttr); if( CL_OK != rc ) { break; } if(streamAttr.fileName.pValue) clHeapFree(streamAttr.fileName.pValue); if(streamAttr.fileLocation.pValue) clHeapFree(streamAttr.fileLocation.pValue); rc = clXdrUnmarshallClStringT(msg, &streamAttr.fileName); if( CL_OK != rc ) { break; } rc = clXdrUnmarshallClStringT(msg, &streamAttr.fileLocation); if( CL_OK != rc ) { clHeapFree(streamAttr.fileName.pValue); break; } rc = clXdrUnmarshallClUint32T(msg, &numStreams); if( CL_OK != rc ) { clHeapFree(streamAttr.fileLocation.pValue); clHeapFree(streamAttr.fileName.pValue); break; } for(strmCnt = 0; strmCnt < numStreams; strmCnt++) { rc = clLogClntStreamListEntryGet(msg, &streamAttr, pTempBuffer); if(CL_LOG_RC(CL_ERR_INVALID_PARAMETER) == rc ) { rc = CL_OK; continue; } if( CL_OK != rc ) { clHeapFree(streamAttr.fileLocation.pValue); clHeapFree(streamAttr.fileName.pValue); return rc; } pTempBuffer += 1; ++numStreamsUnpacked; } clHeapFree(streamAttr.fileLocation.pValue); clHeapFree(streamAttr.fileName.pValue); } /* Any failure, cleanup the filled Entries */ if( CL_OK != rc ) { for( strmCnt = 0; strmCnt < numStreamsUnpacked; strmCnt++) { pTempBuffer = pLogStreams + strmCnt; clHeapFree(pTempBuffer->streamAttr.fileName); clHeapFree(pTempBuffer->streamAttr.fileLocation); pTempBuffer->streamAttr.fileName = pTempBuffer->streamAttr.fileLocation = NULL; } } 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; }
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; }
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; }