aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/include/kernel/filesystem/path.hpp5
-rw-r--r--kernel/src/filesystem/vfs.cpp15
2 files changed, 11 insertions, 9 deletions
diff --git a/kernel/include/kernel/filesystem/path.hpp b/kernel/include/kernel/filesystem/path.hpp
index 976926f..298ac5f 100644
--- a/kernel/include/kernel/filesystem/path.hpp
+++ b/kernel/include/kernel/filesystem/path.hpp
@@ -3,6 +3,7 @@
#include <ranges>
#include <string_view>
+#include <kstd/string>
namespace kernel::filesystem::path
{
@@ -43,12 +44,12 @@ namespace kernel::filesystem::path
/**
@brief Splits the given path into its components.
@param path The path to split.
- @return A range of string views representing the components of the path.
+ @return A range of strings representing the components of the path.
*/
auto inline split(std::string_view path)
{
return std::views::split(path, '/') | std::views::filter([](auto const & part) { return !part.empty(); }) |
- std::views::transform([](auto const & part) { return std::string_view(part.begin(), part.end()); });
+ std::views::transform([](auto const & part) { return kstd::string(std::string_view(part.begin(), part.end())); });
}
} // namespace kernel::filesystem::path
diff --git a/kernel/src/filesystem/vfs.cpp b/kernel/src/filesystem/vfs.cpp
index 06d36ce..03921df 100644
--- a/kernel/src/filesystem/vfs.cpp
+++ b/kernel/src/filesystem/vfs.cpp
@@ -167,15 +167,15 @@ namespace kernel::filesystem
while (!path_parts_vector.empty())
{
- std::string_view part_view{path_parts_vector.back()};
+ auto part = path_parts_vector.back();
path_parts_vector.pop_back();
- if (part_view == ".")
+ if (part == ".")
{
continue;
}
- if (part_view == "..")
+ if (part == "..")
{
auto parent_dentry = current_dentry->get_parent();
@@ -203,17 +203,17 @@ namespace kernel::filesystem
continue;
}
- auto next_dentry = current_dentry->find_child(part_view);
+ auto next_dentry = current_dentry->find_child(part.view());
if (!next_dentry)
{
auto current_fs = current_mount->get_filesystem();
- auto found_inode = current_fs->lookup(current_dentry->get_inode(), part_view);
+ auto found_inode = current_fs->lookup(current_dentry->get_inode(), part.view());
if (!found_inode)
{
return nullptr;
}
- next_dentry = kstd::make_shared<dentry>(current_dentry, found_inode, part_view);
+ next_dentry = kstd::make_shared<dentry>(current_dentry, found_inode, part.view());
current_dentry->add_child(next_dentry);
}
else if (next_dentry->has_flag(dentry::dentry_flags::mounted))
@@ -244,8 +244,9 @@ namespace kernel::filesystem
if (kernel::filesystem::path::is_valid_absolute_path(symbolic_link_path))
{
current_mount = m_mount_table.find_longest_prefix_mount("/");
- next_dentry = current_mount->root_dentry();
+ current_dentry = current_mount->root_dentry();
}
+ continue;
}
current_dentry = next_dentry;