aboutsummaryrefslogtreecommitdiff
path: root/kapi
diff options
context:
space:
mode:
Diffstat (limited to 'kapi')
-rw-r--r--kapi/kapi/filesystem.hpp8
-rw-r--r--kapi/kapi/filesystem/seek.hpp (renamed from kapi/kapi/filesystem/seek_origin.hpp)14
2 files changed, 16 insertions, 6 deletions
diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp
index 8972f9d3..be754748 100644
--- a/kapi/kapi/filesystem.hpp
+++ b/kapi/kapi/filesystem.hpp
@@ -7,7 +7,7 @@
#include <kapi/filesystem/device_number.hpp> // IWYU pragma: export
#include <kapi/filesystem/file_status.hpp> // IWYU pragma: export
#include <kapi/filesystem/file_type.hpp> // IWYU pragma: export
-#include <kapi/filesystem/seek_origin.hpp> // IWYU pragma: export
+#include <kapi/filesystem/seek.hpp> // IWYU pragma: export
#include <kstd/result.hpp>
#include <kstd/system_error.hpp>
@@ -70,10 +70,12 @@ namespace kapi::filesystem
//! Adjust the current position in the file.
//!
//! @param file_descriptor The file descriptor to seek.
- //! @param offset The offset to seek to, relative to @p origin.
+ //! @param offset The offset to seek to, relative to the origin.
+ //! @param direction The direction to seek towards, relative to the origin.
//! @param origin The origing to seek relatively to.
//! @return The new position in the file on success, an error code otherwise.
- auto seek(size_t file_descriptor, kstd::units::bytes offset, seek_origin origin) -> kstd::result<kstd::units::bytes>;
+ auto seek(size_t file_descriptor, kstd::units::bytes offset, seek_direction direction, seek_origin origin)
+ -> kstd::result<kstd::units::bytes>;
//! Create a new directory at the specified path.
//!
diff --git a/kapi/kapi/filesystem/seek_origin.hpp b/kapi/kapi/filesystem/seek.hpp
index 4307f451..f1006f31 100644
--- a/kapi/kapi/filesystem/seek_origin.hpp
+++ b/kapi/kapi/filesystem/seek.hpp
@@ -1,5 +1,5 @@
-#ifndef TEACHOS_KAPI_FILESYSTEM_SEEK_ORIGIN_HPP
-#define TEACHOS_KAPI_FILESYSTEM_SEEK_ORIGIN_HPP
+#ifndef TEACHOS_KAPI_FILESYSTEM_SEEK_HPP
+#define TEACHOS_KAPI_FILESYSTEM_SEEK_HPP
// IWYU pragma: private, include <kapi/filesystem.hpp>
@@ -7,7 +7,7 @@ namespace kapi::filesystem
{
//! The origin for a seek operation.
- enum class seek_origin
+ enum struct seek_origin
{
//! Seek from the beginning of the file.
beginning,
@@ -17,6 +17,14 @@ namespace kapi::filesystem
end,
};
+ enum struct seek_direction
+ {
+ //! seek forward from the origin.
+ forward,
+ //! seek backward from the origin.
+ backward,
+ };
+
} // namespace kapi::filesystem
#endif \ No newline at end of file