<> <> <> <> 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; <> Error: PUBLIC ERROR [error: FS.ErrorDesc] = CODE; <> 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 { <> IF remoteEventListTail = NIL THEN { <> 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 { <> IF creationEventListTail = NIL THEN { <> 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]; }; <> 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] ]; }; <> 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]] ]]; }; }. <<>> <> <> <<>> <<>> <<>> <<>>