diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-14 22:47:15 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-14 22:47:15 +0800 |
| commit | ac9741e12222e72bad3414bc6f588e70a3d130cc (patch) | |
| tree | 6aace9f63a2ea54c7c3fd1e49e98ff81b638296f /src/fs/fs.cc | |
| parent | 1e862099a13266da57ff7c6de11c1a11c42a8112 (diff) | |
| download | lume-ac9741e12222e72bad3414bc6f588e70a3d130cc.tar.gz lume-ac9741e12222e72bad3414bc6f588e70a3d130cc.tar.xz | |
feat: implement FDT-based memory discovery and add comprehensive debug logging to exec syscalls
Diffstat (limited to 'src/fs/fs.cc')
| -rw-r--r-- | src/fs/fs.cc | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/src/fs/fs.cc b/src/fs/fs.cc index b93f363..fc8f555 100644 --- a/src/fs/fs.cc +++ b/src/fs/fs.cc @@ -7,7 +7,7 @@ #include "drivers/uart.h" #include "kernel/spinlock.h" #include "kernel/proc.h" -#include "fs/fat32.h" +// #include "fs/fat32.h" // Decoupled #include "lib/string.h" static Inode *global_root_inode = nullptr; @@ -53,6 +53,18 @@ void Inode::getattr(struct kstat *st) namespace VFS { + // File System Registry + static FileSystem *filesystems[8]; + static int fs_count = 0; + + void register_fs(FileSystem *fs) + { + if (fs_count < 8) + { + filesystems[fs_count++] = fs; + } + } + void init() { Drivers::uart_puts("[VFS] Inode subsystem initialized.\n"); @@ -138,9 +150,17 @@ namespace VFS { if (global_root_inode == nullptr) { - Drivers::uart_puts("[VFS] Lazy init: Mounting FAT32...\n"); - fat32_fs.init(); - mount_root(fat32_fs.root()); + // Try to mount the first registered FS + if (fs_count > 0) + { + Drivers::uart_puts("[VFS] Lazy init: Mounting root FS...\n"); + filesystems[0]->init(); + mount_root(filesystems[0]->root()); + } + else + { + Drivers::uart_puts("[VFS] No filesystem registered!\n"); + } } if (!global_root_inode) return nullptr; |
