From 0967e2140eca2caa8dc4c3412218c6f593878471 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Sat, 22 Aug 2026 20:06:20 +0200 Subject: kernel/fs: clean up API --- kernel/kernel/filesystem/dentry.cpp | 5 ++- kernel/kernel/filesystem/dentry.hpp | 17 +++++---- kernel/kernel/filesystem/dentry.tests.cpp | 4 +- kernel/kernel/filesystem/ext2/filesystem.tests.cpp | 4 +- kernel/kernel/filesystem/ext2/inode.cpp | 4 +- kernel/kernel/filesystem/ext2/inode.tests.cpp | 18 ++++----- kernel/kernel/filesystem/mount.cpp | 29 +++++++------- kernel/kernel/filesystem/mount.hpp | 44 +++++++++++----------- kernel/kernel/filesystem/mount.tests.cpp | 4 +- kernel/kernel/filesystem/open_file_descriptor.cpp | 6 +-- kernel/kernel/filesystem/vfs.cpp | 29 +++++++------- kernel/kernel/filesystem/vfs.tests.cpp | 4 +- 12 files changed, 86 insertions(+), 82 deletions(-) (limited to 'kernel') diff --git a/kernel/kernel/filesystem/dentry.cpp b/kernel/kernel/filesystem/dentry.cpp index 9321453a..e82c5419 100644 --- a/kernel/kernel/filesystem/dentry.cpp +++ b/kernel/kernel/filesystem/dentry.cpp @@ -13,7 +13,8 @@ namespace kernel::filesystem { - dentry::dentry(kstd::shared_ptr const & parent, kstd::shared_ptr const & inode, std::string_view name) + dentry::dentry(kstd::shared_ptr const & parent, kstd::shared_ptr const & inode, + std::string_view name) : m_name(name) , m_parent(parent) , m_inode(inode) @@ -29,7 +30,7 @@ namespace kernel::filesystem } } - auto dentry::get_inode() const -> kstd::shared_ptr const & + auto dentry::inode() const -> kstd::shared_ptr const & { return m_inode; } diff --git a/kernel/kernel/filesystem/dentry.hpp b/kernel/kernel/filesystem/dentry.hpp index a33ff22d..f7897764 100644 --- a/kernel/kernel/filesystem/dentry.hpp +++ b/kernel/kernel/filesystem/dentry.hpp @@ -15,6 +15,9 @@ namespace kernel::filesystem //! A directory entry in the filesystem. struct dentry { + using dentry_ptr = kstd::shared_ptr; + using inode_ptr = kstd::shared_ptr; + //! Flags for the dentry. enum class dentry_flags : uint32_t { @@ -28,17 +31,17 @@ namespace kernel::filesystem //! @param parent The parent directory entry, if any. //! @param inode The associated inode for this dentry. //! @param name The name of the dentry. - dentry(kstd::shared_ptr const & parent, kstd::shared_ptr const & inode, std::string_view name); + dentry(dentry_ptr const & parent, inode_ptr const & inode, std::string_view name); //! Get this entrys associated inode. //! //! @return The inode associated with this directory entry. - [[nodiscard]] auto get_inode() const -> kstd::shared_ptr const &; + [[nodiscard]] auto inode() const -> inode_ptr const &; //! Get this entrys parent directory entry. //! //! @return The parent directory entry, or @p nullptr if this entry has no parent. - [[nodiscard]] auto parent() const -> kstd::shared_ptr; + [[nodiscard]] auto parent() const -> dentry_ptr; //! Get this entrys name. //! @@ -56,7 +59,7 @@ namespace kernel::filesystem //! Add a child to this entry. //! //! @param child The child directory entry to add. - auto add_child(kstd::shared_ptr const & child) -> void; + auto add_child(dentry_ptr const & child) -> void; //! Find a child entry with the given name. //! @@ -65,7 +68,7 @@ namespace kernel::filesystem //! //! @param name The name of the child directory entry to find. //! @return A pointer to the child dentry if it exists, a null pointer otherwise. - [[nodiscard]] auto find_child(std::string_view name) const -> kstd::shared_ptr; + [[nodiscard]] auto find_child(std::string_view name) const -> dentry_ptr; //! Set a flag for this entry. //! @@ -86,8 +89,8 @@ namespace kernel::filesystem private: kstd::string m_name; kstd::weak_ptr m_parent; - kstd::vector> m_children; - kstd::shared_ptr m_inode; + kstd::vector m_children; + inode_ptr m_inode; uint32_t m_flags; }; } // namespace kernel::filesystem diff --git a/kernel/kernel/filesystem/dentry.tests.cpp b/kernel/kernel/filesystem/dentry.tests.cpp index 55cdf21e..cf3915de 100644 --- a/kernel/kernel/filesystem/dentry.tests.cpp +++ b/kernel/kernel/filesystem/dentry.tests.cpp @@ -22,7 +22,7 @@ SCENARIO("Dentry construction", "[filesystem][dentry]") THEN("the dentry has the correct parent, inode, and name") { REQUIRE(child_dentry.parent() == parent_dentry); - REQUIRE(child_dentry.get_inode() == inode); + REQUIRE(child_dentry.inode() == inode); REQUIRE(child_dentry.name() == "child"); } @@ -47,7 +47,7 @@ SCENARIO("Dentry construction", "[filesystem][dentry]") THEN("the dentry has a null parent, the correct inode, and the correct name") { REQUIRE(child_dentry.parent() == nullptr); - REQUIRE(child_dentry.get_inode() == inode); + REQUIRE(child_dentry.inode() == inode); REQUIRE(child_dentry.name() == "child"); } diff --git a/kernel/kernel/filesystem/ext2/filesystem.tests.cpp b/kernel/kernel/filesystem/ext2/filesystem.tests.cpp index 5feea017..708f83df 100644 --- a/kernel/kernel/filesystem/ext2/filesystem.tests.cpp +++ b/kernel/kernel/filesystem/ext2/filesystem.tests.cpp @@ -50,7 +50,7 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_fixture, auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); THEN("the root inode is available and is a directory") @@ -102,7 +102,7 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_fixture, auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); THEN("a file can be created") diff --git a/kernel/kernel/filesystem/ext2/inode.cpp b/kernel/kernel/filesystem/ext2/inode.cpp index 7059527a..b04be99a 100644 --- a/kernel/kernel/filesystem/ext2/inode.cpp +++ b/kernel/kernel/filesystem/ext2/inode.cpp @@ -313,7 +313,7 @@ namespace kernel::filesystem::ext2 { if (auto mount = owning_mount().lock()) { - return static_pointer_cast(mount->get_filesystem()); + return static_pointer_cast(mount->filesystem()); } return kstd::failure(vfs_errc::not_mounted); @@ -323,7 +323,7 @@ namespace kernel::filesystem::ext2 { if (auto mount = owning_mount().lock()) { - return static_pointer_cast(mount->get_filesystem()); + return static_pointer_cast(mount->filesystem()); } return kstd::failure(vfs_errc::not_mounted); diff --git a/kernel/kernel/filesystem/ext2/inode.tests.cpp b/kernel/kernel/filesystem/ext2/inode.tests.cpp index 48af4d75..9a602a28 100644 --- a/kernel/kernel/filesystem/ext2/inode.tests.cpp +++ b/kernel/kernel/filesystem/ext2/inode.tests.cpp @@ -103,7 +103,7 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_fixture, "Ext2 in auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto information = fs->lookup(root, "information"); @@ -149,7 +149,7 @@ SCENARIO("Ext2 inode handles zeros in block mappings as file holes", "[filesyste auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto data = kernel::filesystem::ext2::inode_data{}; @@ -190,7 +190,7 @@ SCENARIO("Ext2 inode handles zeros in block mappings as file holes", "[filesyste auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto data = kernel::filesystem::ext2::inode_data{}; @@ -238,7 +238,7 @@ SCENARIO("Ext2 inode handles zeros in block mappings as file holes", "[filesyste auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto data = kernel::filesystem::ext2::inode_data{}; @@ -272,7 +272,7 @@ SCENARIO("Ext2 inode read across block boundaries", "[filesystem][ext2][inode]") auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto inode_data = kernel::filesystem::ext2::inode_data{}; @@ -313,7 +313,7 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_fixture, "Ext2 in auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto information = fs->lookup(root, "information"); @@ -409,7 +409,7 @@ SCENARIO("Ext2 inode write across block boundaries", "[filesystem][ext2][inode]" auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto inode_data = kernel::filesystem::ext2::inode_data{}; @@ -548,7 +548,7 @@ SCENARIO("Ext2 inode get_size() and set_size() handles size correctly depending auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto data = kernel::filesystem::ext2::inode_data{}; @@ -594,7 +594,7 @@ SCENARIO("Ext2 inode get_size() and set_size() handles size correctly depending auto fs = kstd::make_shared(); auto mount = kernel::filesystem::mount::create(nullptr, fs, nullptr, nullptr, dev_inode); - auto root = (*mount)->root_dentry()->get_inode(); + auto root = (*mount)->root_dentry()->inode(); REQUIRE(mount); auto data = kernel::filesystem::ext2::inode_data{}; diff --git a/kernel/kernel/filesystem/mount.cpp b/kernel/kernel/filesystem/mount.cpp index 995c12c8..2f0e0d58 100644 --- a/kernel/kernel/filesystem/mount.cpp +++ b/kernel/kernel/filesystem/mount.cpp @@ -14,9 +14,8 @@ namespace kernel::filesystem { - mount::mount(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & root_dentry, - kstd::shared_ptr const & fs, kstd::shared_ptr const & parent_mount, - kstd::shared_ptr const & source_mount) + mount::mount(dentry_ptr const & mount_dentry, dentry_ptr const & root_dentry, filesystem_ptr const & fs, + mount_ptr const & parent_mount, mount_ptr const & source_mount) : m_mount_dentry(mount_dentry) , m_root_dentry(root_dentry) , m_filesystem(fs) @@ -30,15 +29,15 @@ namespace kernel::filesystem } } - auto mount::attach(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs, - kstd::shared_ptr const & root_inode, kstd::shared_ptr const & parent_mount, - kstd::shared_ptr const & source_mount) -> kstd::shared_ptr + auto mount::attach(dentry_ptr const & mount_dentry, filesystem_ptr const & fs, + kstd::shared_ptr const & root_inode, mount_ptr const & parent_mount, + mount_ptr const & source_mount) -> mount_ptr { auto root_dentry = mount_dentry ? kstd::make_shared(mount_dentry->parent(), root_inode, mount_dentry->name()) : kstd::make_shared(nullptr, root_inode, "/"); - auto instance = kstd::shared_ptr{ + auto instance = mount_ptr{ new mount{mount_dentry, root_dentry, fs, parent_mount, source_mount} }; @@ -47,9 +46,9 @@ namespace kernel::filesystem return instance; } - auto mount::create(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs, - kstd::shared_ptr const & parent_mount, kstd::shared_ptr const & source_mount, - kstd::shared_ptr const & backing_inode) -> kstd::result> + auto mount::create(dentry_ptr const & mount_dentry, filesystem_ptr const & fs, mount_ptr const & parent_mount, + mount_ptr const & source_mount, kstd::shared_ptr const & backing_inode) + -> kstd::result { if (!fs) { @@ -68,12 +67,12 @@ namespace kernel::filesystem return instance; } - auto mount::mount_dentry() const -> kstd::shared_ptr const & + auto mount::mount_dentry() const -> dentry_ptr const & { return m_mount_dentry; } - auto mount::get_filesystem() const -> kstd::shared_ptr const & + auto mount::filesystem() const -> filesystem_ptr const & { return m_filesystem; } @@ -83,7 +82,7 @@ namespace kernel::filesystem return m_backing_inode; } - auto mount::root_dentry() const -> kstd::shared_ptr const & + auto mount::root_dentry() const -> dentry_ptr const & { return m_root_dentry; } @@ -97,12 +96,12 @@ namespace kernel::filesystem return "/"; } - auto mount::parent_mount() const -> kstd::shared_ptr const & + auto mount::parent_mount() const -> mount_ptr const & { return m_parent_mount; } - auto mount::source_mount() const -> kstd::shared_ptr + auto mount::source_mount() const -> mount_ptr { return m_source_mount.lock(); } diff --git a/kernel/kernel/filesystem/mount.hpp b/kernel/kernel/filesystem/mount.hpp index d8d9c625..ac6dae21 100644 --- a/kernel/kernel/filesystem/mount.hpp +++ b/kernel/kernel/filesystem/mount.hpp @@ -18,6 +18,11 @@ namespace kernel::filesystem //! A mounted filesystem struct mount { + using dentry_ptr = kstd::shared_ptr; + using filesystem_ptr = kstd::shared_ptr; + using mount_ptr = kstd::shared_ptr; + using inode_ptr = kstd::shared_ptr; + //! Attach a mounted filesystem with a known root inode //! //! @param mount_dentry The directory entry where the filesystem is mounted. @@ -25,9 +30,8 @@ namespace kernel::filesystem //! @param root_inode The backing inode for the filesystem, must not be null. //! @param parent_mount The parent mount which contains the mount_dentry. //! @param source_mount The mount that the filesystem originates from. - auto static attach(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs, - kstd::shared_ptr const & root_inode, kstd::shared_ptr const & parent_mount, - kstd::shared_ptr const & source_mount) -> kstd::shared_ptr; + auto static attach(dentry_ptr const & mount_dentry, filesystem_ptr const & fs, inode_ptr const & root_inode, + mount_ptr const & parent_mount, mount_ptr const & source_mount) -> mount_ptr; //! Create a new mount with the given parameters. //! @@ -36,30 +40,29 @@ namespace kernel::filesystem //! @param parent_mount The parent mount which contains the mount_dentry. //! @param source_mount The mount that the filesystem originates from. //! @param backing_inode The backing inode for the filesystem, if any. - auto static create(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & fs, - kstd::shared_ptr const & parent_mount, kstd::shared_ptr const & source_mount, - kstd::shared_ptr const & backing_inode) -> kstd::result>; + auto static create(dentry_ptr const & mount_dentry, filesystem_ptr const & fs, mount_ptr const & parent_mount, + mount_ptr const & source_mount, inode_ptr const & backing_inode) -> kstd::result; //! Get the directory entry where the filesystem is mounted. - [[nodiscard]] auto mount_dentry() const -> kstd::shared_ptr const &; + [[nodiscard]] auto mount_dentry() const -> dentry_ptr const &; //! Get the root directory entry of the mounted filesystem. - [[nodiscard]] auto root_dentry() const -> kstd::shared_ptr const &; + [[nodiscard]] auto root_dentry() const -> dentry_ptr const &; //! Get the filesystem instance being mounted. - [[nodiscard]] auto get_filesystem() const -> kstd::shared_ptr const &; + [[nodiscard]] auto filesystem() const -> filesystem_ptr const &; //! Get the backing inode, if any, of this mount. - [[nodiscard]] auto backing_inode() const -> kstd::shared_ptr const &; + [[nodiscard]] auto backing_inode() const -> inode_ptr const &; //! Get the path at which the filesystem is mounted. [[nodiscard]] auto mount_path() const -> kstd::string; //! Get the parent mount that this mount was attached beneath. - [[nodiscard]] auto parent_mount() const -> kstd::shared_ptr const &; + [[nodiscard]] auto parent_mount() const -> mount_ptr const &; //! Get the source mount where this mount originates from. - [[nodiscard]] auto source_mount() const -> kstd::shared_ptr; + [[nodiscard]] auto source_mount() const -> mount_ptr; //! Increment the reference count for this mount. auto increment_ref_count() -> void; @@ -87,15 +90,14 @@ namespace kernel::filesystem //! @param fs The filesystem instance being mounted. //! @param parent_mount The parent mount which contains the mount_dentry. //! @param source_mount The mount that the filesystem originates from. - mount(kstd::shared_ptr const & mount_dentry, kstd::shared_ptr const & root_dentry, - kstd::shared_ptr const & fs, kstd::shared_ptr const & parent_mount, - kstd::shared_ptr const & source_mount); - - kstd::shared_ptr m_mount_dentry{}; - kstd::shared_ptr m_root_dentry{}; - kstd::shared_ptr m_filesystem{}; - kstd::shared_ptr m_backing_inode{}; - kstd::shared_ptr m_parent_mount{}; + mount(dentry_ptr const & mount_dentry, dentry_ptr const & root_dentry, filesystem_ptr const & fs, + mount_ptr const & parent_mount, mount_ptr const & source_mount); + + dentry_ptr m_mount_dentry{}; + dentry_ptr m_root_dentry{}; + filesystem_ptr m_filesystem{}; + inode_ptr m_backing_inode{}; + mount_ptr m_parent_mount{}; kstd::weak_ptr m_source_mount{}; std::atomic_size_t m_ref_count{0}; }; diff --git a/kernel/kernel/filesystem/mount.tests.cpp b/kernel/kernel/filesystem/mount.tests.cpp index 3337a172..2c67a7cb 100644 --- a/kernel/kernel/filesystem/mount.tests.cpp +++ b/kernel/kernel/filesystem/mount.tests.cpp @@ -26,8 +26,8 @@ SCENARIO("Mount construction", "[filesystem][mount]") THEN("the mount has the correct filesystem, root dentry, mount dentry, and mount path") { - REQUIRE(mount->get_filesystem() == fs); - REQUIRE(mount->root_dentry()->get_inode() == root_inode); + REQUIRE(mount->filesystem() == fs); + REQUIRE(mount->root_dentry()->inode() == root_inode); REQUIRE(mount->root_dentry()->name() == "/"); REQUIRE(mount->mount_dentry() == nullptr); REQUIRE(mount->mount_path() == "/"); diff --git a/kernel/kernel/filesystem/open_file_descriptor.cpp b/kernel/kernel/filesystem/open_file_descriptor.cpp index 98520aa8..64c47461 100644 --- a/kernel/kernel/filesystem/open_file_descriptor.cpp +++ b/kernel/kernel/filesystem/open_file_descriptor.cpp @@ -26,7 +26,7 @@ namespace kernel::filesystem auto open_file_descriptor::read(std::span buffer) -> kstd::result { - if (auto result = m_dentry->get_inode()->read(buffer, m_offset); !result) + if (auto result = m_dentry->inode()->read(buffer, m_offset); !result) { return kstd::failure(result.error()); } @@ -40,7 +40,7 @@ namespace kernel::filesystem auto open_file_descriptor::write(std::span buffer) -> kstd::result { - if (auto result = m_dentry->get_inode()->write(buffer, m_offset); !result) + if (auto result = m_dentry->inode()->write(buffer, m_offset); !result) { return kstd::failure(result.error()); } @@ -68,7 +68,7 @@ namespace kernel::filesystem } case kapi::filesystem::seek_origin::end: { - return m_dentry->get_inode()->status()->size; + return m_dentry->inode()->status()->size; } default: { diff --git a/kernel/kernel/filesystem/vfs.cpp b/kernel/kernel/filesystem/vfs.cpp index 21ac3752..c39a28c4 100644 --- a/kernel/kernel/filesystem/vfs.cpp +++ b/kernel/kernel/filesystem/vfs.cpp @@ -89,12 +89,12 @@ namespace kernel::filesystem resolve_path_internal("/dev/ram0").value_or(std::pair{nullptr, nullptr}); if (boot_device_dentry && boot_device_mount_context) { - if (auto result = kernel::filesystem::filesystem::probe(boot_device_dentry->get_inode())) + if (auto result = kernel::filesystem::filesystem::probe(boot_device_dentry->inode())) { if (auto root_dentry = resolve_path("/")) { - auto mount = mount::create(*root_dentry, *result, root_mount, boot_device_mount_context, - boot_device_dentry->get_inode()); + auto mount = + mount::create(*root_dentry, *result, root_mount, boot_device_mount_context, boot_device_dentry->inode()); if (!mount) { kapi::system::panic("[OS:FS] failed to mount boot FS", mount.error()); @@ -125,7 +125,7 @@ namespace kernel::filesystem } auto [dentry, mount] = resolved_path.value(); - auto inode = dentry->get_inode(); + auto inode = dentry->inode(); if (inode->is_device()) { @@ -184,14 +184,13 @@ namespace kernel::filesystem } auto [source_dentry, source_mount_context] = *resolved_source; - auto fs = kernel::filesystem::filesystem::probe(source_dentry->get_inode()); + auto fs = kernel::filesystem::filesystem::probe(source_dentry->inode()); if (!fs) { return kstd::failure(fs.error()); } - auto mount = - mount::create(mount_point_dentry, *fs, mount_context, source_mount_context, source_dentry->get_inode()); + auto mount = mount::create(mount_point_dentry, *fs, mount_context, source_mount_context, source_dentry->inode()); if (!mount) { return kstd::failure(mount.error()); @@ -247,7 +246,7 @@ namespace kernel::filesystem return kstd::failure(resolved.error()); } - return (*resolved)->get_inode()->status(); + return (*resolved)->inode()->status(); } auto vfs::create_device_node(std::string_view path, std::uint32_t mode, kapi::filesystem::device_number device) @@ -292,9 +291,9 @@ namespace kernel::filesystem auto [parent_dentry, mount_context] = *resolved_parent; - if (auto fs = mount_context->get_filesystem()) + if (auto fs = mount_context->filesystem()) { - if (auto new_inode = fs->create_inode(parent_dentry->get_inode(), name, type, raw_device)) + if (auto new_inode = fs->create_inode(parent_dentry->inode(), name, type, raw_device)) { (*new_inode)->set_owning_mount(mount_context); @@ -352,7 +351,7 @@ namespace kernel::filesystem auto part = path_parts_vector.back(); path_parts_vector.pop_back(); - if (!current_dentry->get_inode()->is_directory()) + if (!current_dentry->inode()->is_directory()) { return kstd::failure(vfs_errc::not_a_directory); } @@ -387,8 +386,8 @@ namespace kernel::filesystem auto next_dentry = current_dentry->find_child(part); if (!next_dentry) { - auto current_fs = current_mount->get_filesystem(); - auto found_inode = current_fs->lookup(current_dentry->get_inode(), part); + auto current_fs = current_mount->filesystem(); + auto found_inode = current_fs->lookup(current_dentry->inode(), part); if (!found_inode) { return kstd::failure(found_inode.error()); @@ -410,7 +409,7 @@ namespace kernel::filesystem next_dentry = current_mount->root_dentry(); } - if (next_dentry->get_inode()->is_symbolic_link()) + if (next_dentry->inode()->is_symbolic_link()) { if (symlink_counter++ > constants::symloop_max) { @@ -418,7 +417,7 @@ namespace kernel::filesystem } kstd::vector buffer(constants::symlink_max_path_length); - auto const bytes_read = next_dentry->get_inode()->read(buffer, 0_B); + auto const bytes_read = next_dentry->inode()->read(buffer, 0_B); if (!bytes_read) { return kstd::failure(bytes_read.error()); diff --git a/kernel/kernel/filesystem/vfs.tests.cpp b/kernel/kernel/filesystem/vfs.tests.cpp index a035e083..5b7ea621 100644 --- a/kernel/kernel/filesystem/vfs.tests.cpp +++ b/kernel/kernel/filesystem/vfs.tests.cpp @@ -665,11 +665,11 @@ SCENARIO_METHOD(kernel::tests::filesystem::storage_boot_module_vfs_fixture, "VFS REQUIRE(via_persistent_fs != nullptr); auto marker = kstd::vector{std::byte{'M'}, std::byte{'K'}, std::byte{'N'}, std::byte{'O'}, std::byte{'D'}}; - auto written = (*via_persistent_fs)->get_inode()->write(marker, 0_B); + auto written = (*via_persistent_fs)->inode()->write(marker, 0_B); REQUIRE(written == kstd::bytes{marker.size()}); auto read_back = kstd::vector(marker.size()); - auto read = (*via_devfs)->get_inode()->read(read_back, 0_B); + auto read = (*via_devfs)->inode()->read(read_back, 0_B); REQUIRE(read == kstd::bytes{marker.size()}); REQUIRE(read_back == marker); -- cgit v1.2.3