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. ΘFSDir.mesa Last Edited by: Schroeder, November 15, 1983 1:19 pm Last Edited by: 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. Κ«– "Cedar" style˜Icode2šœ ™ K™4K™.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šœ˜——…—άO