Expand description
Removal of a directory tree beneath a held parent handle, never following a link.
What:
Remove a directory tree beneath a held parent directory: every directory is opened by one plain name below the handle of
its parent without following a link, and every entry is unlinked from the handle of the directory that holds it.
Why:
A path string is resolved again by every call that takes it, so a directory replaced by a link between a check and the
removal redirects the removal. Here no call resolves a path: a link, a mount point or a directory on another device is
an error that names it, and the identity of the top directory is compared with the recorded one on the object that is
opened, so a replacement is never emptied. A directory the owner cannot write to is given the owner’s permission bits
through its descriptor on the way down, as subvolume_remove.rs does for the old tree of a conversion.
In TS you’d write (pseudocode):
await removeTreeBeneath({ label, parent, name, expected }); // throws a reason; the entry is left as it is when it is not the expected objectEnums§
- Removal
- What a removal found.
Functions§
- remove_
tree_ beneath - What:
Remove the directory
namebelowparentwith everything in it;labelis the path ofparent, used only in messages. Why: Withexpectedset, the directory is removed only when it is that object: the identity is compared by name before the directory is opened and again on the opened object, so a replacement made between the two is left alone. The top directory must be on the device ofparent. Nothing is followed and nothing outside the directory is touched. An entry that vanishes meanwhile counts as removed. Directories are entered with a work stack, so depth costs no recursion.