physicalVolumeHandle: PhysicalVolume.Handle ←
PhysicalVolume.GetHandle[deviceType, deviceIndex];
IF PhysicalVolume.IsReady[physicalVolumeHandle]
THEN {
physicalVolumeID: PhysicalVolume.ID;
logicalVolumeID: Volume.ID;
asserted: BOOL;
volumeSize, freePageCount: Volume.PageCount;
volumeType: Volume.Type;
label: STRING ← [100];
label.length ← 0;
asserted ← FALSE;
[] ← PhysicalVolume.GetHints[instance: physicalVolumeHandle, label: label];
out.PutF["Physical Volume: %g", IO.string[label]];
physicalVolumeID ← PhysicalVolume.AssertPilotVolume[
physicalVolumeHandle ! PhysicalVolume.Error =>
IF error = alreadyAsserted
THEN {
out.PutRope[" alreadyAsserted"];
asserted ← TRUE;
CONTINUE;
}];
out.PutRope["\n"];
IF asserted
THEN {
pvType: PhysicalVolume.VolumeType;
label.length ← 0;
[pvID: physicalVolumeID, volumeType: pvType] ← PhysicalVolume.GetHints[instance: physicalVolumeHandle, label: label];
IF pvType # isPilot
THEN {
out.PutRope[" ... not a pilot volume\n"];
LOOP;
};
};
logicalVolumeID ← Volume.nullID;
DO
logicalVolumeStatus: Volume.Status;
logicalVolumeID ← PhysicalVolume.GetNextLogicalVolume[
physicalVolumeID, logicalVolumeID ! PhysicalVolume.Error => {
IF error = physicalVolumeUnknown
THEN {
logicalVolumeID ← Volume.nullID;
CONTINUE;
};
}];
IF logicalVolumeID = Volume.nullID THEN EXIT;
logicalVolumeStatus ← Volume.GetStatus[logicalVolumeID];
label.length ← 0;
[volumeSize: volumeSize, freePageCount: freePageCount] ← Volume.GetAttributes[volume: logicalVolumeID];
volumeType ← Volume.GetType[volume: logicalVolumeID];
Volume.GetLabelString[volume: logicalVolumeID, s: label];
out.PutF[" Logical volume %g, size: %d, free: %d ", IO.string[label], IO.card[volumeSize], IO.card[freePageCount]];
out.PutF["type: %g, status: %g\n", IO.refAny[NEW[Volume.Type ← volumeType]], IO.refAny[NEW[Volume.Status ← logicalVolumeStatus]]];
IF
NOT asserted
AND logicalVolumeStatus = closedAndConsistent
THEN {
Volume.Open[logicalVolumeID];
out.PutRope[" ...opened\n"];
};
ENDLOOP;
};