FileBackdoor.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Andrew Birrell, September 20, 1983 2:04 pm
Bob Hagmann January 29, 1985 2:06:37 pm PST
Doug Wyatt, February 27, 1985 9:42:56 am PST
This interface has the more private functions of the File Package.
DIRECTORY
Disk USING [Channel, PageCount, PageNumber],
File USING [FP, Handle, PageCount, PageNumber, PropertyStorage, Volume, VolumeFile, VolumeID],
PhysicalVolume USING [Physical, PhysicalRC],
Rope USING [ROPE];
FileBackdoor: CEDAR DEFINITIONS
= BEGIN
Types and Constants
Volume: TYPE = File.Volume;
Handle: TYPE = File.Handle;
PageCount: TYPE = File.PageCount;
PageNumber: TYPE = File.PageNumber;
VolumeFile: TYPE = File.VolumeFile;
FP: TYPE = File.FP;
PropertyStorage: TYPE = File.PropertyStorage;
Volumes
Management of volume free pages
ReservePages: PROC[physical: PhysicalVolume.Physical,
start: Disk.PageNumber, size: Disk.PageCount];
Notifies the volume creation machinery that the specified range of pages is not to be used (e.g. it contains initial microcode or an Alto partition)
ReserveNoPages: PROC[physical: PhysicalVolume.Physical];
Notifies the volume creation machinery that no pages are currently reserved
GetVolumePages: PROC[volume: Volume] RETURNS[size, free, freeboard: INT];
! Error[wentOffline, nonCedarVolume, inconsistent, software, hardware]
Returns the size and present free page count of this volume. Also returns the "freeboard" parameter set by a client (see volume flusher arrangements below).
VolumeFlusher: TYPE = PROC[Volume, INT, REF ANY] RETURNS[BOOL];
A procedure provided by a client which may be called occasionally to try to free up space on the volume. See "SetFlusher" below.
SetFlusher: PROC[volume: Volume, flusher: VolumeFlusher, data: REF ANY];
! no errors
Specifies a volume flusher for this volume. Hereafter, the procedure will be called from inside this implementation when the implementation thinks it is a good time to free up some pages on the volume. When called, the procedure is handed "data", "volume" and a page count indicating how many pages it should try to free. The flusher procedure should return TRUE iff it thinks it is making progress. No internal locks are held synchronously with the call out to the flusher procedure. Setting a flusher of NIL disables this facility. If the client has never specified a freeboard, then this call sets a suitable default freeboard.
GetFlusher: PROC[volume: Volume] RETURNS[VolumeFlusher, REF ANY];
! no errors
Returns NIL if there is currently no flusher for this volume.
SetFreeboard: PROC[volume: Volume, freeboard: INT];
Requests that the implementation try to maintain that number of free pages by calling the volume flusher (if there is one) from time to time.
Volume root page operations
CreatePhysicalVolume: PROC[where: Disk.Channel, name: Rope.ROPE, id: File.VolumeID] RETURNS[PhysicalVolume.Physical];
CreateLogicalVolume: PROC[where: LIST OF PhysicalVolume.Physical, size: INT, name: Rope.ROPE, id: File.VolumeID] RETURNS[File.Volume];
PhysicalPageBad: PROC[physical: PhysicalVolume.Physical, address: Disk.PageNumber] RETURNS[ badTableFull: BOOL, status: PhysicalVolume.PhysicalRC ];
Record page as bad in the physical volume root
IsBadPage: PROC[physical: PhysicalVolume.Physical, diskPage: Disk.PageNumber] RETURNS[bad: BOOL, status: PhysicalVolume.PhysicalRC];
Ask if a page is bad.
SpliceOutDataPage: PROC[file: Handle, filePage: File.PageCount] RETURNS [oldPage: Disk.PageNumber, oldChannel: Disk.Channel];
The given page is removed from the file, and a new previously free page is allocated, its label is written, and inserted into the file at the location of the bad page. The bad page number is returned. The page is not marked bad, but the client is free to do this. Not valid for header pages. May invalidate address returned by GetProperties.
SetRoot: PROC[root: VolumeFile, file: Handle, page: PageNumber ← [0]];
! Error[wentOffline, nonCedarVolume, unknownFile, inconsistent, software, hardware, mixedDevices]
Installs the file as a root file of its volume, for subsequent access by GetRoot or when inloading/booting. "page", if provided, is the page number of the first data page used for inloading/booting from this file.
GetRoot: PROC[volume: Volume, root: VolumeFile] RETURNS[fp: FP, page: PageNumber];
! Error[wentOffline, nonCedarVolume, inconsistent, software, hardware]
Returns the appropriate root file of the volume, or nullFP if no root has been installed.
MarkDebugger: PROC[volume: Volume, isDebugger: BOOL];
! Error[wentOffline, nonCedarVolume, inconsistent, software, hardware]
Marks the volume as being one which is expected to be the system volume of a world-swap debugger. If you don't understand that, don't call this procedure.
IsDebugger: PROC[volume: Volume] RETURNS[BOOL];
! Error[wentOffline, inconsistent, software, hardware]
Tells whether the volume is one which is expected to be the system volume of a world-swap debugger. If you don't understand that, don't call this procedure.
EraseVolume: PROC[volume: Volume];
! Error[wentOffline, nonCedarVolume, inconsistent, software, hardware]
Initialises the entire volume. This implicitly deletes every file on that volume, and sets all its volume root files to nullFP (except the VAM). Makes no assumptions about the previous contents of the volume. Error[inconsistent] probably indicates that a containing physical volume needs to be scavenged. Calling this for the volume that contains the current VM backing file is probably a bad idea.
Files
CreateVMBacking: PROC[volume: Volume, size: PageCount, report: PROC[File.FP, PropertyStorage, File.PageCount] ← NIL] RETURNS[Handle];
Special backdoor for FS to allow for special handling of the creation of the VM Backing File. Otherwise, this is identical to the Create procedure.
! Error[wentOffline, nonCedarVolume, volumeFull, fragmented, inconsistent, software, hardware]
NextFile: PROC[volume: Volume, prev: FP] RETURNS[FP];
! Error[wentOffline]
Returns the FP of the "next" file in existence on the volume. Giving prev=nullFP returns the "first" file. Returns nullFP if there is no "next" file. The enumeration order is determined by the physical layout of the disk. This is intended as the primitive operation for higher level scavengers.
END.
Bob Hagmann January 29, 1985 9:28:26 am PST
split from File.mesa