Hacker News new | past | comments | ask | show | jobs | submit login
Linux Technical Debt: A Visual Explanation (Directory Entries/struct dirent) (youtube.com)
5 points by jodybruchon 11 months ago | hide | past | favorite | 2 comments



Isn't struct dirent what the original UFS (Unix file system from like v3 or even earlier) had as contents of directory files? And yes, directories were files with a special bit set in permissions in UFS and BSD's FFS.

I'm virtually certain that exposing that on disk struct to users had so much legacy code that struct dirent was just not worth updating when the capability of using multiple file systems got added to various kernels. We're stuck with it, an accident of history, just like we're stuck with FAT filesystems for boot partitions and similar.


POSIX and SUS both define only d_ino and d_name in struct dirent, so there's not really any legacy left. Everything beyond those two values is an extension by the implementation. I'm arguing that the implementation in Linux is fundamentally poor. They've actually changed the API for this in the past when they switched system calls from readdir to getdents.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: