boredos_mirror/docs/architecture/filesystem.md

2.2 KiB

Filesystem Architecture

Virtual File System layer and FAT32 abstraction in BoredOS.


BoredOS implements a rudimentary but functional filesystem layer designed to support reading system assets and user applications during runtime.

🗂️ Virtual File System (VFS)

The Virtual File System acts as an abstraction layer across different underlying storage mechanisms (even if, currently, only one type is fully utilized). System calls targeting files (SYS_FS) route through the VFS rather than interacting with the disk directly.

Key VFS functionalities include:

  • File Descriptors: Mapping integer IDs to internal file structures for userland processes.
  • Standard Operations: Standardizing open(), read(), write(), close(), seek(), and directory listings.
  • Path Parsing: Resolving absolute and relative paths.
  • SMP Safety: All VFS and underlying FAT32 operations are protected by a global Spinlock. This ensures that multiple cores can safely read from the filesystem simultaneously without corrupting internal file seek pointers or directory cache states.

💾 FAT32 Implementation

The primary filesystem logic in fat32.c is currently built as a RAM-based filesystem simulation.

💿 Booting and the RAMFS

Since BoredOS boots from a CD-ROM ISO image generated by xorriso, it does not read directly off the CD to execute applications.

  1. ISO Booting: During boot, Limine loads necessary files (such as userland .elf binaries, fonts, and wallpapers) into memory as standard boot modules.
  2. RAM Simulation: The FAT32 filesystem code parses these loaded memory modules and automatically constructs a synthetic FAT32 directory tree inside RAM.
  3. Root Filesystem: All active execution of built-in GUI and CLI apps occurs off this read-only, in-memory FAT32 simulation.

Warning

Limitations: The current fat32.c implementation in BoredOS is strictly a RAM-based filesystem simulation. It does not support reading from actual block devices (real disks). Consequently, external disk images are not recognized, and any operations requiring persistent storage are unsupported.