DIRECTORY Rope USING [ROPE]; YggDummyFile: 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[12]; NullVolumeRep: PRIVATE TYPE = RECORD[a,b,c:CARD32]; nullVolumeID: VolumeID = LOOPHOLE[NullVolumeRep[a:0,b:0,c: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 -- fs(8), -- client directory system root file -- alpine(9), -- for use by Alpine file servers -- acacia (10), -- for use by Acacia file servers -- namedSpare (11), -- a named entry that is spare -- logFile (12), -- file system log file -- fs2(13), -- client directory system root file copy 2 -- logFile2 (14), -- file system log file copy 2 -- (18) -- spare root page slots -- }; CedarVolumeSubType: TYPE = MACHINE DEPENDENT { other (0), FS(1), -- If volatile then expect FS to compute the VAM Alpine(2), -- If volatile then expect Alpine to compute the VAM FSAndAlpine(3) -- If volatile then expect both FS and Alpine to contribute to computing the VAM }; OldFP: TYPE = MACHINE DEPENDENT RECORD[ id(0): FileID, da(1): OldDA ]; FP: TYPE = MACHINE DEPENDENT RECORD[ id(0): FileID, da(1): DA ]; FileID: TYPE[4]; OldDA: TYPE[4]; DA: TYPE = REF DAObj; DAObj: TYPE; NullFileIDRep: PRIVATE TYPE = RECORD[a:CARD32]; NullDARep: PRIVATE TYPE = RECORD[a:CARD32]; nullDA: PRIVATE DA = LOOPHOLE[NullDARep[0]]; NullOldDARep: PRIVATE TYPE = RECORD[a:CARD32]; nullOldDA: PRIVATE OldDA = LOOPHOLE[NullOldDARep[0]]; nullOldFP: OldFP = [id: nullFileID, da: nullOldDA]; nullFP: FP = [id: nullFileID, da: nullDA]; nullFileID: FileID = LOOPHOLE[NullFileIDRep[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: NAT = 256; logWordsPerPage: NAT = 8; PagesForWords: PROC[w: INT] RETURNS[PageCount]; SectorsForWords: PROC[w: INT, volume: Volume] RETURNS[PageCount]; WordsForSectors: PROC[pages: PageCount, volume: Volume] RETURNS[INT]; Handle: TYPE = REF Object; Object: TYPE; PropertyStorage: TYPE = LONG POINTER TO RECORD[SEQUENCE COMPUTED CARDINAL OF WORD]; NextVolume: PROC[volume: Volume, wait: BOOL _ FALSE] RETURNS[Volume]; LogicalInfo: PROC[volume: Volume] RETURNS[ id: VolumeID, size: INT, rootStatus: RC, name: Rope.ROPE, vamStatus: RC, labeled: BOOL, subType: CedarVolumeSubType, -- unlabeled only volatileVAM: BOOL, -- unlabeled only vamStable: BOOL, -- unlabeled only updateNumber: CARD, free: INT, freeboard: INT ]; 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]; FindSystemVolume: PROC RETURNS[found: BOOL]; FindVM: PROC RETURNS[found: BOOL]; LabeledOpen: PROC[volume: Volume, fp: OldFP] RETURNS[Handle]; Open: PROC[volume: Volume, fp: FP, name: Rope.ROPE _ NIL, verifyFPNow: BOOL _ FALSE] RETURNS[Handle]; Create: PROC[volume: Volume, size: PageCount, report: PROC[OldFP, PropertyStorage, PageCount] _ NIL, name: Rope.ROPE _ NIL, specialFile: BOOL _ FALSE, makeContiguous: BOOL _ FALSE] RETURNS[Handle]; Delete: PROC[file: Handle]; Info: PROC[file: Handle] RETURNS [volume: Volume, labeled: BOOL, fp: OldFP, newfp: FP, size: PageCount, name: Rope.ROPE]; 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[prop:PropertyStorage, nPages: PageCount]; SetPropertiesSize: PROC[file: Handle, nPages: PageCount]; WriteProperties: PROC[file: Handle]; END. "κYggDummyFile.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 March 23, 1988 8:48:35 am PST Introduction Dummy to get Yggdrasil to compile. Errors 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 The permanent identification of a logical volume. Universally permanently unique. Guaranteed to be the UID of no volume. The runtime representation of a volume. NIL never represents a valid volume. The permanent identification of a labeled file. "id" is permanently unique relative to a volume. The permanent identification of an unlabeled file. "id" is permanently unique relative to a volume. Guaranteed to be the OldFP of no file. Guaranteed to be the FP of no file. Guaranteed to be the FileID of no file. Actually, [0..LAST[INT]). The file-relative number of a data page. The first data page of a file is numbered 0. Actually [0..LAST[INT]]. Represents file sizes. Use of constant page size (e.g., wordsPerPage) is to be phased out. Use the procedures for sectors instead. -rbh The number of words in each data page of a file. Might not equal VM.wordsPerPage. Should really say "DiskFace.wordsPerPage", but we don't want that compilation dependency. The runtime representation of a file. NIL never represents a valid file. Volumes Locating and naming volumes. The enumerator for volumes. This gives the volumes in time sequence of the containing physical volumes coming online (omitting volumes that are no longer online). A "VolumeObject" is created when the requisite containing physical volumes all come online, and remains valid until one of them goes offline. NextVolume[NIL] gives the first currently valid volume. If there are no more volumes and "wait" is FALSE, returns NIL. If there are no more volumes and "wait" is TRUE, waits until a new "VolumeObject" is created. Note that this enumeration includes volumes which may raise Error[inconsistent, software, hardware] if you try to access them, and a volume may go offline immediately after it has been returned by this enumeration. Following information is valid only if rootStatus is ok or nonCedarVolume Following information is valid only if vamStatus is ok Misc info about the volume. This procedure raises no errors. Note the caveats about which results are valid. See also GetVolumeID[...], GetVolumeName[...], and GetVolumePages[...]. ! no errors Returns the volume's permanent UID. ! Error[wentOffline, inconsistent, software, hardware] Returns the human-sensible name of this volume (not necessarily unique). Obtain the handle for accessing the specified volume, by enumerating with "NextVolume" and "GetVolumeID", omitting volumes no longer online. If no suitable volume is found, then NIL is returned. Obtain the handle for accessing the specified volume, by enumerating with "NextVolume" and "GetVolumeName", omitting volumes no longer online and volumes that raise an error in GetVolumeName. If no suitable volume is found, then NIL is returned. Obtain the handle for accessing the volume which was booted to start this run. Returns NIL if there is no such volume. Asserts that this is the system volume. This may also determine the VM backing file if we don't yet have one. It's rather dangerous to call this unless you know that there was previously no system volume. If there is currently no system volume, try to find one. Returns whether there is now a system volume. This is a no-op if there is presently a system volume. If there is currently no VM backing file, try to find one. Returns whether there is now a VM backing file. This is a no-op if there is presently a VM backing file. Files ! Error[wentOffline, nonCedarVolume, unknownFile, inconsistent, software, hardware] Prepares for runtime access to the file. Verifies that the "FP" is for an existing file, and reports "unknownFile" if not. Normally used on labeled volumes. For unlabeled volumes, only root files should be opened this way. ! Error[wentOffline, nonCedarVolume, unknownFile, inconsistent, software, hardware] Prepares for runtime access to the file. IF verifyFPNow, then verification of the FP is performed immediately and reports "unknownFile" if not. Otherwise, verification is done on the first file operation (e.g., Read). Note that there is no Close operation, since it would have no effect. The name parameter is only used as a comment of the Handle constructed. It should be some identifing string such as the file name. It is not used for opening the file in any way except for setting the "clientFileName" field in FileInternal.Object Warning: files are uniquely identified by the FileID. However, to open a file the entire FP (including the DA) must be presented. The DA of a file may change whenever operations change the pages allocated to the file. That is, calls to (at least) Delete, SetSize, and SpliceOutDataPage change the value and maybe the size of the DA for a File.Handle. ! Error[wentOffline, nonCedarVolume, volumeFull, fragmented, inconsistent, software, hardware] Creates a file having the given number of data pages. The name parameter is the same as in NewOpen. For labeled volumes only, report can be used. If "report" is not NIL then it is called with the new file's FP and PropertyStorage immediately before the file is actually created. However, "report" may be called multiple times with differing FP's (if writing the file's new pages encounters a hard disk error) - only the last FPis correct. Note that at even after the reporter has been called, the creation may fail. During a call of "report", no internal locks are held, except an exclusive lock on the file being created. The client may initialize one page of the file's PropertyStorage during a call of "report". "specialFile" should be asserted only for key system files (e.g., the FS root file). These files will be allocated near the center of the volume to decrease disk arm motion and have replicated leader pages. Wizards only. "makeContiguous" should be asserted only for key system files that must be contiguous (e.g., the germ). If the file is later extended, it not guaranteed to remain contiguous. ! Error[wentOffline, unknownFile, inconsistent, software, hardware] Destroys the file. ! Error[unknownFile] The size is the page number of data pages in the file. That is, a file with no data pages has size 0. "name" is the name passed at Open or Create, and may be NIL. ! Error[wentOffline, nonCedarVolume, unknownFile, volumeFull, fragmented, inconsistent, software, hardware] Extends or contracts the file (synchronously). ! Error[wentOffline, unknownFile, unknownPage, inconsistent, software, hardware] Copies pages from the file starting at "from" into the VM specified by "to". If Error[unknownPage] is raised, no pages were transferred. "to" must be page alligned. ! Error[wentOffline, unknownFile, unknownPage, inconsistent, software, hardware] Copies pages from the VM specified by "from" into the file starting at "to". If Error[unknownPage] is raised, no pages were transferred. "from" must be page alligned. ! Error[unknownFile] Returns storage containing the properties of a labeled file. The property storage is uninterpreted at this level and lives as long as the file handle, unless SetPropertiesSize increases property storage, or SetSize or SpliceOutDataPage change the number of run pages. This call never involves disk IO. Increase property storage to nPages for a labeled file. A noop if file has this size or larger. If the size changes, this causes disk I/O. Invalidates data returned by previous calls to GetProperties. ! Error[wentOffline, unknownFile, inconsistent, software, hardware] Writes the property storage of the file back to disk for a labeled file, Bob Hagmann January 29, 1985 9:19:17 am PST rearranged extras interfaces, created FileBackdoor, changed PropertyStorage to be variable sized changes to: PropertyStorage, Create, Delete, GetProperties, SetPropertiesSize, WriteProperties, DIRECTORY, Create, Delete, GetProperties, SetPropertiesSize, WriteProperties, END Bob Hagmann January 31, 1985 12:03:17 pm PST changes to: Create Russ Atkinson (RRA) February 27, 1985 9:18:04 pm PST Error now has a page number (where applicable), PagesForWords uses Basics.DoubleShiftRight., File Bob Hagmann November 11, 1986 2:20:52 pm PST changes for labelless file system Κ Ž˜codešœ™KšœH™HKšœ*™*K™4K™,Kšœ)™)—K˜šΟk ˜ Kšœœœ˜—K˜KšΠbl œœ ˜ Kšœ˜headšœ ™ K™"—šœ™šœœΟc*˜7Kšœ˜Kšœ Ÿ9˜FKšœŸ@˜PKšœŸG˜UKšœ ŸL˜VKšœ Ÿ9˜CKšœ ŸA˜NKšœ Ÿ/˜Kšœ&™&—K˜Kšœœœ˜ K˜šœœ˜KšœM™M—K˜šœ œœ œŸ˜AKšœ˜Kšœ ˜ Kšœ˜Kšœ ˜ Kšœ Ÿ˜Kšœ Ÿ˜KšœŸ!˜(KšœŸ˜#KšœŸ'˜.Kšœ Ÿ$˜/Kšœ Ÿ$˜1KšœŸ!˜3KšœŸ˜(Kšœ Ÿ.˜7KšœŸ!˜0KšœŸ˜ Kšœ˜—K˜šœœœ œ˜.Kšœ ˜ KšœŸ0˜8Kšœ Ÿ4˜@KšœŸP˜`Kšœ˜K˜—š œœœ œœ˜'Kšœ"Πeoœ8™aKšœ˜Kšœ ˜ Kšœ˜K˜—š œœœ œœ˜$Kšœ#  œ8™dKšœ˜Kšœ˜ Kšœ˜—K˜Kšœœ˜K˜Kšœœ˜K˜Kšœœœ˜K˜Kšœœ˜ K˜˜Kš œœœœœ˜/Kš œ œœœœ˜+Kšœœœœ˜,Kš œœœœœ˜.Kšœ œ œ˜5K˜—šœ3˜3Kšœ&™&K™—šœœ ˜*Kšœ#™#—K˜šœœ˜0Kšœ'™'—K˜šœ œœœ˜Kšœq™q—K˜šœ œœ˜Kšœ0™0—K˜šΟnœœœ˜CKšœœ Ÿ˜.—˜KšΟbq™qK™—šœœ˜Kšœœ˜Kšœ­™­—K˜Kš‘ œœœœ ˜/K˜Kš‘œœœœ ˜AK˜Kš ‘œœœœœ˜EK˜K˜Kšœœœ˜šœœ˜ KšœI™I—K˜K˜Kšœœœœœœœœœœœ˜S—šœ™Kšœ™K˜š ‘ œœœœœ ˜EKšœβ™β—K˜š‘ œœœ˜*K˜ Kšœœ˜ Kšœ œ˜KšœI™IKšœ œ˜Kšœ œ˜Kšœ œ˜KšœŸ˜.Kšœ œŸ˜$Kšœ œŸ˜"Kšœœ˜Kšœ6™6Kšœœ˜ Kšœ ˜Kšœ˜Kšœ·™·—K˜š‘ œœœ˜8Kšœ ™ Kšœ#™#—K˜š‘ œœœœ˜7Kšœ6™6KšœH™H—K˜š‘œœœ ˜5KšœΓ™Γ—K˜š‘œœ œœ ˜:Kšœφ™φ—K˜š‘ œœœ ˜#Kšœw™w—K˜š‘œœ ˜KšœΞ™Ξ—K˜š‘œœœœ˜,KšœŸ™Ÿ—K˜š‘œœœœ˜"Kšœ₯™₯—K˜—šœ™š‘ œœœ ˜=KšœS™SKšœ{™{Kšœd™dK™—š‘œœœ  œœœœ ˜eKšœS™SKšœ‘™‘Kšœψ™ψKšœα™α—K˜š‘œœ*œœœ œœœœœœœ ˜ΕKšœ^™^Kšœd™dKšœλ™λKšœή™ήKšœ―™―—K˜š‘œœ˜KšœC™CKšœ™—K˜š ‘œœœœœœ˜yKšœ™Kšœ€™€—K˜š‘œœ ˜-Kšœk™kKšœ.™.—K˜š ‘œœœ8œœ˜WKšœP™PKšœ¦™¦—K˜š‘œœ8œœ˜QKšœP™PKšœ¨™¨—K˜š‘ œœœ*˜SKšœ™Kšœ―™―—K˜š‘œœ"˜9KšœΛ™ΛK™—š‘œœ˜$KšœC™CKšœH™H—K˜—K˜šœ˜K™™+Kšœ`™`Kšœ Οr₯™±—K™™,Kšœ £™——™4Kš£œ+£ œ£™a—K™™,Kšœ!™!——…—v?ξ