DIRECTORY IO USING [STREAM], PFS, PFSNames USING [PATH, Version], Rope USING [ROPE] ; PFSClass: CEDAR DEFINITIONS ~ { ROPE: TYPE ~ Rope.ROPE; PATH: TYPE ~ PFSNames.PATH; Version: TYPE ~ PFSNames.Version; UniqueID: TYPE ~ PFS.UniqueID; OpenFile: TYPE = REF OpenFileObject; OpenFileObject: TYPE = RECORD [ fs: FSHandle, fullFName: PATH, attachedTo: PATH, uniqueID: PFS.UniqueID, bytes: INT, mutability: PFS.Mutability, fileType: PFS.FileType, state: {closed, open}, data: REF ]; FSHandle: TYPE ~ REF FSObject; FSObject: TYPE ~ RECORD [ flavor: ATOM, name: ROPE, -- e.g. "Ivy-STP", "Palain-NFS" maintenanceProcs: MaintenanceProcs, procs: FileManipulationProcs, data: REF ]; MaintenanceProcs: TYPE ~ REF MaintenanceProcsObject; MaintenanceProcsObject: TYPE ~ RECORD [ sweep: SweepProc _ NIL, validate: ValidateProc ]; FileManipulationProcs: TYPE = REF FileManipulationProcsObject; FileManipulationProcsObject: TYPE = RECORD [ delete: DeleteProc, enumerateForInfo: EnumerateForInfoProc, enumerateForNames: EnumerateForNamesProc, fileInfo: FileInfoProc, lookupName: LookupNameProc, rename: RenameProc, copy: CopyProc, setAttributes: SetAttributesProc, setByteCountAndUniqueID: SetByteCountAndUniqueIDProc, setClientProperty: SetClientPropertyProc, getClientProperty: GetClientPropertyProc, enumerateClientProperties: EnumerateClientPropertiesProc, read: ReadProc, write: WriteProc, open: OpenProc, close: CloseProc, store: StoreProc, retrieve: RetrieveProc, attach: AttachProc, getInfo: GetInfoProc, pfsNameToUnixName: PFSNameToUnixNameProc, caseSensitive: CaseSensitiveProc ]; LookupNameProc: TYPE = PROCEDURE [h: FSHandle, file: PATH] RETURNS[PATH]; DeleteProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, wantedUniqueID: UniqueID, proc: PFS.NameConfirmProc]; EnumerateForInfoProc: TYPE = PROCEDURE [h: FSHandle, pattern: PATH, proc: PFS.InfoProc, lbound: PATH, hbound: PATH]; EnumerateForNamesProc: TYPE = PROCEDURE [h: FSHandle, pattern: PATH, proc: PFS.NameProc, lbound: PATH, hbound: PATH]; FileInfoProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, wantedUniqueID: UniqueID] RETURNS [version: Version, attachedTo: PATH, bytes: INT, uniqueID: UniqueID, mutability: PFS.Mutability, fileType: PFS.FileType]; RenameProc: TYPE = PROCEDURE [h: FSHandle, fromFile: PATH, wantedUniqueID: UniqueID, toFile: PATH, createOptions: PFS.CreateOptions, proc: PFS.NameConfirmProc] RETURNS [done: BOOL _ FALSE]; CopyProc: TYPE = PROCEDURE [h: FSHandle, fromFile: PATH, wantedUniqueID: UniqueID, toFile: PATH, createOptions: PFS.CreateOptions, proc: PFS.NameConfirmProc] RETURNS [done: BOOL _ FALSE]; SetAttributesProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, attributes: PFS.CreateOptions]; SetByteCountAndUniqueIDProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, bytes: INT, uniqueID: PFS.UniqueID]; SetClientPropertyProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, propertyName: ROPE, propertyValue: ROPE]; GetClientPropertyProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, propertyName: ROPE] RETURNS [propertyValue: ROPE]; EnumerateClientPropertiesProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, proc: PFS.PropProc]; OpenProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, wantedUniqueID: UniqueID, access: PFS.AccessOptions, checkFileType: BOOL, fileType: PFS.FileType, createOptions: PFS.CreateOptions] RETURNS [OpenFile]; ReadProc: TYPE = UNSAFE PROCEDURE [h: FSHandle, file: OpenFile, filePosition, nBytes: CARD, to: LONG POINTER] RETURNS [bytesRead: INT]; WriteProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile, filePosition, nBytes: CARD, from: LONG POINTER] RETURNS [bytesWritten: INT]; CloseProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile]; StoreProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, wantedUniqueID: UniqueID, str: IO.STREAM, proc: PFS.StoreConfirmProc, createOptions: PFS.CreateOptions]; RetrieveProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, wantedUniqueID: UniqueID, proc: PFS.RetrieveConfirmProc, checkFileType: BOOL _ FALSE, fileType: PFS.FileType]; AttachProc: TYPE = PROCEDURE [h: FSHandle, file: PATH, to: PATH, keep: CARDINAL, wantedUniqueID: UniqueID, remoteCheck: BOOL _ TRUE] RETURNS [toFName: PATH]; GetInfoProc: TYPE = PROCEDURE [h: FSHandle, file: OpenFile] RETURNS [fullFName, attachedTo: PATH, uniqueID: UniqueID, bytes: INT, mutability: PFS.Mutability, fileType: PFS.FileType]; SweepProc: TYPE ~ PROC [h: FSHandle, seconds: CARD]; ValidateProc: TYPE ~ PROC [h: FSHandle] RETURNS [obsolete: BOOL, downMsg: ROPE]; PFSNameToUnixNameProc: TYPE ~ PROCEDURE [h: FSHandle, file: PATH] RETURNS [ROPE]; CaseSensitiveProc: TYPE ~ PROCEDURE [h: FSHandle, file: PATH] RETURNS [BOOL]; Register: PROC [flavor: ATOM, getHandle: GetHandleProc]; GetHandleProc: TYPE ~ PROC [fs: ROPE, flavorSpecified: BOOL] RETURNS [h: FSHandle, downMsg: ROPE]; GetFS: PROC [fs: ROPE] RETURNS [h: FSHandle]; ClearCachedServer: PROC [fs: ROPE]; Error: ERROR [code: ATOM, msg: ROPE]; }... rPFSClass.mesa Copyright Σ 1989, 1990 by Xerox Corporation. All rights reserved. Doug Wyatt, February 2, 1990 4:24:56 pm PST Chauser, June 21, 1990 11:36 am PDT Introduction PFSClass defines a registration mechanism for file system view implementations to hook themselves up to PFS. In keeping with PFS's philosophy regarding Errors and monitor locks, a class should never raise an error while holding a lock: clients are entitled to call other procedures in the class during error handline. Copied Types Types FS handles note: as an abbreviation "FS" is to be read "File System" Types for procedures each class should implement By convention, the PATH arguments that are passed by PFSImpl to the class implementations of these procedures have an empty 0th component (corresponding to the class designation). The class information is captured at this level in the FSHandle. Called a few (~10) times a minute by this package for miscellaneous housekeeping. The seconds argument specifies how long it's been since the last call. Called to validate a handle that might be stale. If obsolete=TRUE, the handle is out of date and should be replaced (by calling appropriate getFSProc). IF downMsg#NIL, the file system is known to exist but is down. For views that use the unix file system, returns the unix name corresponding to the named file. The implementor should try to avoid file system access; however, to implement the translation of file!H file system access will, of course, be needed. Returns TRUE iff the case of any character in the file name is significant. Registration Register an(other) file ops implementation. Any existing registration for "flavor" disappears. "getHandle" may be NIL, to clear a registration. Tries to find a file system of the given name. If successful, creates FSHandle h and return [h, NIL]. If no file system responds and no server is known to exist, returns [NIL, NIL]. If fs is known to exist but is not responding, returns [NIL, message]. The flavorSpecified argument may be used by "layered" flavor implementations; if TRUE, the fs name originally presented to RemoteFile.GetServer[] had a flavor suffix. Does not raise Error! The client may Process.Abort a GetHandleProc. Lookup Tries to find a file system of the given name, using the cache. ! Error[$fsNotKnown, ...] ! Error[$fsNotAvailable, ...] ! Error[$viewNotImplemented, ...] Controlling the cache. If this is necessary the network environment is probably screwed up. Error Codes $fsNotKnown : can't look up the server name. $fsNotAvailable : can't contact it. $viewNotImplemented : requested view not implemented by file system. $software : "can't happen" Κ‘˜codešœ ™ K™BK™+K™#K™—šΟk ˜ Kšœœœ˜Kšœ˜Kšœ œœ ˜Kšœœœ˜K˜K˜—šΟnœœ ˜K˜—head™ K™nK™K™Ρ™ Kšœœœ˜Kšœœ œ˜Kšœ œ˜!Kšœ œœ ˜K˜—L™Kšœ œœ˜$šœœœ˜K˜ Kšœ œ˜Kšœ œ˜K˜Kšœœ˜ K˜Kšœ˜K˜Kšœ˜ Kšœ˜K˜—™ K™9K™Kšœ œœ ˜šœ œœ˜Kšœœ˜ KšœœΟc˜+Kšœ#˜#K˜Kšœ˜ K˜—K˜Kšœœœ˜4šœœœ˜'Kšœœ˜Kšœ˜K˜—K˜Kšœœœ˜>šœœœ˜,K˜Kšœ'˜'Kšœ)˜)Kšœ˜K˜Kšœ˜K˜K˜!K˜5K˜)K˜)K˜9Kšœ˜Kšœ˜Kšœ˜K˜K˜K˜K˜K˜K˜)K˜ Kšœ˜K˜——™0K™υK™Kš œœ œœœœ˜IK˜Kšœ œ œœ7˜lK˜Kš œœ œœœ œ˜tK˜Kš œœ œœœœ œ˜uK˜Kšœœ œœœ œ œ"œœ ˜ΤK˜Kšœ œ œœ$œœœœœœ˜½K˜Kšœ œ œœ$œœœœœœ˜»K˜Kšœœ œ+œ˜aK˜Kš œœ œ&œ œ ˜pK˜Kš œœ œ-œœ˜oK˜Kš œœ œ-œœœ˜xK˜Kšœœ œ%œ ˜bK˜Kšœ œ œœ$œœ œœœ ˜ΜK˜Kšœ œœ œ5œœœœ œ˜‡K˜Kšœ œ œ5œœœœœ˜†K˜Kšœ œ œ˜:K˜Kšœ œ œœ!œœœ"œ˜žK˜Kšœœ œœ"œ%œœ œ ˜§K˜Kšœ œ œœœœ)œœœ œ˜K˜Kš œ œ œœœœ6˜ΆK˜šœ œœœ˜4KšœWΟeœ;™™—K˜š œœœœ œ œ˜PK™0K™fK™>—K™š œœ œœœœ˜QK™ψK™—š œœ œœœœ˜MK™K—K˜—™ šžœœ œ˜8K™‘K˜—š œœœœœœœ˜bK™.K™6K™OK™FKšœ œH œI™¦K™Kšœ-™-——™šžœœœœ˜-K™?Kšœ™Kšœ™Kšœ!™!K˜——™K™DK˜Kšžœœœ˜#—™šžœœœœ˜%™K™,K™#KšœD™DK™———K˜—J˜J˜—…—H$K