From 6b1d5d28be540fb87c4e80c923681efeb564a2d9 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Fri, 14 Jun 2024 00:19:12 +0300 Subject: [PATCH] Kernel: VFS root now has to be block device instead of partition --- kernel/kernel/FS/VirtualFileSystem.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/kernel/FS/VirtualFileSystem.cpp b/kernel/kernel/FS/VirtualFileSystem.cpp index 84f88ef5..d8b22365 100644 --- a/kernel/kernel/FS/VirtualFileSystem.cpp +++ b/kernel/kernel/FS/VirtualFileSystem.cpp @@ -12,18 +12,18 @@ namespace Kernel static BAN::RefPtr s_instance; - void VirtualFileSystem::initialize(BAN::StringView root) + void VirtualFileSystem::initialize(BAN::StringView root_path) { ASSERT(!s_instance); s_instance = MUST(BAN::RefPtr::create()); - ASSERT(root.size() >= 5 && root.substring(0, 5) == "/dev/"sv);; - root = root.substring(5); + ASSERT(root_path.size() >= 5 && root_path.substring(0, 5) == "/dev/"sv);; + root_path = root_path.substring(5); - auto partition_inode = MUST(DevFileSystem::get().root_inode()->find_inode(root)); - if (!partition_inode->is_device() || !static_cast(partition_inode.ptr())->is_partition()) - Kernel::panic("Specified root '/dev/{}' does not name a partition", root); - s_instance->m_root_fs = MUST(FileSystem::from_block_device(static_cast(partition_inode.ptr()))); + auto root_inode = MUST(DevFileSystem::get().root_inode()->find_inode(root_path)); + if (!root_inode->mode().ifblk()) + Kernel::panic("Specified root '/dev/{}' does not name a block device", root_path); + s_instance->m_root_fs = MUST(FileSystem::from_block_device(static_cast(root_inode.ptr()))); Credentials root_creds { 0, 0, 0, 0 }; MUST(s_instance->mount(root_creds, &DevFileSystem::get(), "/dev"sv));