From b742349ba039d1a864462332bb7ae5a071afdec1 Mon Sep 17 00:00:00 2001 From: "marcel.braun" Date: Tue, 24 Mar 2026 16:53:21 +0100 Subject: Refactor mount_table entry (mount) to use dentry as key instead of path --- kernel/include/kernel/filesystem/mount.hpp | 9 ++++----- kernel/src/filesystem/mount.cpp | 9 +++++---- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'kernel') diff --git a/kernel/include/kernel/filesystem/mount.hpp b/kernel/include/kernel/filesystem/mount.hpp index 232a9be..dd47ce7 100644 --- a/kernel/include/kernel/filesystem/mount.hpp +++ b/kernel/include/kernel/filesystem/mount.hpp @@ -1,23 +1,22 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_MOUNT_HPP #define TEACH_OS_KERNEL_FILESYSTEM_MOUNT_HPP +#include "kernel/filesystem/dentry.hpp" #include "kernel/filesystem/filesystem.hpp" #include -#include - namespace filesystem { struct mount { - mount(std::string_view const & path, kstd::shared_ptr const & fs); + mount(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs); - [[nodiscard]] auto path() const -> std::string_view; + [[nodiscard]] auto get_dentry() const -> kstd::shared_ptr; [[nodiscard]] auto get_filesystem() const -> kstd::shared_ptr const &; private: - std::string_view m_path; + kstd::shared_ptr m_dentry; kstd::shared_ptr m_filesystem{}; }; } // namespace filesystem diff --git a/kernel/src/filesystem/mount.cpp b/kernel/src/filesystem/mount.cpp index a2c501f..b65f331 100644 --- a/kernel/src/filesystem/mount.cpp +++ b/kernel/src/filesystem/mount.cpp @@ -2,6 +2,7 @@ #include "kapi/system.hpp" +#include "kernel/filesystem/dentry.hpp" #include "kernel/filesystem/filesystem.hpp" #include @@ -10,8 +11,8 @@ namespace filesystem { - mount::mount(std::string_view const & path, kstd::shared_ptr const & fs) - : m_path(path) + mount::mount(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs) + : m_dentry(mount_dentry) , m_filesystem(fs) { if (!m_filesystem) @@ -20,9 +21,9 @@ namespace filesystem } } - auto mount::path() const -> std::string_view + auto mount::get_dentry() const -> kstd::shared_ptr { - return m_path; + return m_dentry; } auto mount::get_filesystem() const -> kstd::shared_ptr const & -- cgit v1.2.3