17 {
18
20 if (!init_result.has_value()) {
21 klog::Err(
"FileSystemInit: vfs::Init failed: {}",
22 init_result.error().message());
23 return;
24 }
25
26
29 if (!mount_result.has_value()) {
30 klog::Err(
"FileSystemInit: failed to mount ramfs at /: {}",
31 mount_result.error().message());
32 return;
33 }
34
35
37 const size_t blk_count = DeviceManagerSingleton::instance().FindDevicesByType(
39
40 if (blk_count > 0 && blk_nodes[0]->block_device != nullptr) {
43 auto fat_mount = fat_fs.Mount(blk);
44 if (!fat_mount.has_value()) {
45 klog::Err(
"FileSystemInit: FatFsFileSystem::Mount failed: {}",
46 fat_mount.error().message());
47 } else {
49 if (!vfs_mount.has_value()) {
50 klog::Err(
"FileSystemInit: vfs mount at /mnt/fat failed: {}",
51 vfs_mount.error().message());
52 } else {
53 klog::Info(
"FileSystemInit: FatFS mounted at /mnt/fat (device: {})",
54 blk->GetName());
55 }
56 }
57 }
58
60}
auto Mount(vfs::BlockDevice *device) -> Expected< vfs::Inode * > override
挂载 ramfs
static constexpr uint8_t kRootFsDriveId
FatFS 逻辑驱动器号(对应 rootfs.img)
auto Err(etl::format_string< Args... > fmt, Args &&... args) -> void
以 ERROR 级别记录日志
auto Info(etl::format_string< Args... > fmt, Args &&... args) -> void
以 INFO 级别记录日志
auto GetMountTable() -> MountTable &
获取全局挂载表实例
auto Init() -> Expected< void >
VFS 全局初始化
vfs::BlockDevice * block_device