Master the fundamental concepts of file systems through this focused micro-challenge.
An in-memory filesystem models paths as a tree of struct inode nodes: directories point to children, files hold data blocks or inline buffers. No disk means you focus on naming, permissions, and lookup without driver noise.
Each inode stores:
For example, path /etc/hosts walks root → etc dir inode → hosts file inode.
The inode/dentry split you build here is the same design Linux's VFS layer uses for every real filesystem, and it's exactly how tmpfs (the filesystem behind /tmp and /dev/shm) organizes files entirely in RAM. Get path resolution wrong and you reproduce real VFS bugs , like directory loops or dangling dentries , that have caused kernel panics in production.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will implement lookup, create, read, and write on the tree API. This exercise requires enforcing that unlinking a directory with children fails, matching POSIX expectations.
Implement in-memory filesystem with inode tree structure.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github