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