-- PilotDisk.mesa (last edited by: McJones on: June 25, 1980 9:18 AM)
-- NOTE: The format of page labels as defined here CAN NEVER BE CHANGED
--
without invalidating all outstanding Pilot volumes.
DIRECTORY
Environment USING [PageOffset],
File USING [ID, nullID, PageNumber, Type],
Inline USING [BITXOR, LongNumber];
PilotDisk: DEFINITIONS IMPORTS Inline =
BEGIN
-- Definitions common to faces for all disks supported as Pilot volumes.
-- The procedures defined here may be called from face implementations, including those used by the germ.
-- Generalized disk drive handles
-- To be used as ‘‘device handle’’ type by face for any disk supported as Pilot volume.
-- Unique only within drives of same face.
-- Use of this type ensures room in Pilot disk driver tables for device handle.
Handle: TYPE = PRIVATE RECORD [UNSPECIFIED];
-- Disk addresses
-- Used as place holder within boot chain link field of page label (see below).
-- ‘‘Exported’’ type; contents may vary from disk to disk.
Address: TYPE = PRIVATE RECORD [a, b: UNSPECIFIED];
nullAddress: Address = [a: LAST[CARDINAL], b: LAST[CARDINAL]]; -- flags end of boot chain
-- Page labels
-- Every page (sector) of a Pilot disk contains a label record. Disk operations may verify the contents of the label before transferring the actual data record. To support transfers of runs of pages at disk speeds, the disk device (i.e. electronics, controller microcode, and/or head software) must know something about Pilot’s label format to verify the contents and to compute the delta from one label to the next.
Label: TYPE = MACHINE DEPENDENT RECORD [
fileID (0): File.ID,-- valid in label of every page
filePageLo (5): CARDINAL, filePageHi (6:0..6): [0..128),-- 23 bit page pumber, valid in label of every page
pad1 (6:7..12): [0..64) ← 0,-- always zero
immutable (6:13..13): BOOLEAN,-- valid only in label of page 0
temporary (6:14..14): BOOLEAN,-- valid only in label of page 0
zeroSize (6:15..15): BOOLEAN,-- valid only in label of page 0
type (7): File.Type,-- valid in label of every page
bootChainLink (10B): Address];-- valid in label of every page
nullLabel: Label = [
fileID: File.nullID,
filePageLo: 0, filePageHi: 0,
immutable: FALSE,
temporary: FALSE,
zeroSize: FALSE,
pad1: 0,
type: [0],
bootChainLink: [0, 0]];
LN: PRIVATE PROCEDURE [lowbits, highbits: CARDINAL] RETURNS [LONG CARDINAL] =
MACHINE CODE BEGIN END;
GetLabelFilePage: PROCEDURE [label: LONG POINTER TO Label] RETURNS [File.PageNumber] =
INLINE BEGIN
RETURN[LN[lowbits: label.filePageLo, highbits: label.filePageHi]]
END;
SetLabelFilePage: PROCEDURE [label: LONG POINTER TO Label, fpn: File.PageNumber] =
INLINE BEGIN
label.filePageLo ←
LOOPHOLE[fpn, Inline.LongNumber].lowbits;
label.filePageHi ←
LOOPHOLE[fpn, Inline.LongNumber].highbits;
END;
MatchLabels: PROCEDURE [p1, p2: LONG POINTER TO Label] RETURNS [match: BOOLEAN] =
INLINE BEGIN
-- Test whether significant fields of p1↑ and p2↑ are equal.
-- All fields except bootChainLink are significant.
-- NOTE: We use two-word compares since the compiler expands them into inline machine code rather than a kernel function call.
MatchableLabel: TYPE = MACHINE DEPENDENT RECORD [
a, b, c, d, dontCare: RECORD [UNSPECIFIED, UNSPECIFIED]];
BEGIN OPEN m1: LOOPHOLE[p1↑, MatchableLabel], m2: LOOPHOLE[p2↑, MatchableLabel];
RETURN[m1.a=m2.a AND m1.b=m2.b AND m1.c=m2.c AND m1.d=m2.d]
END
END;
NextLabel: PROCEDURE [p: LONG POINTER TO Label] =
INLINE BEGIN
-- Modify p to match next page label in run.
IF (p.filePageLo ← p.filePageLo+1)=0 THEN p.filePageHi ← p.filePageHi+1;
p.immutable ← p.temporary ← p.zeroSize ← FALSE;
END;
--- GetLabelType, SetLabelType are for compatibility with old FilePageLabel; remove when convenient:
GetLabelType: PROCEDURE [label: LONG POINTER TO Label] RETURNS [File.Type] =
INLINE BEGIN RETURN [label.type] END;
SetLabelType: PROCEDURE [label: LONG POINTER TO Label, type: File.Type] =
INLINE BEGIN label.type ← type END;
LabelCheckSum: PROCEDURE [label: LONG POINTER TO Label, offset: Environment.PageOffset]
RETURNS [checkSum: CARDINAL] =
INLINE BEGIN OPEN fID: LOOPHOLE[label.fileID, MACHINE DEPENDENT RECORD [a, b, c, d, e: UNSPECIFIED]];
adjFilePage: Inline.LongNumber = LOOPHOLE[GetLabelFilePage[label]-offset];
RETURN[
Inline.BITXOR[fID.a,
Inline.BITXOR[fID.b,
Inline.BITXOR[fID.c,
Inline.BITXOR[fID.d,
Inline.BITXOR[fID.e,
Inline.BITXOR[adjFilePage.lowbits, adjFilePage.highbits]]]]]]]
END;
END.
LOG
Time: May 9, 1980 5:30 PMBy: McJonesAction: Create file from OISDisk (last edited by McJones on February 7, 1980 9:40 AM) and from FilePageLabel (last edited by Redell on August 17, 1979 6:43 PM)