<> <> <> <> <> <> DIRECTORY IO USING [STREAM], Rope USING [ROPE]; YggHostFS: 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 mixedDevices, -- a bootable file is not entirely on one device, or not on correct device wrongVolume -- a bootable file is not on the correct volume }; Reason: TYPE = RC[SUCC[ok]..LAST[RC]]; -- error reason Error: ERROR [why: Reason, diskPage: INT _ -1]; <> <> VolumeID: TYPE[UNITS[CARD32]]; <> NullVolumeRep: PRIVATE TYPE = RECORD[a:CARD32]; nullVolumeID: VolumeID = LOOPHOLE[NullVolumeRep[a:0]]; <> PageNumber: TYPE = RECORD[INT]; <> PageCount: TYPE = INT; <> HostFile: TYPE = REF HostFileRep; HostFileRep: TYPE; <> <> Open: PROC [name: Rope.ROPE] RETURNS [HostFile]; Create: PROC [name: Rope.ROPE, size: PageCount ] RETURNS [HostFile]; Delete: PROC [file: HostFile]; Info: PROC [file: HostFile] RETURNS [size: PageCount, name: Rope.ROPE]; SetSize: PROC [file: HostFile, size: PageCount]; Read: UNSAFE PROC [file: HostFile, from: PageNumber, nPages: PageCount, to: LONG POINTER]; Write: PROC [file: HostFile, to: PageNumber, nPages: PageCount, from: LONG POINTER]; <> StreamFromOpenFile: PROC [openFile: HostFile] RETURNS [IO.STREAM]; END. <<>>