Directory
A directory is a filesystem object whose entries associate names with files, including other directories.
Names: A directory organizes names, not the contents of every file reached through those names. Linux VFS represents directories with inode objects. Several names can reach the same file through hard links; a name is not a separate data copy. [1]
Identity: The directory, an entry within it and a Linux dentry are different objects. A dentry caches pathname-lookup information in RAM; it is not a stored directory record. The backing filesystem determines how directory information is represented. [1]
Access: POSIX.1-2017 opendir() requires search access through the path prefix and read access to the directory being listed. Linux uses the directory execute permission bit for search. Listing names and resolving a known name are distinct operations; neither alone grants permission to read the target file. [2] [3]
Observation: Successive readdir() calls do not promise a point-in-time inventory. POSIX.1-2017 leaves unspecified whether entries added or removed after opendir() or rewinddir() appear in subsequent results. A consistent inventory therefore needs a separately established snapshot or coordination contract. [4]
Relations
- related
- Inode, Dentry, Path resolution, Directory enumeration, Link count, Setgid directory, Sticky bit, Directory search permission
Limitations
- A filesystem directory is not the same abstraction as an object-store key prefix.
- A completed directory scan does not establish crash persistence or backup completeness.
Citations
- Linux 6.12: VFS directory, inode and dentry objects
- POSIX.1-2017: opendir, search permission and directory read permission
- Linux man-pages: path_resolution(7), search and target access
- POSIX.1-2017: readdir and concurrent additions or removals
Sources & caveats
- Primary-source synthesis of Linux 6.12 VFS, Linux path-resolution documentation and the explicitly labeled POSIX.1-2017 manual reproduction. No directory, permission or crash experiment was performed.
- The consistent-inventory guidance is an engineering inference from the stated API limitation, not an extra POSIX requirement.
- Human context: https://hesela.com/analyses/atomic-rename-directory-durability/#directory-foundation