aboutsummaryrefslogtreecommitdiff
path: root/kernel/src/filesystem/vfs.cpp
diff options
context:
space:
mode:
authorLukas Oesch <lukasoesch20@gmail.com>2026-05-16 16:12:36 +0200
committerLukas Oesch <lukasoesch20@gmail.com>2026-05-16 16:12:36 +0200
commit3b2f36d242eb895fd893ec7a674ff608f44f69ac (patch)
tree86d5515593b5e4dd937b20a626f9cf3a0d428cdd /kernel/src/filesystem/vfs.cpp
parent106e9731aaf856f940592c02953e49a496555822 (diff)
downloadkernel-3b2f36d242eb895fd893ec7a674ff608f44f69ac.tar.xz
kernel-3b2f36d242eb895fd893ec7a674ff608f44f69ac.zip
refactoring
Diffstat (limited to 'kernel/src/filesystem/vfs.cpp')
-rw-r--r--kernel/src/filesystem/vfs.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/kernel/src/filesystem/vfs.cpp b/kernel/src/filesystem/vfs.cpp
index 8636d0f..bf9a77d 100644
--- a/kernel/src/filesystem/vfs.cpp
+++ b/kernel/src/filesystem/vfs.cpp
@@ -153,7 +153,7 @@ namespace kernel::filesystem
-> void
{
auto new_fs_root =
- kstd::make_shared<dentry>(mount_point_dentry->get_parent(), fs->root_inode(), mount_point_dentry->get_name());
+ kstd::make_shared<dentry>(mount_point_dentry->parent(), fs->root_inode(), mount_point_dentry->name());
auto new_mount = kstd::make_shared<mount>(mount_point_dentry, new_fs_root, fs, parent_mount);
m_mount_table.add_mount(new_mount);
}
@@ -174,7 +174,8 @@ namespace kernel::filesystem
}
}
- auto vfs::resolve_path_internal(std::string_view path) -> std::pair<kstd::shared_ptr<dentry>, kstd::shared_ptr<mount>>
+ auto vfs::resolve_path_internal(std::string_view path) const
+ -> std::pair<kstd::shared_ptr<dentry>, kstd::shared_ptr<mount>>
{
if (!path::is_valid_absolute_path(path))
{
@@ -187,7 +188,7 @@ namespace kernel::filesystem
kapi::system::panic("[FILESYSTEM] no root mount found.");
}
- auto current_dentry = current_mount->get_root_dentry();
+ auto current_dentry = current_mount->root_dentry();
auto path_parts = path::split(path);
kstd::vector path_parts_vector(path_parts.begin(), path_parts.end());
@@ -207,16 +208,16 @@ namespace kernel::filesystem
if (part == "..")
{
- auto parent_dentry = current_dentry->get_parent();
+ auto parent_dentry = current_dentry->parent();
- if (current_dentry == current_mount->get_root_dentry())
+ if (current_dentry == current_mount->root_dentry())
{
- if (current_mount->get_mount_path() == "/")
+ if (current_mount->mount_path() == "/")
{
continue;
}
- if (auto parent_mount = current_mount->get_parent_mount())
+ if (auto parent_mount = current_mount->parent_mount())
{
current_mount = parent_mount;
current_dentry = parent_dentry;
@@ -242,13 +243,13 @@ namespace kernel::filesystem
}
else if (next_dentry->has_flag(dentry::dentry_flags::is_mount_point))
{
- current_mount = m_mount_table.find_mount(next_dentry->get_absolute_path().view());
+ current_mount = m_mount_table.find_mount(next_dentry->absolute_path().view());
if (!current_mount)
{
kapi::system::panic("[FILESYSTEM] mount for dentry with mounted flag not found.");
}
- next_dentry = current_mount->get_root_dentry();
+ next_dentry = current_mount->root_dentry();
}
if (next_dentry->get_inode()->is_symbolic_link())
@@ -271,7 +272,7 @@ namespace kernel::filesystem
if (path::is_valid_absolute_path(symbolic_link_path))
{
current_mount = m_mount_table.find_mount("/");
- current_dentry = current_mount->get_root_dentry();
+ current_dentry = current_mount->root_dentry();
}
continue;
}
@@ -281,12 +282,12 @@ namespace kernel::filesystem
return {current_dentry, current_mount};
}
- auto vfs::resolve_path(std::string_view path) -> kstd::shared_ptr<dentry>
+ auto vfs::resolve_path(std::string_view path) const -> kstd::shared_ptr<dentry>
{
return resolve_path_internal(path).first;
}
- auto vfs::find_mount(std::string_view path) -> kstd::shared_ptr<mount>
+ auto vfs::find_mount(std::string_view path) const -> kstd::shared_ptr<mount>
{
return resolve_path_internal(path).second;
}