A directory is a list of inodes and file names. When a directory is created by creating its inode (in inode_open_or_create()
), the kernel will create two entries: .
with the same inode as the new dir and ..
with the inode of the parent dir.
Related syscalls:
- Create dir: mkdir (app mkdir)
- Get statistics: fstat (app stat)
- Get directory entries: get_dirent (app ls)
- Delete dir: rmdir (app rmdir)
Loosely related:
Overview: kernel | file_system
File System: init_filesystem | vfs | xv6fs | devfs | block_io | inode | file | directory