diff options
Diffstat (limited to 'kernel/kernel/filesystem/filesystem.hpp')
| -rw-r--r-- | kernel/kernel/filesystem/filesystem.hpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/kernel/kernel/filesystem/filesystem.hpp b/kernel/kernel/filesystem/filesystem.hpp index 1a66c11c..f18422b2 100644 --- a/kernel/kernel/filesystem/filesystem.hpp +++ b/kernel/kernel/filesystem/filesystem.hpp @@ -12,6 +12,7 @@ #include <optional> #include <string_view> +#include <utility> namespace kernel::filesystem { @@ -29,9 +30,9 @@ namespace kernel::filesystem //! @warning This function panics if @p backing_inode is null. //! //! @param backing_inode The inode to probe and mount. - //! @return A pointer to the mounted filesystem instance on success, an error otherwise. + //! @return A pointer to the mounted filesystem and the root of it on success, an error otherwise. auto static probe_and_mount(kstd::shared_ptr<inode> const & backing_inode) - -> kstd::result<kstd::shared_ptr<filesystem>>; + -> kstd::result<std::pair<kstd::shared_ptr<filesystem>, kstd::shared_ptr<inode>>>; //! Initializes the filesystem with the given inode. //! @@ -39,8 +40,8 @@ namespace kernel::filesystem //! filesystem data (e.g. a file on an already mounted filesystem). //! //! @param backing_inode The inode to use as the backing inode for the filesystem. - //! @return Nothing on success, and error otherwise. - virtual auto mount(kstd::shared_ptr<inode> const & backing_inode) -> kstd::result<void>; + //! @return The root inode of the mounted filesystem on success, and error otherwise. + virtual auto mount(kstd::shared_ptr<inode> const & backing_inode) -> kstd::result<kstd::shared_ptr<inode>> = 0; //! Find a child inode below the given parent inode with the specified name. //! @@ -65,18 +66,12 @@ namespace kernel::filesystem std::optional<kapi::filesystem::device_number> raw_device = std::nullopt) -> kstd::result<kstd::shared_ptr<inode>> = 0; - //! Get the root inode of the file system. - //! - //! @return A reference to the root inode. - [[nodiscard]] auto root_inode() const -> kstd::shared_ptr<inode> const &; - //! Get the backing inode of the file system. //! //! @return A reference to the backing inode. [[nodiscard]] auto backing_inode() const -> kstd::shared_ptr<inode> const &; protected: - kstd::shared_ptr<inode> m_root_inode{}; kstd::shared_ptr<inode> m_backing_inode{}; }; |
