#include "kernel/filesystem/mount_table.hpp" #include "kernel/filesystem/dentry.hpp" #include "kernel/filesystem/mount.hpp" #include #include namespace filesystem { void mount_table::add_mount(kstd::shared_ptr mount) { m_mounts.push_back(mount); } auto mount_table::get_root_mount() const -> kstd::shared_ptr { 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 & mnt) { return mnt->get_mount_dentry() == dentry; }); return it != m_mounts.end() ? *it : nullptr; } } // namespace filesystem