Expand description
Path-to-inode resolution.
Walk a slash-separated path — bytes, never decoded — from the root directory (inode 2) down to a target inode number. Used by every public-facing C API function that accepts a path (stat, dir_open, read_file, readlink).
Algorithm: start at EXT4_ROOT_INODE, read its inode, for each non-empty
path component look up the entry by name in the current directory’s data
blocks, then descend into the matching child inode.
An htree-indexed directory is searched through its index first
(htree::lookup_leaf_with), and a name the index does not lead to is
then found by a linear scan, which is always valid because the index is
an acceleration over ordinary directory blocks, not a replacement for
them. Other directories are scanned linearly.
Constants§
- EXT4_
ROOT_ INODE - Root directory inode number (always 2 on every ext[234] filesystem).
Functions§
- lookup
- Resolve a slash-separated path to an inode number.
- lookup_
bytes_ with_ csum lookup_with_csumof a path given as bytes, which is what a path is: the components are compared byte for byte against the directory entry names, which have no encoding. A path that is not UTF-8 names exactly the file whose name bytes it holds, and a path naming nothing isNotFound— never the root by accident (#418).- lookup_
with_ csum - Path → inode lookup with directory-block checksum verification.