Skip to main content

Module path

Module path 

Source
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_csum of 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 is NotFound — never the root by accident (#418).
lookup_with_csum
Path → inode lookup with directory-block checksum verification.