SunMountClientStub.mesa
Copyright Ó 1987 by Xerox Corporation. All rights reserved.
Demers, September 20, 1987 12:46:43 pm PDT
DIRECTORY
RefText USING [New, ReleaseScratch],
SunMount USING [dump, DumpProc, EachExportProc, EachGroupProc, export, ExportProc, fhSize, FHStatus, maxNameLen, maxPathLen, mnt, MntProc, Name, null, NullProc, Path, program, programVersion, umnt, umntall, UmntallProc, UmntProc],
SunMountClient USING [],
SunRPC USING [GetAlign, GetBlock, GetCard32, GetEphemeralRefText, Handle, PutRefText, ReleaseReply, SendCallAndReceiveReply, StartCall]
;
SunMountClientStub: CEDAR PROGRAM
IMPORTS RefText, SunRPC
EXPORTS SunMountClient
~ {
Types
Handle: TYPE ~ SunRPC.Handle;
Name: TYPE ~ SunMount.Name;
Path: TYPE ~ SunMount.Path;
Parameters
maxPathLen: CARDINAL ~ SunMount.maxPathLen;
maxNameLen: CARDINAL ~ SunMount.maxNameLen;
fhSize: CARDINAL ~ SunMount.fhSize;
fastTimeout: CARD ← 500;
mediumTimeout: CARD ← 2000;
slowTimeout: CARD ← 5000;
defaultRetries: CARD ← 5;
noRetries: CARD ← 0;
Procedures
Null: PUBLIC SunMount.NullProc -- [h: Handle, c: Conversation] -- ~ {
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.null];
[] ← SunRPC.SendCallAndReceiveReply[h, fastTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
Mnt: PUBLIC SunMount.MntProc -- [h: Handle, c: Conversation, directory: Path] RETURNS [reply: FHStatus] -- ~ {
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.mnt];
SunRPC.PutRefText[h, directory];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
reply ← GetFHStatus[h];
SunRPC.ReleaseReply[h];
};
Dump: PUBLIC SunMount.DumpProc -- [h: Handle, c: Conversation, eachMount: EachMountProc] -- ~ {
hostNameBuf: Name ← NIL;
directoryBuf: Path ← NIL;
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.dump];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, noRetries];
WHILE (SunRPC.GetCard32[h] # 0) DO
hostNameBuf ← SunRPC.GetEphemeralRefText[h, hostNameBuf];
directoryBuf ← SunRPC.GetEphemeralRefText[h, directoryBuf];
IF NOT eachMount[hostNameBuf, directoryBuf].continue THEN EXIT;
ENDLOOP;
IF hostNameBuf # NIL THEN RefText.ReleaseScratch[hostNameBuf];
IF directoryBuf # NIL THEN RefText.ReleaseScratch[directoryBuf];
SunRPC.ReleaseReply[h];
};
Umnt: PUBLIC SunMount.UmntProc -- [h: Handle, c: Conversation, directory: Path] -- ~ {
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.umnt];
SunRPC.PutRefText[h, directory];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
Umntall: PUBLIC SunMount.UmntallProc -- [h: Handle, c: Conversation] -- ~ {
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.umntall];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
SunRPC.ReleaseReply[h];
};
Export: PUBLIC SunMount.ExportProc -- [h: Handle, c: Conversation, eachExport: EachExportProc, eachGroup: EachGroupProc] -- ~ {
exportBuf: Path ← NIL;
groupBuf: Name ← NIL;
SunRPC.StartCall[h, c, SunMount.program, SunMount.programVersion, SunMount.export];
[] ← SunRPC.SendCallAndReceiveReply[h, mediumTimeout, defaultRetries];
WHILE (SunRPC.GetCard32[h] # 0) DO
exportBuf ← SunRPC.GetEphemeralRefText[h, exportBuf];
IF NOT eachExport[exportBuf].continue THEN GOTO Quit;
WHILE (SunRPC.GetCard32[h] # 0) DO
groupBuf ← SunRPC.GetEphemeralRefText[h, groupBuf];
IF NOT eachGroup[groupBuf].continue THEN GOTO Quit;
ENDLOOP;
REPEAT
Quit => NULL;
ENDLOOP;
IF exportBuf # NIL THEN RefText.ReleaseScratch[exportBuf];
IF groupBuf # NIL THEN RefText.ReleaseScratch[groupBuf];
SunRPC.ReleaseReply[h];
};
GetFHStatus: PROC [h: SunRPC.Handle] RETURNS [response: SunMount.FHStatus] ~ {
IF (response.status ← SunRPC.GetCard32[h]) = 0 THEN {
response.directory ← RefText.New[fhSize];
SunRPC.GetBlock[h, response.directory, 0, fhSize];
SunRPC.GetAlign[h];
};
};
}...