aboutsummaryrefslogtreecommitdiff
path: root/kernel/src
diff options
context:
space:
mode:
authormarcel.braun <marcel.braun@ost.ch>2026-03-24 16:50:27 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-26 21:18:57 +0100
commit444810121f9c89285da1ec118828640f0445b2a7 (patch)
tree270ca5d8e0d5e41ce376d9499c882dc0f630772f /kernel/src
parentb3cb1d0f8864bf54362f1da2b7a65ca693778cff (diff)
downloadteachos-444810121f9c89285da1ec118828640f0445b2a7.tar.xz
teachos-444810121f9c89285da1ec118828640f0445b2a7.zip
Add mount_table
Diffstat (limited to 'kernel/src')
-rw-r--r--kernel/src/filesystem/mount_table.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/kernel/src/filesystem/mount_table.cpp b/kernel/src/filesystem/mount_table.cpp
new file mode 100644
index 0000000..0e9a53d
--- /dev/null
+++ b/kernel/src/filesystem/mount_table.cpp
@@ -0,0 +1,29 @@
+#include "kernel/filesystem/mount_table.hpp"
+
+#include "kapi/system.hpp"
+
+#include "kernel/filesystem/dentry.hpp"
+#include "kernel/filesystem/mount.hpp"
+
+#include <kstd/memory>
+
+#include <algorithm>
+
+namespace filesystem
+{
+ void mount_table::add_mount(kstd::shared_ptr<mount> mount)
+ {
+ m_mounts.push_back(mount);
+ }
+
+ auto mount_table::find_mount_by_dentry(kstd::shared_ptr<dentry> const & dentry) -> kstd::shared_ptr<mount>
+ {
+ auto found =
+ std::ranges::find_if(m_mounts, [&](auto const & mount) { return mount->get_dentry().get() == dentry.get(); });
+ if (found != m_mounts.end())
+ {
+ return *found;
+ }
+ kapi::system::panic("[FILESYSTEM] dentry has mount flag set but no corresponding mount found.");
+ }
+} // namespace filesystem \ No newline at end of file