From 6eda6f0649bf325a29bb891287aa95c5814be982 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 24 Jul 2026 23:31:13 +0200 Subject: kapi: rename block and character device --- kapi/kapi/filesystem.hpp | 10 ++--- kapi/kapi/filesystem/block_device.hpp | 51 ------------------------- kapi/kapi/filesystem/block_special_file.hpp | 51 +++++++++++++++++++++++++ kapi/kapi/filesystem/character_device.hpp | 39 ------------------- kapi/kapi/filesystem/character_special_file.hpp | 39 +++++++++++++++++++ 5 files changed, 95 insertions(+), 95 deletions(-) delete mode 100644 kapi/kapi/filesystem/block_device.hpp create mode 100644 kapi/kapi/filesystem/block_special_file.hpp delete mode 100644 kapi/kapi/filesystem/character_device.hpp create mode 100644 kapi/kapi/filesystem/character_special_file.hpp (limited to 'kapi') diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp index 6796532f..161a1019 100644 --- a/kapi/kapi/filesystem.hpp +++ b/kapi/kapi/filesystem.hpp @@ -1,11 +1,11 @@ #ifndef TEACHOS_KAPI_FILESYSTEM_HPP #define TEACHOS_KAPI_FILESYSTEM_HPP -#include // IWYU pragma: export -#include // IWYU pragma: export -#include // IWYU pragma: export -#include // IWYU pragma: export -#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export +#include // IWYU pragma: export #include #include diff --git a/kapi/kapi/filesystem/block_device.hpp b/kapi/kapi/filesystem/block_device.hpp deleted file mode 100644 index 6d062b07..00000000 --- a/kapi/kapi/filesystem/block_device.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef TEACHOS_KAPI_FILESYSTEM_BLOCK_DEVICE_HPP -#define TEACHOS_KAPI_FILESYSTEM_BLOCK_DEVICE_HPP - -// IWYU pragma: private, include - -#include - -#include -#include - -#include - -namespace kapi::filesystem -{ - - struct block_device - { - constexpr auto static id = kapi::devices::interface_id{"block"}; - - //! Virtual destructor to enable clean deletes through base pointers. - virtual ~block_device() = default; - - //! Read data from a block into a given buffer. - //! - //! If the selected block is smaller than the buffer, a partial read will occur. - //! - //! @param block_index The number of the block to read from. - //! @param buffer The buffer to read into. - //! @return The number of bytes read on success, an error otherwise. - [[nodiscard]] auto virtual read_block(size_t block_index, void * buffer) const - -> kstd::result = 0; - - //! Write data from a buffer into a block. - //! - //! If the buffer is larger than the selected block, a partial write will occur. - //! - //! @param block_index The number of the block to write to. - //! @param buffer The buffer to write from. - //! @return The number of bytes written on success, an error otherwise. - auto virtual write_block(std::size_t block_index, void const * buffer) -> kstd::result = 0; - - //! Get the block size in bytes. - [[nodiscard]] auto virtual block_size() const -> kstd::units::bytes = 0; - - //! Get the capacity of the associated device. - [[nodiscard]] auto virtual capacity() const -> kstd::units::bytes = 0; - }; - -} // namespace kapi::filesystem - -#endif \ No newline at end of file diff --git a/kapi/kapi/filesystem/block_special_file.hpp b/kapi/kapi/filesystem/block_special_file.hpp new file mode 100644 index 00000000..6e125117 --- /dev/null +++ b/kapi/kapi/filesystem/block_special_file.hpp @@ -0,0 +1,51 @@ +#ifndef TEACHOS_KAPI_FILESYSTEM_BLOCK_SPECIAL_FILE_HPP +#define TEACHOS_KAPI_FILESYSTEM_BLOCK_SPECIAL_FILE_HPP + +// IWYU pragma: private, include + +#include + +#include +#include + +#include + +namespace kapi::filesystem +{ + + struct block_special_file + { + constexpr auto static id = kapi::devices::interface_id{"block"}; + + //! Virtual destructor to enable clean deletes through base pointers. + virtual ~block_special_file() = default; + + //! Read data from a block into a given buffer. + //! + //! If the selected block is smaller than the buffer, a partial read will occur. + //! + //! @param block_index The number of the block to read from. + //! @param buffer The buffer to read into. + //! @return The number of bytes read on success, an error otherwise. + [[nodiscard]] auto virtual read_block(size_t block_index, void * buffer) const + -> kstd::result = 0; + + //! Write data from a buffer into a block. + //! + //! If the buffer is larger than the selected block, a partial write will occur. + //! + //! @param block_index The number of the block to write to. + //! @param buffer The buffer to write from. + //! @return The number of bytes written on success, an error otherwise. + auto virtual write_block(std::size_t block_index, void const * buffer) -> kstd::result = 0; + + //! Get the block size in bytes. + [[nodiscard]] auto virtual block_size() const -> kstd::units::bytes = 0; + + //! Get the capacity of the associated device. + [[nodiscard]] auto virtual capacity() const -> kstd::units::bytes = 0; + }; + +} // namespace kapi::filesystem + +#endif \ No newline at end of file diff --git a/kapi/kapi/filesystem/character_device.hpp b/kapi/kapi/filesystem/character_device.hpp deleted file mode 100644 index b839410d..00000000 --- a/kapi/kapi/filesystem/character_device.hpp +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef TEACHOS_KAPI_FILESYSTEM_CHARACTER_DEVICE_HPP -#define TEACHOS_KAPI_FILESYSTEM_CHARACTER_DEVICE_HPP - -// IWYU pragma: private, include - -#include - -#include -#include - -#include -#include - -namespace kapi::filesystem -{ - - struct character_device - { - constexpr auto static id = kapi::devices::interface_id{"char"}; - - //! Virtual destructor to enable clean deletes through base pointers. - virtual ~character_device() = default; - - //! Read data from the stream into a given buffer. - //! - //! @param buffer The buffer to read into. - //! @return The number of bytes read on success, an error otherwise. - [[nodiscard]] auto virtual read(std::span buffer) const -> kstd::result = 0; - - //! Write data from a buffer into the stream. - //! - //! @param buffer The buffer to write from. - //! @return The number of bytes written on success, an error otherwise. - auto virtual write_block(std::span buffer) -> kstd::result = 0; - }; - -} // namespace kapi::filesystem - -#endif \ No newline at end of file diff --git a/kapi/kapi/filesystem/character_special_file.hpp b/kapi/kapi/filesystem/character_special_file.hpp new file mode 100644 index 00000000..d7bc8c64 --- /dev/null +++ b/kapi/kapi/filesystem/character_special_file.hpp @@ -0,0 +1,39 @@ +#ifndef TEACHOS_KAPI_FILESYSTEM_CHARACTER_SPECIAL_FILE_HPP +#define TEACHOS_KAPI_FILESYSTEM_CHARACTER_SPECIAL_FILE_HPP + +// IWYU pragma: private, include + +#include + +#include +#include + +#include +#include + +namespace kapi::filesystem +{ + + struct character_special_file + { + constexpr auto static id = kapi::devices::interface_id{"char"}; + + //! Virtual destructor to enable clean deletes through base pointers. + virtual ~character_special_file() = default; + + //! Read data from the stream into a given buffer. + //! + //! @param buffer The buffer to read into. + //! @return The number of bytes read on success, an error otherwise. + [[nodiscard]] auto virtual read(std::span buffer) const -> kstd::result = 0; + + //! Write data from a buffer into the stream. + //! + //! @param buffer The buffer to write from. + //! @return The number of bytes written on success, an error otherwise. + auto virtual write_block(std::span buffer) -> kstd::result = 0; + }; + +} // namespace kapi::filesystem + +#endif \ No newline at end of file -- cgit v1.2.3