-- LabelTransfer.mesa (last edited by: Luniewski on: January 9, 1981 10:14 AM)
DIRECTORY
DiskChannel USING [Address, CompletionStatus, Drive],
Environment USING [PageNumber],
File USING [PageCount, PageNumber],
FileInternal USING [Descriptor, Operation, PageGroup],
PilotDisk USING [Label],
VolumeInternal USING [PageNumber];
LabelTransfer: DEFINITIONS =
BEGIN
Operation: TYPE = FileInternal.Operation[readLabel..writeLabelsAndData];
ReadLabel: PROCEDURE [
file:
FileInternal.Descriptor,
filePage:
File.PageNumber,
volumePage:
VolumeInternal.PageNumber,
handleErrors:
BOOLEANTRUE]
RETURNS [label: PilotDisk.Label, status: DiskChannel.CompletionStatus];
ReadRootLabel: PROCEDURE [
drive:
DiskChannel.Drive,
rootPage:
VolumeInternal.PageNumber]
RETURNS [label: PilotDisk.Label, status: DiskChannel.CompletionStatus];
WriteLabels: PROCEDURE [
file:
FileInternal.Descriptor,
pageGroup:
FileInternal.PageGroup,
handleErrors:
BOOLEANTRUE]
RETURNS [status: DiskChannel.CompletionStatus];
VerifyLabels: PROCEDURE [
file:
FileInternal.Descriptor,
pageGroup:
FileInternal.PageGroup,
expectErrorAfterFirstPage:
BOOLEAN ← FALSE,
handleErrors:
BOOLEANTRUE]
-- mainly for scavenger; TRUE inhibits low level retries if labels don’t match AFTER first page of run

RETURNS [countValid: File.PageCount, status: DiskChannel.CompletionStatus];
ReadLabelAndData: PROCEDURE [
file:
FileInternal.Descriptor,
filePage:
File.PageNumber,
volumePage:
VolumeInternal.PageNumber,
memoryPage:
Environment.PageNumber,
handleErrors:
BOOLEANTRUE]
RETURNS [label: PilotDisk.Label, status: DiskChannel.CompletionStatus];
WriteLabelAndData: PROCEDURE [
file:
FileInternal.Descriptor,
filePage:
File.PageNumber,
volumePage:
VolumeInternal.PageNumber,
memoryPage:
Environment.PageNumber,
bootChainLink:
DiskChannel.Address ← NULL,
handleErrors:
BOOLEANTRUE]
RETURNS [status: DiskChannel.CompletionStatus];
LabelStatus: TYPE = {valid, invalid, diskError};
DiskStatusToLabelStatus: PROCEDURE [status: DiskChannel.CompletionStatus]
RETURNS [labelStatus: LabelStatus] = INLINE
{RETURN[SELECT status FROM
goodCompletion => valid,
hardwareError, notReady => diskError,
ENDCASE => invalid]};
END.
LOG
Time: June 15, 1978 11:03 PMBy: RedellAction: Create file
Time: March 13, 1979 7:28 PMBy: RedellAction: Add ReadRootLabel
Time: August 1, 1979 12:13 PMBy: RedellAction: Use FilePageLabel
Time: August 13, 1979 3:18 PMBy: RedellAction: Change WriteLabelAndData to do runs of pages with optional chaining; don’t loophole drive
Time: September 17, 1979 4:36 PMBy: ForrestAction: Add LabelStatus, and caused ReadRootLabel to return it. Should other label procs use this also?
Time: January 9, 1980 2:24 PMBy: GobbelAction: Add countValid to RETURNS of VerifyLabels
Time: August 14, 1980 9:50 AMBy: McJonesAction: WriteLabelsAndData=>WriteLabelAndData; FilePageLabel=>PilotDisk
Time: October 11, 1980 7:40 PMBy: ForrestAction: add crock (for scavenger) that causes VerifyLabels to not retry if at least the first page of the run is OK.
Time: January 9, 1981 10:14 AMBy: LuniewskiAction: Add option of not having lower levels handle disk errors and to return disk status instead (for Scavenger).