diff options
| -rw-r--r-- | kapi/include/kapi/filesystem.hpp | 20 | ||||
| -rw-r--r-- | kapi/include/kapi/syscall_handler/filesystem.hpp | 19 | ||||
| -rw-r--r-- | kernel/kapi/filesystem.cpp (renamed from kernel/kapi/syscall_handler/filesystem.cpp) | 13 |
3 files changed, 27 insertions, 25 deletions
diff --git a/kapi/include/kapi/filesystem.hpp b/kapi/include/kapi/filesystem.hpp new file mode 100644 index 0000000..dba5d54 --- /dev/null +++ b/kapi/include/kapi/filesystem.hpp @@ -0,0 +1,20 @@ +#ifndef TEACHOS_KAPI_FILESYSTEM_HPP +#define TEACHOS_KAPI_FILESYSTEM_HPP + +#include <cstddef> +#include <string_view> +#include <sys/types.h> + +namespace kapi::filesystem +{ + auto mount(std::string_view source, std::string_view target) -> int; + auto umount(std::string_view target) -> int; + + auto open(std::string_view path) -> int; + auto close(int fd) -> int; + + auto read(int fd, void * buffer, size_t size) -> ssize_t; + auto write(int fd, void const * buffer, size_t size) -> ssize_t; +} // namespace kapi::filesystem + +#endif // TEACHOS_KAPI_FILESYSTEM_HPP
\ No newline at end of file diff --git a/kapi/include/kapi/syscall_handler/filesystem.hpp b/kapi/include/kapi/syscall_handler/filesystem.hpp deleted file mode 100644 index 86ae4d2..0000000 --- a/kapi/include/kapi/syscall_handler/filesystem.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef TEACHOS_KAPI_SYSCALL_HANDLER_FILESYSTEM_HPP -#define TEACHOS_KAPI_SYSCALL_HANDLER_FILESYSTEM_HPP - -#include <cstddef> -#include <sys/types.h> - -namespace kapi::syscall_handler::filesystem -{ - auto mount(char const * source, char const * target) -> int; - auto umount(char const * target) -> int; - - auto open(char const * path) -> int; - auto close(int fd) -> int; - - auto read(int fd, void * buffer, size_t size) -> ssize_t; - auto write(int fd, void const * buffer, size_t size) -> ssize_t; -} // namespace kapi::syscall_handler::filesystem - -#endif // TEACHOS_KAPI_SYSCALL_HANDLER_FILESYSTEM_HPP
\ No newline at end of file diff --git a/kernel/kapi/syscall_handler/filesystem.cpp b/kernel/kapi/filesystem.cpp index a6e8027..a734ac0 100644 --- a/kernel/kapi/syscall_handler/filesystem.cpp +++ b/kernel/kapi/filesystem.cpp @@ -1,19 +1,20 @@ -#include "kapi/syscall_handler/filesystem.hpp" +#include "kapi/filesystem.hpp" #include "kernel/filesystem/file_descriptor_table.hpp" #include "kernel/filesystem/vfs.hpp" #include <cstddef> +#include <string_view> #include <sys/types.h> -namespace kapi::syscall_handler::filesystem +namespace kapi::filesystem { - auto mount(char const * source, char const * target) -> int + auto mount(std::string_view source, std::string_view target) -> int { // TODO BA-FS26 } - auto umount(char const * target) -> int + auto umount(std::string_view target) -> int { if (kernel::filesystem::vfs::get().unmount(target) == kernel::filesystem::vfs::operation_result::success) { @@ -22,7 +23,7 @@ namespace kapi::syscall_handler::filesystem return -1; } - auto open(char const * path) -> int + auto open(std::string_view path) -> int { if (auto open_file_description = kernel::filesystem::vfs::get().open(path)) { @@ -56,4 +57,4 @@ namespace kapi::syscall_handler::filesystem return -1; } -} // namespace kapi::syscall_handler::filesystem
\ No newline at end of file +} // namespace kapi::filesystem
\ No newline at end of file |
