diff options
Diffstat (limited to 'kernel/kernel/filesystem/vfs.hpp')
| -rw-r--r-- | kernel/kernel/filesystem/vfs.hpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/kernel/filesystem/vfs.hpp b/kernel/kernel/filesystem/vfs.hpp index bb1167fb..ef26aa84 100644 --- a/kernel/kernel/filesystem/vfs.hpp +++ b/kernel/kernel/filesystem/vfs.hpp @@ -8,7 +8,9 @@ #include <kernel/filesystem/mount_table.hpp> #include <kstd/memory.hpp> +#include <kstd/system_error.hpp> +#include <expected> #include <string_view> #include <utility> @@ -58,9 +60,9 @@ namespace kernel::filesystem /** @brief Open a file by its @p path. This method resolves the path and returns the corresponding dentry. @param path The path to the file to open. - @return A shared pointer to the dentry or a null pointer if the file could not be opened. + @return A shared pointer to the dentry on success or an error code on failure. */ - auto open(std::string_view path) -> kstd::shared_ptr<dentry>; + auto open(std::string_view path) -> std::expected<kstd::shared_ptr<dentry>, kstd::error_code>; /** @brief Close a file by its associated @p path. @@ -96,7 +98,7 @@ namespace kernel::filesystem * - find_mount() for the mount context only. */ [[nodiscard]] auto resolve_path_internal(std::string_view path) const - -> std::pair<kstd::shared_ptr<dentry>, kstd::shared_ptr<mount>>; + -> std::expected<std::pair<kstd::shared_ptr<dentry>, kstd::shared_ptr<mount>>, kstd::error_code>; [[nodiscard]] auto resolve_path(std::string_view path) const -> kstd::shared_ptr<dentry>; [[nodiscard]] auto find_mount(std::string_view path) const -> kstd::shared_ptr<mount>; |
