diff options
| author | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-28 17:28:32 +0100 |
|---|---|---|
| committer | Lukas Oesch <lukasoesch20@gmail.com> | 2026-03-28 17:28:32 +0100 |
| commit | a6f93bf8df0dbfa7d19aa1168bfc8b052e41c42f (patch) | |
| tree | b07657406fd2ce67e69819326b0c76e9409ef77c /kernel/include | |
| parent | 4f7ae11655807acf68f49637cc9dd01a03af36d5 (diff) | |
| download | teachos-a6f93bf8df0dbfa7d19aa1168bfc8b052e41c42f.tar.xz teachos-a6f93bf8df0dbfa7d19aa1168bfc8b052e41c42f.zip | |
fix vfs mount with /dev & /a and rootfs & devfs
Diffstat (limited to 'kernel/include')
4 files changed, 11 insertions, 6 deletions
diff --git a/kernel/include/kernel/filesystem/mount.hpp b/kernel/include/kernel/filesystem/mount.hpp index 0cd30b4..0f37687 100644 --- a/kernel/include/kernel/filesystem/mount.hpp +++ b/kernel/include/kernel/filesystem/mount.hpp @@ -5,20 +5,25 @@ #include "kernel/filesystem/filesystem.hpp" #include <kstd/memory> +#include <kstd/string> + +#include <string_view> namespace filesystem { struct mount { mount(kstd::shared_ptr<dentry> const & mount_dentry, kstd::shared_ptr<dentry> const & root_dentry, - kstd::shared_ptr<filesystem> const & fs); + kstd::shared_ptr<filesystem> const & fs, std::string_view mount_path); [[nodiscard]] auto get_mount_dentry() const -> kstd::shared_ptr<dentry>; [[nodiscard]] auto root_dentry() const -> kstd::shared_ptr<dentry> const &; [[nodiscard]] auto get_filesystem() const -> kstd::shared_ptr<filesystem> const &; + [[nodiscard]] auto get_mount_path() const -> std::string_view; 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 cf523c1..2cd66ea 100644 --- a/kernel/include/kernel/filesystem/mount_table.hpp +++ b/kernel/include/kernel/filesystem/mount_table.hpp @@ -1,12 +1,13 @@ #ifndef TEACH_OS_KERNEL_FILESYSTEM_MOUNT_TABLE_HPP #define TEACH_OS_KERNEL_FILESYSTEM_MOUNT_TABLE_HPP -#include "kernel/filesystem/dentry.hpp" #include "kernel/filesystem/mount.hpp" #include <kstd/memory> #include <kstd/vector> +#include <string_view> + namespace filesystem { struct mount_table @@ -14,8 +15,7 @@ namespace filesystem public: void add_mount(kstd::shared_ptr<mount>); - [[nodiscard]] auto get_root_mount() const -> kstd::shared_ptr<mount>; - auto find_mount_by_dentry(kstd::shared_ptr<dentry> const & dentry) -> kstd::shared_ptr<mount>; + [[nodiscard]] auto find_longest_prefix_mount(std::string_view path) const -> kstd::shared_ptr<mount>; private: kstd::vector<kstd::shared_ptr<mount>> m_mounts; diff --git a/kernel/include/kernel/filesystem/rootfs/rootfs_filesystem.hpp b/kernel/include/kernel/filesystem/rootfs/rootfs_filesystem.hpp index cb07111..b3e03a9 100644 --- a/kernel/include/kernel/filesystem/rootfs/rootfs_filesystem.hpp +++ b/kernel/include/kernel/filesystem/rootfs/rootfs_filesystem.hpp @@ -4,14 +4,12 @@ #include "kernel/devices/device.hpp" #include "kernel/filesystem/filesystem.hpp" #include "kernel/filesystem/inode.hpp" -#include "kernel/filesystem/rootfs/rootfs_inode.hpp" #include <kstd/memory> #include <kstd/string> #include <kstd/vector> #include <string_view> -#include <utility> namespace filesystem::rootfs { diff --git a/kernel/include/kernel/filesystem/vfs.hpp b/kernel/include/kernel/filesystem/vfs.hpp index f301b7a..9bee104 100644 --- a/kernel/include/kernel/filesystem/vfs.hpp +++ b/kernel/include/kernel/filesystem/vfs.hpp @@ -27,6 +27,8 @@ namespace filesystem auto init_internal() -> void; [[nodiscard]] auto resolve_path(std::string_view path) -> kstd::shared_ptr<dentry>; + auto do_mount_internal(std::string_view path, kstd::shared_ptr<dentry> const & mount_point_dentry, + kstd::shared_ptr<filesystem> const & fs) -> void; mount_table m_mount_table; }; |
