VUXFiles.mesa
Copyright Ó 1989, 1991 by Xerox Corporation. All rights reserved.
Carl Hauser, September 20, 1989 9:53:42 am PDT
Chauser, October 30, 1990 9:42 am PST
Willie-s, August 21, 1991 11:25 am PDT
DIRECTORY
BasicTime USING [GMT],
CStrings USING [CString],
Rope USING [ROPE, Text],
PFSNames USING [PATH, Version],
UnixErrno,
UnixTypes USING [Mode, RES, Stat]
;
VUXFiles: CEDAR DEFINITIONS
~ BEGIN
Copied Types
GMT: TYPE ~ BasicTime.GMT;
ROPE: TYPE ~ Rope.ROPE;
Stat: TYPE ~ UnixTypes.Stat;
RES: TYPE ~ UnixTypes.RES;
Errno: TYPE ~ UnixErrno.Errno;
Mode: TYPE ~ UnixTypes.Mode;
PATH: TYPE ~ PFSNames.PATH;
CString: TYPE ~ CStrings.CString;
Errors
NotDirectory: ERROR [];
CantCreate: ERROR [errno: UnixErrno.Errno];
CantStat: ERROR [errno: UnixErrno.Errno];
Local Types
FHandle: PRIVATE TYPE = ROPE;
DirHandle: TYPE ~ REF DirObject;
DirObject: TYPE ~ RECORD [
parent, child, sibling: DirHandle,
nameComponent: ROPE, -- u/l case exactly as on server
fHandle: FHandle,
createMode: Mode, -- default access mode for files created in this directory
createModeTTL: CARDINAL,
ownerUID: CARD, -- owner of directory itself, refreshed with directory content
ownerGID: CARD, -- group of directory itself, refreshed with directory content
mode: Mode, -- protection mode of directory itself, refreshed with directory content
content: DirEntries,
contentMTime: CARD,
contentTTL: CARDINAL,
contentKnownStale: BOOL,
contentLocked: BOOL,
contentAvailable: CONDITION,
contentGenStarted: INT ¬ 0,
contentGenFinished: INT ¬ 0,
useCount: CARDINAL,
ttl: CARDINAL
];
DirEntries: TYPE ~ REF DirEntriesObject;
DirEntriesObject: PUBLIC TYPE ~ RECORD [
leftNode: DirNode
];
DirNode: TYPE ~ REF DirNodeObject;
DirNodeObject: TYPE ~ RECORD [
entry: DirEntry,
nextPhysical: DirNode ¬ NIL,
link: SEQUENCE height: CARDINAL OF DirNode
];
DirEntry: TYPE ~ RECORD [
nameWithoutVersion: ROPE,
version: Version,
caseOK: BOOL,
generation: INT ¬ 0, -- not a valid generation number
unixName: Rope.Text
];
DirOpRes: TYPE = RECORD [
status: Errno,
file: FHandle, -- valid only if status = ok
attributes: Stat -- valid only if status = ok
];
Version: TYPE ~ PFSNames.Version;
FixModeForRegularFile: PROC [mode: Mode] RETURNS [Mode];
FixModeForDirectory: PROC [mode: Mode] RETURNS [Mode];
GetModeAccessBits: PROC [mode: Mode] RETURNS [Mode];
UpdateModeAccessBits: PROC [mode: Mode, newAccessBits: Mode] RETURNS [Mode];
InsertDirChild: PROC [dH: DirHandle, childName: ROPE, fHandle: FHandle] RETURNS [dHChild: DirHandle];
PinDirPath: PROC [dH: DirHandle];
UnPinDir: PROC [dH: DirHandle]
RETURNS [dHParent: DirHandle];
UnPinDirPath: PROC [dH: DirHandle];
GetDirRoot: PROC []
RETURNS
[dH: DirHandle];
CreateSubdirectory: PROC [dH: DirHandle, name: ROPE, desiredMode: Mode] RETURNS [fH: FHandle];
CreateCaseFile: PROC [dh: DirHandle, name: ROPE];
EachDirEntryProc: TYPE ~ PROC [entry: DirEntry] RETURNS [continue: BOOL ¬ TRUE];
EnumerateDirectory: PROC [dH: DirHandle, eachDirEntry: EachDirEntryProc, lowNameWithoutVersion: ROPE, staleOK: BOOL];
File Create Modes
GetCreateMode: PROC [dH: DirHandle, forDirectory: BOOL]
RETURNS [createMode: Mode];
Follow Paths
FollowDirPath: PROC [path: PATH, case: BOOL, create: BOOL] RETURNS [dH: DirHandle ¬ NIL];
GetDirChild: PROC [dH: DirHandle, childName: ROPE, create: BOOL]
RETURNS
[dHChild: DirHandle, created: BOOL ¬ FALSE];
SweepDirCache: PROC [root: DirHandle, seconds: CARD];
Lookup: PROC [dH: DirHandle, name: ROPE] RETURNS [dirOpRes: DirOpRes, attachedTo: PATH];
Utility
GetDirComponent: PROC [path: PATH, pos: INT, smashCase: BOOL] RETURNS [ROPE];
END.