-- LocalWorkstationServerImpl.mesa
-- Last edited by
-- MBrown on January 31, 1983 10:41 pm
-- Kolling on June 14, 1983 11:17 am
DIRECTORY
AlpineControl
USING[CreateFileStore, EraseFileStore, Recover],
AlpineEnvironment
USING[FileStore, VolumeID],
ConvertUnsafe
USING[ToRope],
LocalWorkstationServer
USING[TypeOfRestart],
PhysicalVolume
USING[EraseLogicalVolume],
Rope
USING[Concat, Equal, ROPE],
Volume
USING[ID, GetLabelString, GetNext, maxNameLength, nullID];
LocalWorkstationServerImpl: MONITOR
IMPORTS AlpineControl, ConvertUnsafe, PhysicalVolume, Rope, Volume
EXPORTS LocalWorkstationServer =
BEGIN OPEN AE: AlpineEnvironment, LWS: LocalWorkstationServer;
Initialize: PUBLIC ENTRY PROCEDURE[fileStore: AE.FileStore, typeOfRestart: LWS.TypeOfRestart,
nLogPages, nOwners: INT -- only if typeOfRestart = createServer--] =
BEGIN
logVolume: AE.VolumeID ← VolumeFromLocalFileStore[fileStore];
SELECT typeOfRestart FROM
warmStart => NULL;
coldStart => AlpineControl.EraseFileStore[logVolume, fileStore];
createServer => BEGIN
PhysicalVolume.EraseLogicalVolume[LOOPHOLE[logVolume, Volume.ID]];
AlpineControl.CreateFileStore[logVolume, nLogPages, fileStore];
END;
ENDCASE => ERROR;
AlpineControl.Recover[logVolume, (typeOfRestart = createServer), nOwners];
END;
VolumeFromLocalFileStore: INTERNAL PROCEDURE[fileStore: Rope.ROPE]
RETURNS[AE.VolumeID] =
BEGIN
-- Search for volume with same name as fileStore, without the ".alpine"
volID: Volume.ID ← Volume.nullID;
volString: STRING ← [Volume.maxNameLength];
volRope: Rope.ROPE;
DO
volID ← Volume.GetNext[volID];
IF volID = Volume.nullID THEN ERROR;
Volume.GetLabelString[volID, volString];
volRope ← ConvertUnsafe.ToRope[volString];
IF Rope.Equal[s1: fileStore, s2: volRope.Concat[".alpine"], case: FALSE] THEN
RETURN [LOOPHOLE[volID]];
ENDLOOP;
END;
END.