Master the fundamental concepts of file systems through this focused micro-challenge.
FAT12 is the classic DOS floppy format: boot sector, FAT tables, root directory, then data region. The BIOS loads the boot sector; your reader parses BPB fields to locate FAT and root dir.
From boot sector:
512For example, a 1.44 MB floppy has 224 root directory slots and 9 sectors per FAT copy.
FAT12 is the exact filesystem GRUB's stage-1 bootloader and real 1.44MB floppy images use, and its FAT-chain design is the direct ancestor of the FAT32 still mandated for every UEFI system partition today. Get the 12-bit packing math wrong (two entries jammed into three bytes) and you silently follow a corrupted cluster chain into someone else's file data.
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 parse the BPB, walk the FAT chain, and read a root directory entry. This exercise requires converting 8.3 filenames to a readable string and following 0xFFF end-of-chain markers.
Implement FAT12 reader.
Requirements:
Test:
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