From 00aa2c8695b81944798010d81d600038e1f1ef3d Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Sun, 10 May 2026 19:08:07 +0200 Subject: remove mount_path from mount struct (retrieve path from m_mount_dentry) --- kernel/include/kernel/filesystem/mount.hpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/mount.hpp b/kernel/include/kernel/filesystem/mount.hpp index 72855a0..102f660 100644 --- a/kernel/include/kernel/filesystem/mount.hpp +++ b/kernel/include/kernel/filesystem/mount.hpp @@ -7,8 +7,6 @@ #include #include -#include - namespace kernel::filesystem { /** @@ -27,8 +25,7 @@ namespace kernel::filesystem @param parent_mount The parent mount that this mount is attached beneath. */ mount(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & root_dentry, - kstd::shared_ptr const & fs, std::string_view mount_path, - kstd::shared_ptr const & parent_mount); + kstd::shared_ptr const & fs, kstd::shared_ptr const & parent_mount); /** @brief Get the dentry where the filesystem is mounted. @@ -48,7 +45,7 @@ namespace kernel::filesystem /** @brief Get the path at which the filesystem is mounted. */ - [[nodiscard]] auto get_mount_path() const -> std::string_view; + [[nodiscard]] auto get_mount_path() const -> kstd::string; /** @brief Get the parent mount that this mount was attached beneath. @@ -56,7 +53,6 @@ namespace kernel::filesystem [[nodiscard]] auto get_parent_mount() const -> kstd::shared_ptr const &; private: - kstd::string m_mount_path; kstd::shared_ptr m_mount_dentry; kstd::shared_ptr m_root_dentry; kstd::shared_ptr m_filesystem{}; -- cgit v1.2.3 From feab4cd81f2bbc89e55353a54df2575b9c21b514 Mon Sep 17 00:00:00 2001 From: Marcel Braun Date: Sun, 10 May 2026 20:07:51 +0200 Subject: Add method that returns the next ancestor with mount flag set --- kernel/include/kernel/filesystem/dentry.hpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/dentry.hpp b/kernel/include/kernel/filesystem/dentry.hpp index 226f2b9..1d99a25 100644 --- a/kernel/include/kernel/filesystem/dentry.hpp +++ b/kernel/include/kernel/filesystem/dentry.hpp @@ -60,6 +60,12 @@ namespace kernel::filesystem */ [[nodiscard]] auto get_absolute_path() const -> kstd::string; + /** + @brief traverse parent dentries until dentry with mount flag is found. + @return The found dentry. + */ + [[nodiscard]] auto get_ancestor_with_mount_flag() const -> kstd::shared_ptr; + /** @brief Add a @p child dentry. @param child The child dentry to add. -- cgit v1.2.3 From 85fd2e3b4da7d84a9357b35bde740b780fe0cb72 Mon Sep 17 00:00:00 2001 From: Marcel Braun Date: Sun, 10 May 2026 21:49:20 +0200 Subject: Rename root_dentry() to get_root_dentry() --- kernel/include/kernel/filesystem/mount.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/mount.hpp b/kernel/include/kernel/filesystem/mount.hpp index 102f660..af5d08b 100644 --- a/kernel/include/kernel/filesystem/mount.hpp +++ b/kernel/include/kernel/filesystem/mount.hpp @@ -35,7 +35,7 @@ namespace kernel::filesystem /** @brief Get the root dentry of the mounted filesystem. */ - [[nodiscard]] auto root_dentry() const -> kstd::shared_ptr const &; + [[nodiscard]] auto get_root_dentry() const -> kstd::shared_ptr const &; /** @brief Get the filesystem instance being mounted. -- cgit v1.2.3 From 763227e31adf924a5dfe3139db158e26162294a0 Mon Sep 17 00:00:00 2001 From: Marcel Braun Date: Sun, 10 May 2026 21:58:54 +0200 Subject: Remove find_longest_prefix_mount --- kernel/include/kernel/filesystem/mount_table.hpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/mount_table.hpp b/kernel/include/kernel/filesystem/mount_table.hpp index 8e57d9e..59b9503 100644 --- a/kernel/include/kernel/filesystem/mount_table.hpp +++ b/kernel/include/kernel/filesystem/mount_table.hpp @@ -38,13 +38,6 @@ namespace kernel::filesystem */ [[nodiscard]] auto remove_mount(std::string_view path) -> operation_result; - /** - @brief Finds the mount with the longest prefix matching the given @p path. - @param path The path to match against the mount paths in the table. - @return A pointer to the mount with the longest matching prefix, or a null pointer if no mount matches the path. - */ - [[nodiscard]] auto find_longest_prefix_mount(std::string_view path) const -> kstd::shared_ptr; - /** @brief Finds the mount with the exact mount path matching the given @p path. @param path The path to match against the mount paths in the table. -- cgit v1.2.3 From 5d72c256d4e2b8a9d2fd70e5a27e883a0f733e50 Mon Sep 17 00:00:00 2001 From: Marcel Braun Date: Mon, 11 May 2026 20:48:03 +0200 Subject: Add is_mount_root flag to dentry and use in find_mount_root_dentry --- kernel/include/kernel/filesystem/dentry.hpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'kernel/include') diff --git a/kernel/include/kernel/filesystem/dentry.hpp b/kernel/include/kernel/filesystem/dentry.hpp index 1d99a25..7eef693 100644 --- a/kernel/include/kernel/filesystem/dentry.hpp +++ b/kernel/include/kernel/filesystem/dentry.hpp @@ -24,7 +24,8 @@ namespace kernel::filesystem */ enum class dentry_flags : uint32_t { - mounted = 1 << 15 + is_mount_point = 1 << 0, + is_mount_root = 1 << 1, }; /** @@ -61,10 +62,10 @@ namespace kernel::filesystem [[nodiscard]] auto get_absolute_path() const -> kstd::string; /** - @brief traverse parent dentries until dentry with mount flag is found. + @brief traverse parent dentries until dentry with is_mount_root flag is found. @return The found dentry. */ - [[nodiscard]] auto get_ancestor_with_mount_flag() const -> kstd::shared_ptr; + [[nodiscard]] auto find_mount_root_dentry() const -> kstd::shared_ptr; /** @brief Add a @p child dentry. -- cgit v1.2.3