00001
00002
00003
00004
00005
00006
00007
00008 #include "fileRead.h"
00009 #include "fileClose.h"
00010 #include "streamRead.h"
00011 #include "miscServerFunct.h"
00012 #include "rsGlobalExtern.h"
00013
00014 int
00015 rsStreamRead (rsComm_t *rsComm, fileReadInp_t *streamReadInp,
00016 bytesBuf_t *streamReadOutBBuf)
00017 {
00018 int fileInx = streamReadInp->fileInx;
00019 int status;
00020
00021 if (fileInx < 3 || fileInx >= NUM_FILE_DESC) {
00022 rodsLog (LOG_ERROR,
00023 "rsStreamRead: fileInx %d out of range", fileInx);
00024 return (SYS_FILE_DESC_OUT_OF_RANGE);
00025 }
00026 if (FileDesc[fileInx].inuseFlag != FD_INUSE) return SYS_BAD_FILE_DESCRIPTOR;
00027
00028 if (FileDesc[fileInx].fileName == NULL) return SYS_INVALID_FILE_PATH;
00029 if (strcmp (FileDesc[fileInx].fileName, STREAM_FILE_NAME) != 0) {
00030 rodsLog (LOG_ERROR,
00031 "rsStreamRead: fileName %s is invalid for stream",
00032 FileDesc[fileInx].fileName);
00033 return SYS_INVALID_FILE_PATH;
00034 }
00035 status = rsFileRead (rsComm, streamReadInp, streamReadOutBBuf);
00036
00037 #if 0
00038 if (status <= 0) {
00039 fileCloseInp_t fileCloseInp;
00040
00041 fileCloseInp.fileInx = fileInx;
00042 rsFileClose (rsComm, &fileCloseInp);
00043 }
00044 #endif
00045 return status;
00046 }
00047