aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcel.braun <marcel.braun@ost.ch>2026-03-24 16:53:21 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-26 21:19:00 +0100
commitb742349ba039d1a864462332bb7ae5a071afdec1 (patch)
treeaea94a31cc583215f0aa4a097778afb44023bc09
parent6110774495a10d1dd8766f8fa8597fb3bdc4aabd (diff)
downloadteachos-b742349ba039d1a864462332bb7ae5a071afdec1.tar.xz
teachos-b742349ba039d1a864462332bb7ae5a071afdec1.zip
Refactor mount_table entry (mount) to use dentry as key instead of path
-rw-r--r--kernel/include/kernel/filesystem/mount.hpp9
-rw-r--r--kernel/src/filesystem/mount.cpp9
2 files changed, 9 insertions, 9 deletions
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 <kstd/memory>
-#include <string_view>
-
namespace filesystem
{
struct mount
{
- mount(std::string_view const & path, kstd::shared_ptr<filesystem> const & fs);
+ mount(kstd::shared_ptr<dentry> const & mount_dentry, kstd::shared_ptr<filesystem> const & fs);
- [[nodiscard]] auto path() const -> std::string_view;
+ [[nodiscard]] auto get_dentry() const -> kstd::shared_ptr<dentry>;
[[nodiscard]] auto get_filesystem() const -> kstd::shared_ptr<filesystem> const &;
private:
- std::string_view m_path;
+ kstd::shared_ptr<dentry> m_dentry;
kstd::shared_ptr<filesystem> 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 <kstd/memory>
@@ -10,8 +11,8 @@
namespace filesystem
{
- mount::mount(std::string_view const & path, kstd::shared_ptr<filesystem> const & fs)
- : m_path(path)
+ mount::mount(kstd::shared_ptr<dentry> const & mount_dentry, kstd::shared_ptr<filesystem> 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<dentry>
{
- return m_path;
+ return m_dentry;
}
auto mount::get_filesystem() const -> kstd::shared_ptr<filesystem> const &