YggHostFS.mesa
Copyright Ó 1985, 1986, 1988 by Xerox Corporation. All rights reserved.
Andrew Birrell, September 20, 1983 2:04 pm
Russ Atkinson (RRA) February 27, 1985 9:18:16 pm PST
Doug Wyatt, February 27, 1985 9:44:36 am PST
Bob Hagmann May 13, 1988 9:36:46 am PDT
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE];
YggHostFS: CEDAR DEFINITIONS
= BEGIN
Errors
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];
This error may be raised by most of the procedures. The possible values of "why" are detailed with each procedure. This error is raised after releasing internal locks: the facilities of this interface may be used from catch-phrases. Page may not make sense for some Errors, in which case it will be -1; it tries to give information about what page caused the error. For debugging, extra information may be available in the frame that raises this error.
Types and Constants
VolumeID: TYPE[UNITS[CARD32]];
The permanent identification of a logical volume. Universally permanently unique.
NullVolumeRep: PRIVATE TYPE = RECORD[a:CARD32];
nullVolumeID: VolumeID = LOOPHOLE[NullVolumeRep[a:0]];
Guaranteed to be the UID of no volume.
PageNumber: TYPE = RECORD[INT];
Actually, [0..LAST[INT]). The file-relative number of a data page. The first data page of a file is numbered 0.
PageCount: TYPE = INT;
Actually [0..LAST[INT]]. Represents file sizes.
HostFile: TYPE = REF HostFileRep;
HostFileRep: TYPE;
The runtime representation of a file. NIL never represents a valid file.
Files
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];
Creating a file stream
StreamFromOpenFile: PROC [openFile: HostFile] RETURNS [IO.STREAM];
END.