LookupLock:
PUBLIC
ENTRY
PROC [prefix, nameBody: Rope.
ROPE, version: FSBackdoor.Version]
RETURNS [a: FSLock.ActiveFile] =
BEGIN
hash: CARDINAL;
IF Rope.InlineFetch[nameBody, 0] # '[ AND prefix # NIL
THEN nameBody ← Rope.Concat[prefix, nameBody];
hash ← Hash[nameBody, version];
lookups ← lookups + 1;
FOR a ← lockTbl[hash], a.next
UNTIL a =
NIL
DO
IF version = a.version AND Rope.Equal[nameBody, a.nameBody, FALSE]
THEN RETURN;
ENDLOOP;
newActiveFiles ← newActiveFiles + 1;
a ← NEW [FSLock.ActiveFileObject];
a.nameBody ← nameBody;
a.version ← version;
a.h ← NIL;
a.fileLock ← none;
a.recordLock ← FALSE;
a.fileLockCount ← 0;
a.attachedTo ← NIL;
a.next ← lockTbl[hash];
lockTbl[hash] ← a;
END;
RemoveLock:
PUBLIC
ENTRY
PROC [a: FSLock.ActiveFile] =
BEGIN
hash: CARDINAL = Hash[a.nameBody, a.version];
aPrev: FSLock.ActiveFile ← lockTbl[hash];
removals ← removals + 1;
IF aPrev = a
THEN lockTbl[hash] ← a.next
ELSE
DO
IF aPrev.next = a THEN {aPrev.next ← a.next; EXIT};
aPrev ← aPrev.next;
ENDLOOP;
a.nameBody ← NIL;
END;