diff options
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/filesystem.hpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp index 02f174e9..5346a96d 100644 --- a/kapi/kapi/filesystem.hpp +++ b/kapi/kapi/filesystem.hpp @@ -2,7 +2,6 @@ #define TEACHOS_KAPI_FILESYSTEM_HPP #include <kstd/system_error.hpp> -#include <kstd/unikstd.h> #include <cstddef> #include <expected> @@ -22,23 +21,23 @@ namespace kapi::filesystem @brief Mounts a filesystem from the specified @p source at the specified @p target path. @param source The source device or filesystem to mount. @param target The target mount point. - @return 0 on success, -1 on failure. + @return Nothing on success, an error code otherwise. @qualifier kernel-defined */ - auto mount(std::string_view source, std::string_view target) -> kstd::ssize_t; + auto mount(std::string_view source, std::string_view target) -> std::expected<void, kstd::error_code>; /** @brief Unmounts a filesystem from the specified @p target path. @param target The target mount point to unmount. - @return 0 on success, -1 on failure. + @return Nothing on success, an error code otherwise. @qualifier kernel-defined */ - auto umount(std::string_view target) -> kstd::ssize_t; + auto umount(std::string_view target) -> std::expected<void, kstd::error_code>; /** @brief Opens a file at the specified @p path. @param path The path to the file to open. - @return A file descriptor on success, -1 on failure. + @return A file descriptor on success, an error code otherwise. @qualifier kernel-defined */ auto open(std::string_view path) -> std::expected<std::size_t, kstd::error_code>; @@ -46,30 +45,30 @@ namespace kapi::filesystem /** @brief Closes a @p file_descriptor. @param file_descriptor The file descriptor to close. - @return 0 on success, -1 on failure. + @return Nothing on success, an error code otherwise . @qualifier kernel-defined */ - auto close(size_t file_descriptor) -> kstd::ssize_t; + auto close(size_t file_descriptor) -> std::expected<void, kstd::error_code>; /** @brief Reads @p size bytes into @p buffer from a @p file_descriptor. @param file_descriptor The file descriptor to read from. @param buffer The buffer to store the read data. @param size The number of bytes to read. - @return The number of bytes read on success, -1 on failure. + @return The number of bytes read on success, an error code otherwise. @qualifier kernel-defined */ - auto read(size_t file_descriptor, void * buffer, size_t size) -> kstd::ssize_t; + auto read(size_t file_descriptor, void * buffer, size_t size) -> std::expected<std::size_t, kstd::error_code>; /** @brief Writes @p size bytes from @p buffer to a @p file_descriptor. @param file_descriptor The file descriptor to write to. @param buffer The buffer containing the data to write. @param size The number of bytes to write. - @return The number of bytes written on success, -1 on failure. + @return The number of bytes written on success, an error code otherwise. @qualifier kernel-defined */ - auto write(size_t file_descriptor, void const * buffer, size_t size) -> kstd::ssize_t; + auto write(size_t file_descriptor, void const * buffer, size_t size) -> std::expected<std::size_t, kstd::error_code>; } // namespace kapi::filesystem #endif // TEACHOS_KAPI_FILESYSTEM_HPP
\ No newline at end of file |
