DIRECTORY IFSFile USING [AccessFailure, Buffer, Completer, CompleterArg, Position], Leaf USING [FileAddress, Handle, LeafType, OpSpecificFileAddress], PupDefs USING [PupAddress], Rope USING [ROPE], Sequin USING [Buffer, Handle]; IFSFilePrivate: DEFINITIONS = BEGIN OPEN IFSFile, Rope; FSObject: TYPE = MONITORED RECORD [ primaryName, primaryPassword: ROPE _ NIL, secondaryName, secondaryPassword: ROPE _ NIL, serverAddr: PupDefs.PupAddress, fileList: FileHandle _ NIL, changeInOpenState: CONDITION _ [timeout: 0], cachedSequin: Sequin.Handle _ NIL, haveSequin: BOOL _ FALSE]; FSInstance: TYPE = REF FSObject; FileObject: TYPE = MONITORED RECORD [ sequin: Sequin.Handle _ NIL, ioPending: IORequest _ NIL, ioSynch: CONDITION _ [timeout: 0], length: Position _ NULL, openCount: [0..128) _ 1, locked: BOOL _ FALSE, seal: FileSeal _ underwaySeal, state: FileState _ alive, link: FileHandle, leafHandle: Leaf.Handle _ NULL, name: ROPE, fs: FSInstance, watcher: PROCESS RETURNS [BOOL] _ NULL]; FileHandle: TYPE = REF FileObject; FileState: TYPE = {alive, flush, closing, closed}; FileSeal: TYPE = MACHINE DEPENDENT { underwaySeal (22B), openSeal (41B), closedSeal (55B), (77B)}; IORequestBlock: TYPE = RECORD [ link: IORequest _ NIL, buffer: Buffer, address: Leaf.FileAddress, op: Leaf.LeafType, bytesToGo: CARDINAL, proc: Completer _ NULL, arg: CompleterArg _ NULL]; IORequest: TYPE = REF IORequestBlock; IFSTimes: TYPE = MACHINE DEPENDENT RECORD [create, write, read: IFSTIME]; IFSTIME: TYPE = MACHINE DEPENDENT RECORD [high, low: CARDINAL]; fileTimeAddress: Leaf.FileAddress = [high: 3777B, low: 174000B]; fileLockTimeout: CARDINAL = 2*60; connectionTimeout: CARDINAL = 10*60; GetSequinForFS: PROC [fs: FSInstance] RETURNS [sequin: Sequin.Handle, fromCache: BOOL]; FreeSequinForFS: PROC [ fs: FSInstance, sequin: Sequin.Handle, toCache: BOOL _ TRUE]; InsertFile: PROC [fs: FSInstance, name: ROPE, openProc: PROC [FileHandle] RETURNS [IFSFile.AccessFailure]] RETURNS [FileHandle]; ReleaseFile: PROC [file: FileHandle, closeProc: PROC [FileHandle]]; PurgeFile: PROC [file: FileHandle, destroyProc: PROC [FileHandle]]; ValidateFile: PROC [file: FileHandle]; DoRead: PROC [file: FileHandle, request: IORequest]; DoWrite: PROC [file: FileHandle, request: IORequest]; FileWatcher: PROC [file: FileHandle] RETURNS [BOOL]; InitializeFreeList: PROC; FinalizeFreeList: PROC; GetIORequestBlock: PROC RETURNS [IORequest]; FreeIORequestBlock: PROC [request: IORequest]; AddRopeToBuffer: PROC [buffer: Sequin.Buffer, r: ROPE] RETURNS [Sequin.Buffer]; FileAddressToPosition: PROC [fa: Leaf.FileAddress] RETURNS [Position]; PositionToFileAddress: PROC [ pos: Position, opSpecific: Leaf.OpSpecificFileAddress _ [read[]]] RETURNS [Leaf.FileAddress]; END. XIFSFilePrivate.mesa Levin - 13-Oct-81 9:59:49 Russ Atkinson, November 9, 1983 8:54 pm Types and Related Constants -- the following values are in seconds File Manipulation Procedures -- acquires a sequin for use under the specified file system. releases a sequin previously in use under the specified file system. The file 'name' is checked against files presently open under file system 'fs'. If the file is not already open, 'openProc' is called. If 'openProc' returns an AccessFailure other than 'ok', the open is considered to have failed, otherwise, the use count of the file handle is incremented. The use count on the indicated file is decremented and, if zero, 'closeProc' is called. The FileHandle then becomes invalid. If the use count is still greater than zero, closeProc is not called and the FileHandle remains usable. The use count on the indicated file must be zero, otherwise an error occurs. 'destroyProc' is called and it is expected to remove all traces of the file. I/O -- initiates a read operation as described by 'file' and 'request'. initiates a write operation as described by 'file' and 'request'. handles responses from the server to operations requested by StartRead and StartWrite. The return value indicates whether the file operations were shut down normally or abnormally. FreeList Management -- Miscellaneous Utilities -- Ê•˜šœ™Jšœ™J™'—J˜šÏk ˜ Jšœœ<˜IJšœœ8˜BJšœœ˜Jšœœœ˜Jšœœ˜J˜—šœ œœœ˜7J˜J˜Jšœ™J˜šœ œ œœ˜#Jšœœœ˜)Jšœ"œœ˜-J˜Jšœœ˜Jšœ œ˜,Jšœœ˜"Jšœ œœ˜J˜—Jšœ œœ ˜ J˜šœ œ œœ˜%Jšœœ˜Jšœœ˜Jšœ œ˜"Jšœœ˜J˜Jšœœœ˜J˜J˜J˜Jšœœ˜Jšœœ˜ J˜Jš œ œœœœ˜(J˜—Jšœ œœ ˜"J˜Jšœ œ#˜2J˜šœ œœ œ˜$Jšœ=˜=—J˜šœœœ˜Jšœœ˜J˜J˜J˜Jšœ œ˜Jšœœ˜Jšœœ˜J˜—Jšœ œœ˜%J˜Jš œ œœ œœœ˜IJ˜Jš œœœ œœ œ˜?J˜J˜@J˜Jšœ#™#J˜Jšœœ˜!Jšœœ ˜$J˜J˜Jšœ™˜šÏnœœ˜%Jšœ$œ˜1Jšœ:™:—J˜šžœœ˜Jšœ0œœ˜=JšœD™D—J˜šž œœœ˜-Jšœ œœ˜