DIRECTORY Basics USING [Comparison], BasicTime USING [GMT], BTree USING [Entry, EntSize, Key, UpdateType], File USING [FP], FSBackdoor USING [EntryPtr, EntryType, Version], FSFileOps USING [VolumeDesc], FSLock USING [ActiveFile], Rope USING [Text]; FSDir: CEDAR DEFINITIONS = BEGIN VersionMatching: TYPE = {all, bangHOnly, bangLOnly}; EnumerateEntries: PROCEDURE [vDesc: FSFileOps.VolumeDesc, start: Rope.Text _ NIL, versions: VersionMatching _ all, matchProc: UNSAFE PROC [entry: FSBackdoor.EntryPtr] RETURNS [accept, stop: BOOLEAN], acceptProc: PROC RETURNS [stop: BOOLEAN]]; AcquireOldFName: PROC [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, wantedVersion: FSBackdoor.Version, wantedTime: BasicTime.GMT] RETURNS [type: FSBackdoor.EntryType, version: FSBackdoor.Version, keep: CARDINAL, fp: File.FP, time: BasicTime.GMT, attachedTo: Rope.Text, a: FSLock.ActiveFile]; AcquireNextLName: PROC [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, newKeep: CARDINAL _ 0] RETURNS [a: FSLock.ActiveFile, keep: CARDINAL, fp: File.FP]; DoKeeps: PROC [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text]; AcquireOldGName: PROC [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, wantedVersion: FSBackdoor.Version] RETURNS [type: FSBackdoor.EntryType, time: BasicTime.GMT, fp: File.FP, a: FSLock.ActiveFile]; AcquireOldOrNewGName: PROC [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, wantedVersion: FSBackdoor.Version] RETURNS [fp: File.FP, a: FSLock.ActiveFile]; UpdateLocalEntry: PROCEDURE [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, version: FSBackdoor.Version, keep: CARDINAL, fp: File.FP, update: BTree.UpdateType]; UpdateCachedEntry: PROCEDURE [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, version: FSBackdoor.Version, used: BasicTime.GMT, fp: File.FP, update: BTree.UpdateType]; UpdateAttachedEntry: PROCEDURE [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, version: FSBackdoor.Version, keep: CARDINAL, created: BasicTime.GMT, attachedTo: Rope.Text, update: BTree.UpdateType]; DeleteEntry: PROCEDURE [vDesc: FSFileOps.VolumeDesc, nameBody: Rope.Text, version: FSBackdoor.Version]; Compare: UNSAFE PROC [key: BTree.Key, entry: BTree.Entry] RETURNS [Basics.Comparison]; EntrySize: UNSAFE PROC [entry: BTree.Entry] RETURNS [words: BTree.EntSize]; END. ZFSDir.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Last Edited by: Bob Hagmann February 4, 1985 9:44:11 am PST Schroeder, November 15, 1983 1:19 pm Levin, August 9, 1983 11:22 am Enumerates the directory/cache, starting from the name prefix "start", in increasing order. "matchProc" is called for the versions of each entry as selected by "versions". If ""stop" is returned as TRUE then the enumeration terminates. Otherwise, if "accept" is returned as TRUE then "acceptProc" is called. The "acceptProc" can also stop the enumeration. The dir/cache is read locked while "matchProc" is called, but not while "acceptProc" is called. Looks-up an old entry in the directory/cache BTree and sets its record lock. Will do a created-time search if "wantedTime" is not BasicTime.nullGMT, treating the version as a hint. Any waiting is done before the return. When "type" does not return "notFound" then "a" is valid. If a local entry is found then the "version", "keep" and "fp" are meaningful. If an attached entry is found then the "version", "keep", "time" (created-time), and "attachedTo" are meaningful. If a cached entry is found then the "version", "time" (used-Time) and "fp" are meaningful. Sets the record lock on the !N version of "nameBody". Use only for LNames. Any waiting is done before the return. Any existing version of "nameBody" that are beyond the "keep" are deleted. If "newKeep" is 0 then the keep on the highest existing version is in control; otherwise "newKeep" is used. If one of the deleted entries contains an File.FP suitable for reuse, then it is returned as "fp" (which otherwise is File.nullFP). The client should either reuse the file or destroy it. If "a.version" is # 1, then "keep" is the new controlling keep. Does the keep processing for the given LName. Any unopen files beyond the keep for the highest version will be deleted. Tries to set the record lock on the indicated version of "nameBody". Use only on GNames. No created-time searching is done. Never waits. It is intended for use in locking GNames when considering flushing them to make space on the volume. Returns "type" = "notFound" if the GName was missing from the cache. Returns "a" = NIL if the record lock could not be set. Generate ERROR if a local or an attached entry is found. Sets the record lock on the indicated version of "nameBody", whether or not it already exists. Use only on GNames. No created-time searching is done. Any waiting is done before the return. It is intended for use in locking GNames prior to retrieval of the remote file. Possible results are: "fp" is File.nullFP and "a.h" is NIL => "wantedVersion" is not in the cache, so must be retrieved; a "name" lock is set and "a.h" must be filled in. "fp" is valid and "a.h" is NIL => "wantedVersion" is in the cache, so need not be retrieved; a "name" lock is set and "a.h" must be filled in. "fp" is valid and "a.h" is NOT NIL => "wantedVersion" is in the cache, so need not be retrieved; a "read" lock is set and "a.h" is already filled-in; client should verify that the created time of the file is as expected before finishing opening it. Procedures to update the directory/cache BTree. Creates/updates an entry for a local file to the directory BTree. Will generate BTree.Error[wrongUpdateType] if the "BTree.UpdateType" cannot be realized. Creates/updates an entry for a cached global file to the directory BTree. Will generate BTree.Error[wrongUpdateType] if the "BTree.UpdateType" cannot be realized. Creates/updates an entry for an attached LName file to the directory BTree. Will generate BTree.Error[wrongUpdateType] if the "BTree.UpdateType" cannot be realized. Removes an entry from the directory BTree. For use with the BTree package. Matches requirements of a BTree.Compare proc. Matches requirements of a BTree.EntrySize proc. Bob Hagmann February 4, 1985 9:43:46 am PST Copyright ΚΣ– "Cedar" style˜code2šœ ™ Kšœ Οmœ1™<—™J™+J™$J™—code1šΟk ˜ Lšœžœ˜Lšœ žœžœ˜Lšœžœ#˜.Lšœžœžœ˜Lšœ žœ ˜0Lšœ žœ˜Lšœžœ˜Lšœžœ˜—šœžœž œž˜ Kšœžœ˜4šΟnœž œ2žœ.ž œžœžœžœžœžœ˜ςKšœΘžœIžœ―™Θ—šŸœžœmžœžœAžœ žœžœ/˜¨Kšœέ™έKšœΧ™Χ—š Ÿœžœ=žœžœžœ žœ˜KšœžœΏžœΛ™ͺ—šŸœžœ4˜AK™x—š ŸœžœWžœ.žœ žœ˜ΙKšœΗžœ0žœ*™©—šŸœžœWžœ žœ˜šœ§™§Kšœ!žœp™”Kšœžœq™KšœžœžœΧ™ω———™/šŸœž œWžœ žœ˜£Kšœ›™›—šŸœž œažœ žœ˜©Kšœ£™£—šŸœž œWžœžœ3˜ΘKšœ₯™₯—šŸ œž œQ˜gK™*——™šŸœžœžœ&žœ˜VK™-—šŸ œžœžœžœ˜KKšœ/™/—Kšžœ˜—J˜™+Jšœ ™ J™—J™—…—ή