aboutsummaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorLukas Oesch <lukas.oesch@ost.ch>2026-05-12 08:58:18 +0200
committerLukas Oesch <lukas.oesch@ost.ch>2026-05-12 08:58:18 +0200
commitfee33c0b2e2ab91a008bec16e143fba755b51974 (patch)
tree4a88dfc1c2fbab3ce7d670e4289bdaa5df77352d /kernel/include
parent5853b580c74411ecf196d241449411e0d01f0532 (diff)
parentac5213633721fcf0e72da814d7ef70c51090c3f9 (diff)
downloadkernel-fee33c0b2e2ab91a008bec16e143fba755b51974.tar.xz
kernel-fee33c0b2e2ab91a008bec16e143fba755b51974.zip
Merge branch 'refactoring' into 'develop-BA-FS26'
Refactoring See merge request teachos/kernel!32
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/kernel/filesystem/dentry.hpp9
-rw-r--r--kernel/include/kernel/filesystem/mount.hpp10
-rw-r--r--kernel/include/kernel/filesystem/mount_table.hpp7
3 files changed, 11 insertions, 15 deletions
diff --git a/kernel/include/kernel/filesystem/dentry.hpp b/kernel/include/kernel/filesystem/dentry.hpp
index 226f2b9..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,6 +62,12 @@ namespace kernel::filesystem
[[nodiscard]] auto get_absolute_path() const -> kstd::string;
/**
+ @brief traverse parent dentries until dentry with is_mount_root flag is found.
+ @return The found dentry.
+ */
+ [[nodiscard]] auto find_mount_root_dentry() const -> kstd::shared_ptr<dentry>;
+
+ /**
@brief Add a @p child dentry.
@param child The child dentry to add.
*/
diff --git a/kernel/include/kernel/filesystem/mount.hpp b/kernel/include/kernel/filesystem/mount.hpp
index 72855a0..af5d08b 100644
--- a/kernel/include/kernel/filesystem/mount.hpp
+++ b/kernel/include/kernel/filesystem/mount.hpp
@@ -7,8 +7,6 @@
#include <kstd/memory>
#include <kstd/string>
-#include <string_view>
-
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<dentry> const & mount_dentry, kstd::shared_ptr<dentry> const & root_dentry,
- kstd::shared_ptr<filesystem> const & fs, std::string_view mount_path,
- kstd::shared_ptr<mount> const & parent_mount);
+ kstd::shared_ptr<filesystem> const & fs, kstd::shared_ptr<mount> const & parent_mount);
/**
@brief Get the dentry where the filesystem is mounted.
@@ -38,7 +35,7 @@ namespace kernel::filesystem
/**
@brief Get the root dentry of the mounted filesystem.
*/
- [[nodiscard]] auto root_dentry() const -> kstd::shared_ptr<dentry> const &;
+ [[nodiscard]] auto get_root_dentry() const -> kstd::shared_ptr<dentry> const &;
/**
@brief Get the filesystem instance being 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<mount> const &;
private:
- kstd::string m_mount_path;
kstd::shared_ptr<dentry> m_mount_dentry;
kstd::shared_ptr<dentry> m_root_dentry;
kstd::shared_ptr<filesystem> m_filesystem{};
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
@@ -39,13 +39,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<mount>;
-
- /**
@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.
@return A pointer to the mount with the exact matching path, or a null pointer if no mount matches the path.