-
-
Notifications
You must be signed in to change notification settings - Fork 4
Filesystem
Layered VFS over ramdisk, EXT2, generated pseudo-filesystems (/proc), and special device nodes (/dev). POSIX-like API with 128-node pool + free-list.
See also: Drivers, Shell, GUI Subsystem, Architecture
Unified namespace with node pool (128 nodes + free-list for transient mount-backed nodes). Path resolution relative to CWD.
-
vfs_open/read/write/close— file I/O -
vfs_pread/pwrite— offset-aware I/O (used by the per-fd offset tracker and by mmap) -
vfs_readdir— directory listing (ramdisk, EXT2, and now /proc per-pid dirs) -
vfs_mkdir/vfs_unlink— directory creation and removal -
vfs_getcwd/vfs_chdir— directory navigation (full absolute path) -
vfs_isdir— directory test (used bychdir) - Per-terminal CWD (each shell tracks its own directory; kernel shell uses a single global)
Default filesystem from CPIO initramfs. Default tree:
/ bin/ dev/ etc/ home/user/ mnt/ proc/ root/ tmp/ usr/ var/
CPIO newc format (070701) embedded as C byte array. Generated by tools/mkinitramfs.py. Loaded at boot — creates all files and directories in the VFS ramdisk tree.
Real VFS nodes whose read/write is intercepted by a dev_type field (no new syscalls):
-
/dev/null— reads return EOF (0), writes are discarded -
/dev/zero— reads return endless null bytes -
/dev/randomand/dev/urandom— reads yield pseudo-random bytes from a lazily-seeded xorshift64 PRNG (seeded fromget_ticks()) - Created at boot in
vfs_initviaO_CREAT+ manualdev_typeassignment
Generated VFS nodes whose content is synthesized on read by proc_generate() (no storage in ino->data):
-
Static files:
/proc/version(kernel banner),/proc/meminfo(MemTotal/Used/Free),/proc/uptime(tick_count → seconds),/proc/cpuinfo -
Per-process dirs:
/proc/<pid>/status(Name, Pid, PPid, State) and/proc/<pid>/cmdline(command-line with argv) - Synchronised with the live process table by
proc_sync(), called atvfs_open/vfs_isdir— no new syscalls, everything is plainopen/read/getdents
Read/write EXT2 driver via ATA PIO:
- Superblock, block groups, inode tables, directory entries
- Inode/block allocation, directory creation, file writes
- Mount at
/mntviavfs_mount - Fd-based I/O flushes to disk on close (persistent across reboot)
- Fd-based readdir (
vfs_readdiron/mnt)
PIO mode, primary channel 0x1F0, IRQ 14, 28-bit LBA (up to 128 GB), polled I/O.
Contact: uselessalter on Discord | nyxos@inbox.lv | GitHub