<> <> <> <> <> <<>> <> <<>> <> DIRECTORY Rope USING[ ROPE ]; File: CEDAR DEFINITIONS = BEGIN <> RC: TYPE = { -- extension of "Reason" for internal use. ok, wentOffline, -- volume is not accessible (some drive has been offline) nonCedarVolume, -- the operation is not possible on a non-cedar (Pilot?) volume. inconsistent, -- the volume's (or file's) permanent data structures look inconsistent software, -- i.e. label-check. The page on disk is not the one the software expected. hardware, -- the disk hardware/microcode detected a hard disk error unknownFile, -- the file does not exist (possibly deleted since it was opened) unknownPage, -- the page would be beyond the end of the file volumeFull, -- the volume has no free pages (and one is needed!) fragmented, -- the file requires too many non-contiguous areas of disk ( > 84 today ) mixedDevices -- a bootable file is not entirely on one device, or not on correct device }; Reason: TYPE = RC[SUCC[ok]..LAST[RC]]; -- error reason Error: ERROR[why: Reason]; <> <> VolumeID: TYPE[5]; <> NullVolumeRep: PRIVATE TYPE = RECORD[a,b,c,d,e:CARDINAL]; nullVolumeID: VolumeID = LOOPHOLE[NullVolumeRep[a:0,b:0,c:0,d:0,e:0]]; <> Volume: TYPE = REF VolumeObject; VolumeObject: TYPE; <> VolumeFile: TYPE = MACHINE DEPENDENT { -- root files of a volume checkpoint(0), microcode(1), germ(2), bootFile(3), debugger(4), -- outload file -- debuggee(5), -- outload file -- VM(6), -- virtual memory backing file -- VAM(7), -- volume allocation map -- client(8), -- client directory system root file -- alpine(9), -- for use by Alpine file servers -- (15) -- spare root page slots -- }; VolumeFlusher: TYPE = PROC[Volume, INT, REF ANY] RETURNS[BOOL]; <> FP: TYPE = MACHINE DEPENDENT RECORD[ <> id(0): FileID, da(2): DA ]; FileID: TYPE[2]; DA: TYPE[2]; NullFileIDRep: PRIVATE TYPE = RECORD[a,b:CARDINAL]; NullDARep: PRIVATE TYPE = RECORD[a,b:CARDINAL]; nullDA: PRIVATE DA = LOOPHOLE[NullDARep[0,0]]; nullFP: FP = [id: nullFileID, da: nullDA]; <> nullFileID: FileID = LOOPHOLE[NullFileIDRep[0,0]]; <> PageNumber: TYPE = RECORD[INT]; <> PageCount: TYPE = INT; <> Add: PROC[p: PageNumber, n: PageCount] RETURNS[PageNumber] = INLINE { RETURN[ [p+n] ] }; -- "n" may be negative -- wordsPerPage: INT = 256; <> PagesForWords: PROC[w: INT] RETURNS[PageCount] = INLINE { RETURN[ (w+wordsPerPage-1) / wordsPerPage ] }; Handle: TYPE = REF Object; Object: TYPE; <> propertyWords: INT = 256; -- the number of words in a file's property storage. PropertyStorage: TYPE = LONG POINTER TO ARRAY [0..propertyWords) OF WORD; <> <> NextVolume: PROC[volume: Volume, wait: BOOL _ FALSE] RETURNS[Volume]; <> GetVolumeID: PROC[volume: Volume] RETURNS[id: VolumeID]; <> <> GetVolumeName: PROC[volume: Volume] RETURNS[Rope.ROPE]; <> <> FindVolumeFromID: PROC[id: VolumeID] RETURNS[Volume]; <> FindVolumeFromName: PROC[name: Rope.ROPE] RETURNS[Volume]; <> SystemVolume: PROC RETURNS[Volume]; <> SetSystemVolume: PROC[Volume]; <> <> GetVolumePages: PROC[volume: Volume] RETURNS[size, free, freeboard: INT]; <> <> SetFlusher: PROC[volume: Volume, flusher: VolumeFlusher, data: REF ANY]; <> <> GetFlusher: PROC[volume: Volume] RETURNS[VolumeFlusher, REF ANY]; <> <> SetFreeboard: PROC[volume: Volume, freeboard: INT]; <> <> SetRoot: PROC[root: VolumeFile, file: Handle, page: PageNumber _ [0]]; <> <> GetRoot: PROC[volume: Volume, root: VolumeFile] RETURNS[fp: FP, page: PageNumber]; <> <> MarkDebugger: PROC[volume: Volume, isDebugger: BOOL]; <> <> IsDebugger: PROC[volume: Volume] RETURNS[BOOL]; <> <> EraseVolume: PROC[volume: Volume]; <> <> <> Open: PROC[volume: Volume, fp: FP] RETURNS[Handle]; <> <> Create: PROC[volume: Volume, size: PageCount, report: PROC[FP] _ NIL] RETURNS[Handle]; <> <> Delete: PROC[file: Handle]; <> <> Info: PROC[file: Handle] RETURNS[volume: Volume, fp: FP, size: PageCount]; <> <> SetSize: PROC[file: Handle, size: PageCount]; <> <> Read: UNSAFE PROC[file: Handle, from: PageNumber, nPages: PageCount, to: LONG POINTER]; <> <> Write: PROC[file: Handle, to: PageNumber, nPages: PageCount, from: LONG POINTER]; <> <> GetProperties: PROC[file: Handle] RETURNS[PropertyStorage]; <> <> WriteProperties: PROC[file: Handle]; <> <> NextFile: PROC[volume: Volume, prev: FP] RETURNS[FP]; <> <> END.