Skip to content

Commit

Permalink
Support locking of directory entries
Browse files Browse the repository at this point in the history
Moves the locking algorithm from file entry to file system entry.

Fixes whatwg#137
  • Loading branch information
Nathan Memmott committed Jul 13, 2023
1 parent 359fc4c commit ecf494d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ To <dfn for="file system entry">take a lock</dfn> with a |value| of

1. Let |lock| be the |entry|'s [=file system entry/lock=].
1. Let |count| be the |entry|'s [=file system entry/shared lock count=].
1. If |entry| is a [=directory entry=]:
1. Let |descendantLockStatus| be the result of [=file system entry/lock/checking for a descendant lock=] on |entry|.
1. If |entry| is a [=directory entry=]:
1. Let |descendantLockStatus| be the result of [=file system entry/checking for a descendant lock=] on |entry|.
1. If |descendantLockStatus| is "`taken`":
1. Return "`failure`".
1. If |value| is "`exclusive`":
Expand All @@ -158,15 +158,15 @@ Note: These steps have to be run on the [=file system queue=].
</div>

<div algorithm>
To <dfn for="file system entry/lock">check for a descendant lock</dfn> on a given
To <dfn for="file system entry">check for a descendant lock</dfn> on a given
[=directory entry=] |directory|:

1. [=set/For each=] |child| of |directory|'s [=directory entry/children=]:
1. Let |lock| be the |child|'s [=file system entry/lock=].
1. If |lock| is not "`open`":
1. Return "`taken`".
1. If |child| is a [=directory entry=]:
1. Let |descendantLockStatus| be the result of [=file system entry/lock/checking for a descendant lock=] on |child|.
1. Let |descendantLockStatus| be the result of [=file system entry/checking for a descendant lock=] on |child|.
1. If |descendantLockStatus| is "`taken`":
1. Return "`taken`".
1. Return "`open`".
Expand Down

0 comments on commit ecf494d

Please sign in to comment.