MCPcopy Create free account
hub / github.com/Bananymous/banan-os / load_fallback_root_filesystem

Function load_fallback_root_filesystem

kernel/kernel/FS/VirtualFileSystem.cpp:55–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55 static BAN::RefPtr<FileSystem> load_fallback_root_filesystem()
56 {
57 if (g_boot_info.modules.empty())
58 panic("No fallback boot modules given");
59
60 auto filesystem_or_error = TmpFileSystem::create(-1, 0755, 0, 0);
61 if (filesystem_or_error.is_error())
62 panic("Failed to create fallback filesystem: {}", filesystem_or_error.error());
63
64 dprintln("Trying to load fallback filesystem from {} modules", g_boot_info.modules.size());
65
66 auto filesystem = BAN::RefPtr<FileSystem>::adopt(filesystem_or_error.release_value());
67
68 bool loaded_initrd = false;
69 for (const auto& module : g_boot_info.modules)
70 {
71 if (auto ret = unpack_boot_module_into_directory(filesystem->root_inode(), module); ret.is_error())
72 dwarnln("Failed to unpack boot module: {}", ret.error());
73 else
74 loaded_initrd |= ret.value();
75 }
76
77 if (!loaded_initrd)
78 panic("Could not load initrd from any boot module :(");
79
80 return filesystem;
81 }
82
83 static BAN::RefPtr<FileSystem> load_root_filesystem(BAN::StringView root_path)
84 {

Callers 1

load_root_filesystemFunction · 0.85

Calls 8

errorMethod · 0.80
emptyMethod · 0.45
is_errorMethod · 0.45
sizeMethod · 0.45
release_valueMethod · 0.45
root_inodeMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected