PFSBackdoor.mesa
Copyright Ó 1989, 1992 by Xerox Corporation. All rights reserved.
Carl Hauser, April 18, 1989 10:52:22 am PDT
Backdoors to the Portable Cedar File System
Willie-s, August 20, 1991 6:29 pm PDT
Michael Plass, January 27, 1992 5:10 pm PST
DIRECTORY
CStrings USING [CString],
IO USING [STREAM],
PFS USING [nullUniqueID, UniqueID],
PFSNames USING [PATH],
Rope USING [ROPE],
UnixTypes USING [FD];
PFSBackdoor: CEDAR DEFINITIONS
= BEGIN
ROPE: TYPE = Rope.ROPE;
ErrorCode: TYPE = MACHINE DEPENDENT {
ok -- used internally-- , inconsistent, resourceLimitExceeded, ioError, volumeFull, noMoreVersions, serverInaccessible, connectionRejected, connectionTimedOut, badCredentials, accessDenied, quotaExceeded, invalidPropertyStorage, outOfPropertySpace, positionNotInFile, invalidOpenFile, notImplemented, fileTypeMismatch, unknownClass, unknownFile, unknownUniqueID, illegalName, patternNotAllowed, versionSpecified, cantUpdateTiogaFile, invalidNameSyntax,
(BYTE.LAST/2)
};
ProduceError: PROC [code: ErrorCode, explanation: Rope.ROPE, info: REF ¬ NIL];
Raises PFS.Error for the code ATOM that corresponds lexically to the "code". The PFS.ErrorGroup in the error is properly set. The error will contain "explanation". Clients should use this procedure to generate PFS.Error's for existing codes to avoid spelling the ATOM's wrong and getting the wrong PFS.ErrorGroup.
AtomFromErrorCode: PROC [ErrorCode] RETURNS [ATOM];
ErrorCodeFromAtom: PROC [ATOM] RETURNS [ErrorCode];
Op: TYPE = {startRetrieving, endRetrieving, startStoring, endStoring, startDeleting, endDeleting, startRenaming, endRenaming, startCopying, endCopying, fileInfo, readOpen, writeClose, start1, end1, start2, end2, start3, end3, start4, end4}; -- the last few are spares
Event: TYPE = RECORD [
op: Op, -- remote operation that has occurred
fName: PFSNames.PATH, -- full name of the file operated upon; the toName in the case of renaming and copying
chain: REF Event -- used internally to chain events together
];
NextEvent: PROC [REF READONLY Event ¬ NIL]
RETURNS [REF READONLY Event];
An event is the start or conclusion of retrieving, storing, deleting, renaming or storing a file, or the close of a file open for writing. NextEvent returns the next event that occurs after the argument Event. When the argument Event is NIL then NextEvent returns the first event to occur after the time of the call. NextEvent will WAIT if another event has not occurred yet. Storing, retrieving, flushing, renaming and copying of several files can be in progress simultaneously.
Client errors: none
User errors: none
OpenFileFromProcs: PROC ~ {
Not implemented in this version of PFS
};
FDIndex: TYPE ~ CARD; -- used to keep track of the file position of the underlying FD
unknownIndex: FDIndex ~ CARD.LAST; -- actual index is unknown - must lseek
unreliableIndex: FDIndex ~ CARD.LAST-1; -- always lseek
UXData: TYPE ~ RECORD [
fd: UnixTypes.FD,
setUniqueIDAtClose: CStrings.CString ¬ NIL,
wantedUniqueID: PFS.UniqueID ¬ PFS.nullUniqueID,
setNameAtClose: CStrings.CString ¬ NIL,
fdIndex: FDIndex ¬ unknownIndex,
lock: MONITORLOCK
];
VUXData: TYPE ~ RECORD [
fd: UnixTypes.FD,
setUniqueIDAtClose: CStrings.CString ¬ NIL,
wantedUniqueID: PFS.UniqueID ¬ PFS.nullUniqueID,
fdIndex: FDIndex ¬ unknownIndex,
lock: MONITORLOCK
];
FDFromOpenStream: PROC [self: IO.STREAM] RETURNS [UnixTypes.FD];
Clients are warned that the resulting file descriptor may be positioned at an arbitrary place within the file. Use UnixSysCalls.LSeek to position it before performing any read or write operations. Also, beware of the possibility of concurrent access to the underlying OpenFile.
END.
Carl Hauser, January 12, 1989 3:14:26 pm PST
Created from Cedar7.0 FS.Backdoor