int l3DataGetSingleBuf (rsComm_t *rsComm, int l1descInx, bytesBuf_t *dataObjOutBBuf, portalOprOut_t **portalOprOut) { int status = 0; int bytesRead; openedDataObjInp_t dataObjCloseInp; dataObjInfo_t *dataObjInfo; /* just malloc an empty portalOprOut */ *portalOprOut = (portalOprOut_t*)malloc (sizeof (portalOprOut_t)); memset (*portalOprOut, 0, sizeof (portalOprOut_t)); dataObjInfo = L1desc[l1descInx].dataObjInfo; if (dataObjInfo->dataSize > 0) { dataObjOutBBuf->buf = malloc (dataObjInfo->dataSize); bytesRead = l3FileGetSingleBuf (rsComm, l1descInx, dataObjOutBBuf); } else { bytesRead = 0; } #if 0 /* tested in _rsFileGet. don't need to go it again */ if (bytesRead != dataObjInfo->dataSize) { free (dataObjOutBBuf->buf); memset (dataObjOutBBuf, 0, sizeof (bytesBuf_t)); if (bytesRead >= 0) { rodsLog (LOG_NOTICE, "l3DataGetSingleBuf:Bytes toread %d don't match read %d", dataObjInfo->dataSize, bytesRead); bytesRead = SYS_COPY_LEN_ERR - errno; } } #endif memset (&dataObjCloseInp, 0, sizeof (dataObjCloseInp)); dataObjCloseInp.l1descInx = l1descInx; status = rsDataObjClose (rsComm, &dataObjCloseInp); if (status < 0) { rodsLog (LOG_NOTICE, "l3DataGetSingleBuf: rsDataObjClose of %d error, status = %d", l1descInx, status); } if (bytesRead < 0) return (bytesRead); else return status; }
int l3DataGetSingleBuf( rsComm_t *rsComm, int l1descInx, bytesBuf_t *dataObjOutBBuf, portalOprOut_t **portalOprOut ) { int status = 0; int bytesRead; openedDataObjInp_t dataObjCloseInp; dataObjInfo_t *dataObjInfo; /* just malloc an empty portalOprOut */ *portalOprOut = ( portalOprOut_t* )malloc( sizeof( portalOprOut_t ) ); memset( *portalOprOut, 0, sizeof( portalOprOut_t ) ); dataObjInfo = L1desc[l1descInx].dataObjInfo; if ( dataObjInfo->dataSize > 0 ) { dataObjOutBBuf->buf = malloc( dataObjInfo->dataSize ); bytesRead = l3FileGetSingleBuf( rsComm, l1descInx, dataObjOutBBuf ); } else { bytesRead = 0; } memset( &dataObjCloseInp, 0, sizeof( dataObjCloseInp ) ); dataObjCloseInp.l1descInx = l1descInx; status = rsDataObjClose( rsComm, &dataObjCloseInp ); if ( status < 0 ) { rodsLog( LOG_NOTICE, "l3DataGetSingleBuf: rsDataObjClose of %d error, status = %d", l1descInx, status ); } if ( bytesRead < 0 ) { return bytesRead; } else { return status; } }