From 84d4476650b31dbfc52becf2ff65ddce9d31c9ec Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Tue, 24 Mar 2026 23:54:28 +0100 Subject: implement a rootfs to handle / mounts correctly --- kernel/src/filesystem/mount_table.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'kernel/src/filesystem/mount_table.cpp') diff --git a/kernel/src/filesystem/mount_table.cpp b/kernel/src/filesystem/mount_table.cpp index debb9ab..681c2b9 100644 --- a/kernel/src/filesystem/mount_table.cpp +++ b/kernel/src/filesystem/mount_table.cpp @@ -1,7 +1,5 @@ #include "kernel/filesystem/mount_table.hpp" -#include "kapi/system.hpp" - #include "kernel/filesystem/dentry.hpp" #include "kernel/filesystem/mount.hpp" @@ -18,18 +16,14 @@ namespace filesystem auto mount_table::get_root_mount() const -> kstd::shared_ptr { - auto it = - std::ranges::find_if(m_mounts, [](auto const & mount) { return mount->get_dentry()->get_parent() == nullptr; }); + auto it = std::ranges::find_if(m_mounts, [](auto const & mount) { return mount->get_mount_dentry() == nullptr; }); return it != m_mounts.end() ? *it : nullptr; } auto mount_table::find_mount_by_dentry(kstd::shared_ptr const & dentry) -> kstd::shared_ptr { - auto it = std::ranges::find_if(m_mounts, [&](auto const & mount) { return mount->get_dentry() == dentry; }); - if (it != m_mounts.end()) - { - return *it; - } - kapi::system::panic("[FILESYSTEM] dentry has mount flag set but no corresponding mount found."); + auto it = std::ranges::find_if(m_mounts, [&](auto const & mnt) { return mnt->get_mount_dentry() == dentry; }); + + return it != m_mounts.end() ? *it : nullptr; } } // namespace filesystem \ No newline at end of file -- cgit v1.2.3