<> <> <> <> <> <> <> <> DIRECTORY FileStream USING [FinalizationProc], FS USING [ErrorDesc, ExtendFileProc, Lock, OpenFile, StreamBufferParms, StreamOptions], IO USING [StreamProcs], Rope USING [ROPE], VM USING [Interval]; FileStreamPrivate: CEDAR DEFINITIONS = BEGIN DoFinalization: BOOL = TRUE; <> <> <> <> <> <> ProcHandle: TYPE = REF IO.StreamProcs; <> ProcHandleFromAccessRights: PROC [accessRights: FS.Lock] RETURNS [ProcHandle]; SetupBuffer: PROC [fileData: FileDataHandle, fsData: FSDataHandle, fileByte: INT] RETURNS [currentNode: BufferNodeHandle] ; ProcessNode: PROC [ fileData: FileDataHandle, node: BufferNodeHandle ] ; <> StartRequest: PROC [ fileData: FileDataHandle, node: BufferNodeHandle ] ; FSDataHandle: TYPE = REF Data; BufferNodeHandle: TYPE = REF BufferNode ; FileDataHandle: TYPE = REF FileData ; <> Data: TYPE = RECORD [ index: CARDINAL _ 0, <> <= dataBytesInBuffer => trueDataBytesInBuffer = index.>> <> <> <> <> currentNode: BufferNodeHandle _ NIL, <> <> <> <> <> <> <> readAheadNode: BufferNodeHandle _ NIL, <> lastFirstByteInBuffer: INT _ -1, <> <> <> isWriteStream: BOOL _ FALSE, <> <> <> streamIsClosed: BOOL _ FALSE, <> <<(all operations should now raise StreamError[streamClosed]).>> fileData: FileDataHandle, <> FSErrorDesc: FS.ErrorDesc, <> StreamClassData: REF ANY _ NIL, <> FinalizationProc: FileStream.FinalizationProc _ NIL, <> ConvertFStoIOErrors: BOOL _ FALSE <> <> ]; NodeStatus: TYPE = {valid, invalid, needsParallelRead, parallelReadActive, needsSequentialRead, sequentialReadActive, needsParallelWrite, parallelWriteActive, needsSequentialWrite, sequentialWriteActive}; <> <> < this node has to have this action performed.>> <> <> BufferNode: TYPE = RECORD [ buffer: LONG POINTER TO PACKED ARRAY [0..0) OF CHAR _ NIL, <> bufferInterval: VM.Interval _ TRASH, <> <> bufferBytes: CARDINAL _ 0, <> dataBytesInBuffer: CARDINAL _ 0, < IN [0..bufferBytes].>> < trueDataBytesInBuffer = dataBytesInBuffer.>> <> firstFileByteInBuffer: INT _ -1, <> <> <> <<(buffer[0] is indentified with file[firstFileByteInBuffer]. There is always one file byte in the buffer unless file is empty.)>> didPut: BOOL _ FALSE, <<(somebody has done a Put and not updated dataBytesInBuffer, FileLength, and bufferDirty).>> bufferDirty: BOOL _ FALSE, < there exists some i IN [0..trueDataBytesInBuffer) such that buffer[i] # file[i] as last read from file system.>> <> useCount: INT _ 0, <> LRUCount: INT _ 0, <> status: NodeStatus _ invalid, <> nextBufferNode: BufferNodeHandle _ NIL <> <> ]; <> FileData: TYPE = RECORD [ lockRecord: MONITORED RECORD [], <> fileName: Rope.ROPE, firstBufferNode: BufferNodeHandle, <> <> firstReadStream: FSDataHandle _ NIL, <> <> <> accessRights: FS.Lock, tiogaReader: BOOL _ FALSE, <> <> fileLength: INT _ 0, < fileLen = fileLength.>> < dataBytesInBuffer => fileLen = firstFileByteInBuffer + index (index is from the writeStreamData).>> writeCount: INT _ 0, <> <> somethingHappened: CONDITION, <> fileHandle: FS.OpenFile, streamBufferParms: FS.StreamBufferParms, extendFileProc: FS.ExtendFileProc, streamOptions: FS.StreamOptions, numberOfStreams: INT _ 1, <> <> <> byteLength: INT, --current value of fileHandle.OpenInfo[].bytes byteSize: INT, --current value of fileHandle.OpenInfo[].pages*bytesPerPage validBytesOnDisk: INT, <> <> writeStreamData: FSDataHandle _ NIL <> ]; END. CHANGE LOG Created by MBrown on December 12, 1980 12:04 PM Changed by MBrown on January 6, 1981 8:53 PM <> Changed by MBrown on January 16, 1981 10:00 AM <> <> Changed by MBrown on January 18, 1981 1:00 AM <> <<"dataType" field).>> Changed by MBrown on 18-Jan-81 16:49:31 <> <> Changed by MBrown on January 21, 1981 3:45 PM <> <> Changed by MBrown on January 22, 1981 3:12 PM <> Changed by MBrown on January 25, 1981 8:19 PM <> Changed by MBrown on 27-Jan-81 15:10:07 < Juniper.>> Changed by MBrown on 29-Jan-81 20:43:05 <> Changed by Russ Atkinson on 26-May-81 14:07:10 < Rope, LONG CARDINAL -> LONG INTEGER>> Changed by MBrown on 7-Dec-81 10:30:56 <> Changed by MBrown on March 26, 1982 4:40 pm <> <> Changed by Teitelman on May 26, 1982 4:52 pm < IO.>> Changed by MBrown on August 23, 1982 2:18 pm < JuniperOpen,>> < ComSoftOpen, added CIFSOpen, added CIFS open file to pilot variant of Data.>> Changed by MBrown on May 16, 1983 2:03 pm <> Changed by MBrown on June 22, 1983 11:29 am <> Changed by MBrown on September 17, 1983 8:42 pm <> Changed by Hagmann on November 22, 1983 4:28 pm <> <> <> Changed by Hagmann on November 28, 1983 11:57 am <> Changed by Hagmann on December 5, 1983 <> <> Changed by Hagmann on January 3, 1984 11:14 am <> <<>> Changed by Hagmann on December 19, 1984 9:04:53 am PST <>