FSReportImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Bob Hagmann February 4, 1985 10:25:18 am PST
Russ Atkinson (RRA) March 28, 1986 12:41:50 pm PST
DIRECTORY
BasicTime USING [GMT, nullGMT],
File USING [Reason],
FS USING [ErrorGroup, ErrorDesc],
FSBackdoor USING [CreateOp, CreateEvent, ErrorCode, MakeFName, noVersion, RemoteOp, RemoteEvent, Version],
FSName USING [BangVersionFile],
FSReport USING [],
IO USING [PutFR],
Rope USING [ROPE];
FSReportImpl:
CEDAR
MONITOR
IMPORTS FSBackdoor, FSName, IO
EXPORTS FS, FSBackdoor, FSReport
= {
ROPE: TYPE = Rope.ROPE;
Exported to FSBackdoor
remoteEventListTail: REF FSBackdoor.RemoteEvent ← NIL;
anotherRemoteEvent: CONDITION;
watchingRemote: BOOLEAN ← FALSE;
NextRemoteEvent:
PUBLIC
ENTRY
PROC [last:
REF
READONLY FSBackdoor.RemoteEvent]
RETURNS [
REF FSBackdoor.RemoteEvent] = {
IF last =
NIL THEN {
first call for this client
IF remoteEventListTail =
NIL
THEN {
no events in list yet
watchingRemote ← TRUE;
UNTIL remoteEventListTail # NIL DO WAIT anotherRemoteEvent ENDLOOP;
RETURN [remoteEventListTail];
}
ELSE last ← remoteEventListTail;
};
UNTIL last.chain # NIL DO WAIT anotherRemoteEvent ENDLOOP; -- wait for next event
RETURN [last.chain];
};
creationEventListTail: REF FSBackdoor.CreateEvent ← NIL;
anotherCreationEvent: CONDITION;
watchingCreation: BOOLEAN ← FALSE;
NextCreateEvent:
PUBLIC
ENTRY
PROC [last:
REF
READONLY FSBackdoor.CreateEvent]
RETURNS [
REF FSBackdoor.CreateEvent] = {
IF last =
NIL
THEN {
first call for this client
IF creationEventListTail =
NIL
THEN {
no events in list yet
watchingCreation ← TRUE;
UNTIL creationEventListTail # NIL DO WAIT anotherCreationEvent ENDLOOP;
RETURN [creationEventListTail];
}
ELSE last ← creationEventListTail;
};
UNTIL last.chain # NIL DO WAIT anotherCreationEvent ENDLOOP; -- wait for next event
RETURN [last.chain];
};
Exported to FSBackdoor
group:
PACKED
ARRAY FSBackdoor.ErrorCode
OF
FS.ErrorGroup = [
-- 4-- bug, bug, bug, bug,
--13-- environment, environment, environment, environment, environment, environment, environment, environment, environment, environment, environment, environment, environment,
-- 2-- lock, lock,
-- 8-- client, client, client, client, client, client, client, client,
--12-- user, user, user, user, user, user, user, user, user, user, user, user
];
codeAtom:
ARRAY FSBackdoor.ErrorCode
OF
ATOM = [
$ok, $inconsistent, $software, $badFP,
$wentOffline, $hardware, $volumeFull, $fragmented, $noMoreVersions, $serverInaccessible, $connectionRejected, $connectionTimedOut, $badCredentials, $accessDenied, $quotaExceeded, $invalidPropertyPage, $badBTree,
$lockConflict, $fileBusy,
$noCache, $wrongLock, $globalWriteLock, $zeroKeep, $badByteCount, $unknownPage, $invalidOpenFile, $notImplemented,
$nonCedarVolume, $unknownServer, $unknownVolume, $unknownFile, $unknownCreatedTime, $illegalName, $patternNotAllowed, $versionSpecified, $globalCreation, $badWorkingDir, $noKeeps, $cantUpdateTiogaFile
];
ProduceError:
PUBLIC
PROC [code: FSBackdoor.ErrorCode, explanation:
ROPE] =
{
ERROR Error [ [group[code], codeAtom[code], explanation] ];
};
Exported to FSReport
ReportRemote:
PUBLIC
ENTRY
PROC [op: FSBackdoor.RemoteOp, fName:
ROPE] = {
IF watchingRemote
THEN {
eventREF:
REF FSBackdoor.RemoteEvent =
NEW [ FSBackdoor.RemoteEvent ← [op, fName, NIL] ];
IF remoteEventListTail # NIL THEN remoteEventListTail.chain ← eventREF;
remoteEventListTail ← eventREF;
BROADCAST anotherRemoteEvent;
};
};
ReportCreation:
PUBLIC
ENTRY
PROC [op: FSBackdoor.CreateOp, fName:
ROPE] = {
IF watchingCreation
THEN {
eventREF:
REF FSBackdoor.CreateEvent =
NEW [ FSBackdoor.CreateEvent ← [op, fName, NIL] ];
IF creationEventListTail # NIL THEN creationEventListTail.chain ← eventREF;
creationEventListTail ← eventREF;
BROADCAST anotherCreationEvent;
};
};
FileError:
PUBLIC
PROC [reason: File.Reason] = {
code: FSBackdoor.ErrorCode;
e: ROPE;
SELECT reason
FROM
wentOffline => {
code ← wentOffline;
e ← "Local volume no longer accessible" };
nonCedarVolume => {
code ← nonCedarVolume;
e ← "Not a cedar volume" };
inconsistent => {
code ← inconsistent;
e ← "Local volume's permanent data structures are inconsistent" };
software => {
code ← software;
e ← "Label check while reading or writing local volume pages" };
hardware => {
code ← hardware;
e ← "Hard error while reading or writing local volume pages" };
unknownFile => {
code ← badFP;
e ← "File.FP from directory/cache doesn't correspond to a local volume file" };
unknownPage => {
code ← unknownPage;
e ← "Tried to read or write a page that is beyond end of the file" };
volumeFull => {
code ← volumeFull;
e ← "No more free pages on a local volume" };
fragmented => {
code ← fragmented;
e ← "File required too many non-contiguous areas on a local volume" };
ENDCASE => ERROR;
ProduceError[code, e];
};
LockConflict:
PUBLIC
PROC [prefix, nameBody:
ROPE, version: FSBackdoor.Version] = {
ProduceError[lockConflict,
NamedMsg["FS lock conflict on ", FSBackdoor.MakeFName[nameBody, version, prefix]]];
};
UnknownFile:
PUBLIC
PROC [name:
ROPE, createdTime: BasicTime.
GMT] = {
IF createdTime = BasicTime.nullGMT
THEN ProduceError[unknownFile, NamedMsg["Could not find ", name]]
ELSE {
name ← FSName.BangVersionFile[name, FSBackdoor.noVersion];
ProduceError[unknownCreatedTime, IO.PutFR["Could not find \"%g\" created on %t", [rope[name]], [time[createdTime]]]];
};
};
UnknownVolumeLName:
PUBLIC
PROC [name:
ROPE] = {
ProduceError[unknownVolume, NamedMsg["No system volume, so can't access ", name]];
};
UnknownVolume:
PUBLIC
PROC [vName:
ROPE] = {
IF vName =
NIL
THEN ProduceError[unknownVolume, "No system volume for this Cedar instance"]
ELSE ProduceError[unknownVolume, NamedMsg["No local volume named ", vName]];
};
NoCache:
PUBLIC
PROC [name:
ROPE] = {
ProduceError[noCache, NamedMsg[
"No system volume, so can't cache ", name
]];
};
VersionSpecified:
PUBLIC
PROC [name:
ROPE] = {
ProduceError[versionSpecified, NamedMsg[
"Version part not allowed for new name in ", name
]];
};
NamedMsg:
PROC [msg:
ROPE, name:
ROPE]
RETURNS [
ROPE] = {
RETURN [IO.PutFR["%g\"%g\"", [rope[msg]], [rope[name]] ]];
};
}.
Bob Hagmann February 4, 1985 10:00:55 am PST
changes to: Copyright, DIRECTORY, remoteEventListTail, NextRemoteEvent, creationEventListTail, NextCreateEvent, EventObject, NextEvent, ReportRemote, ReportCreation