Hardware manual

CAs: a vector indexed by page number in which the ith entry contains the core address to or from which
page i should be transfered. The note for DAs applies here also.
fp (or filePtr): file pointer, described above. In most cases, the leader page address is not used.
action: a magic number which specifies what the disk should do. Possible values are declared as manifest
constants in Disks.D:
DCreadD: check the header and label, read the data;
DCreadLD: check the header, read the label and data;
DCreadHLD: read the header, label, and data;
DCwriteD: check the header and label, write the data;
DCwriteLD: check the header, write the label and data;
DCwriteHLD: write the header, label, and data;
DCseekOnly: just seek to the specified track
DCdoNothing:
A particular implementation of the disk class may also make other operations available by defining
additional magic numbers.
5. Higher-level Subroutines
There are two high-level calls on the basic file system:
pageNumber = ActOnDiskPages(disk, CAs, DAs, filePtr, firstPage, lastPage, action, lvNumChars,
lastAction, fixedCA, cleanupRoutine, lvErrorRoutine, returnOnCheckError, hintLastPage).
Parameters beyond "action" are optional and may be defaulted by omitting them or making them 0.
Here firstPage and lastPage are the page numbers of the first and last pages to be acted on (i.e. read or
written, in normal use). This routine does the specified action on each page and returns the page number
of the last page successfully acted on. This may be less than lastPage if the file turns out to have fewer
pages. DAs!firstPage must contain a disk address, but any of DAs!(firstPage+1) through
DAs!(lastPage+1) may be fillInDA, in which case it will be replaced with the actual disk address, as
determined from the chain when the labels are read. Note that the routine will fill in DAs!(lastPage+1),
so this word must exist.
The value of the numChars field in the label of the last page acted on will be left in rv lvNumChars. If
lastAction is supplied, it will be used as the action for lastPage instead of action. If CAs eq 0, fixedCA is
used as the core address for all the data transfers. If cleanupRoutine is supplied, it is called after the
successful completion of each disk command, as described below under "Lower-level disk access". (Note:
providing a cleanup routine defeats the automatic filling in of disk addresses in DAs).
Disk transfers that generate errors are retried several times and then the error routine is called with
rv lvErrorRoutine(lvErrorRoutine, cb, errorCode)
In other words, lvErrorRoutine is the address of a word which contains the (address of the) routine to be
called when there is an error. The errorCode tells what kind of error it was; the standard error codes are
tabulated in a later section. The cb is the control block which caused the error; its format depends on the
particular implementation of the drivers (Bfs: the structure CB in Bfs.D).
The intended use of lvErrorRoutine is this. A disk stream contains a cell A, in a known place in the stream
structure, which contains the address of a routine which fields disk errors. The address of A is passed as
lvErrorRoutine. When the error routine is called, it gets the address of A as a parameter, and by
subtracting the known position of A in the disk stream structure, it can obtain the address of the stream
structure, and thus determine which stream caused the error.
Disks & Bfs August 10, 1980 56
For Xerox Internal Use Only -- December 15, 1980