diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-08-18 13:51:55 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-08-18 13:51:55 +0200 |
| commit | cd665ec172dadd049e7c1830b070f15b58fb9011 (patch) | |
| tree | 42c2eb8ecb984d179263f68cab1c6c2667e8dd2c /kapi | |
| parent | 5754a8591252da5d5eeb4281064f0b82bfdc03a8 (diff) | |
| download | kernel-cd665ec172dadd049e7c1830b070f15b58fb9011.tar.xz kernel-cd665ec172dadd049e7c1830b070f15b58fb9011.zip | |
kstd: flatten units namespace
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/devices/resource.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/filesystem.hpp | 8 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/block_special_file.hpp | 8 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/character_special_file.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/file_status.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/memory/address.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/memory/chunk.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/memory/layout.hpp | 4 |
8 files changed, 17 insertions, 17 deletions
diff --git a/kapi/kapi/devices/resource.hpp b/kapi/kapi/devices/resource.hpp index bcad5dd5..1284ce10 100644 --- a/kapi/kapi/devices/resource.hpp +++ b/kapi/kapi/devices/resource.hpp @@ -78,7 +78,7 @@ namespace kapi::devices //! The physical start address of this range. kapi::memory::physical_address start; //! The size of this range. - kstd::units::bytes size; + kstd::bytes size; }; //! A range of I/O ports. diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp index be754748..78845a00 100644 --- a/kapi/kapi/filesystem.hpp +++ b/kapi/kapi/filesystem.hpp @@ -58,14 +58,14 @@ namespace kapi::filesystem //! @param file_descriptor The file descriptor to read from. //! @param buffer The buffer to store the read data. //! @return The number of bytes read on success, an error code otherwise. - auto read(size_t file_descriptor, std::span<std::byte> buffer) -> kstd::result<kstd::units::bytes>; + auto read(size_t file_descriptor, std::span<std::byte> buffer) -> kstd::result<kstd::bytes>; //! Write bytes from a given buffer to a file descriptor. //! //! @param file_descriptor The file descriptor to write to. //! @param buffer The buffer containing the data to write. //! @return The number of bytes written on success, an error code otherwise. - auto write(size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::units::bytes>; + auto write(size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>; //! Adjust the current position in the file. //! @@ -74,8 +74,8 @@ namespace kapi::filesystem //! @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_direction direction, seek_origin origin) - -> kstd::result<kstd::units::bytes>; + auto seek(size_t file_descriptor, kstd::bytes offset, seek_direction direction, seek_origin origin) + -> kstd::result<kstd::bytes>; //! Create a new directory at the specified path. //! diff --git a/kapi/kapi/filesystem/block_special_file.hpp b/kapi/kapi/filesystem/block_special_file.hpp index 7b06f058..6060c5ea 100644 --- a/kapi/kapi/filesystem/block_special_file.hpp +++ b/kapi/kapi/filesystem/block_special_file.hpp @@ -31,7 +31,7 @@ namespace kapi::filesystem //! @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, std::span<std::byte> buffer) - -> kstd::result<kstd::units::bytes> = 0; + -> kstd::result<kstd::bytes> = 0; //! Write data from a buffer into a block. //! @@ -44,13 +44,13 @@ namespace kapi::filesystem //! @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, std::span<std::byte const> buffer) - -> kstd::result<kstd::units::bytes> = 0; + -> kstd::result<kstd::bytes> = 0; //! Get the block size in bytes. - [[nodiscard]] auto virtual block_size() const -> kstd::units::bytes = 0; + [[nodiscard]] auto virtual block_size() const -> kstd::bytes = 0; //! Get the capacity of the associated device. - [[nodiscard]] auto virtual capacity() const -> kstd::units::bytes = 0; + [[nodiscard]] auto virtual capacity() const -> kstd::bytes = 0; }; } // namespace kapi::filesystem diff --git a/kapi/kapi/filesystem/character_special_file.hpp b/kapi/kapi/filesystem/character_special_file.hpp index a2608489..c63d535b 100644 --- a/kapi/kapi/filesystem/character_special_file.hpp +++ b/kapi/kapi/filesystem/character_special_file.hpp @@ -25,13 +25,13 @@ namespace kapi::filesystem //! //! @param buffer The buffer to read into. //! @return The number of bytes read on success, an error otherwise. - [[nodiscard]] auto virtual read(std::span<std::byte> buffer) -> kstd::result<kstd::units::bytes> = 0; + [[nodiscard]] auto virtual read(std::span<std::byte> buffer) -> kstd::result<kstd::bytes> = 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(std::span<std::byte const> buffer) -> kstd::result<kstd::units::bytes> = 0; + auto virtual write(std::span<std::byte const> buffer) -> kstd::result<kstd::bytes> = 0; }; } // namespace kapi::filesystem diff --git a/kapi/kapi/filesystem/file_status.hpp b/kapi/kapi/filesystem/file_status.hpp index df48f9db..bb3c776a 100644 --- a/kapi/kapi/filesystem/file_status.hpp +++ b/kapi/kapi/filesystem/file_status.hpp @@ -15,7 +15,7 @@ namespace kapi::filesystem struct file_status { std::uint32_t mode{}; - kstd::units::bytes size{}; + kstd::bytes size{}; device_number raw_device{}; std::uint64_t inode_number{}; std::uint32_t link_count{}; diff --git a/kapi/kapi/memory/address.hpp b/kapi/kapi/memory/address.hpp index d176d2b8..8ed6d37a 100644 --- a/kapi/kapi/memory/address.hpp +++ b/kapi/kapi/memory/address.hpp @@ -184,12 +184,12 @@ namespace kapi::memory return static_cast<MaskType>(m_value & mask); } - constexpr auto operator+(kstd::units::bytes n) const noexcept -> address + constexpr auto operator+(kstd::bytes n) const noexcept -> address { return address{m_value + n.value}; } - constexpr auto operator+=(kstd::units::bytes n) noexcept -> address & + constexpr auto operator+=(kstd::bytes n) noexcept -> address & { return *this = *this + n; } diff --git a/kapi/kapi/memory/chunk.hpp b/kapi/kapi/memory/chunk.hpp index 36d83b2e..45e2ccfd 100644 --- a/kapi/kapi/memory/chunk.hpp +++ b/kapi/kapi/memory/chunk.hpp @@ -17,7 +17,7 @@ namespace kapi::memory //! @tparam ChunkType The CRTP type of the deriving class //! @tparam AddressType The type of addresses used to index this chunk //! @tparam Size The size of this chunk. - template<typename ChunkType, typename AddressType, kstd::units::bytes Size> + template<typename ChunkType, typename AddressType, kstd::bytes Size> struct chunk { //! The type of addresses used to index this chunk diff --git a/kapi/kapi/memory/layout.hpp b/kapi/kapi/memory/layout.hpp index a39997ac..bcb27fbc 100644 --- a/kapi/kapi/memory/layout.hpp +++ b/kapi/kapi/memory/layout.hpp @@ -13,12 +13,12 @@ namespace kapi::memory //! The size of a single page of virtual memory. //! //! Platforms that use different sizes of pages are expected to emulate 4 KiB pages towards the kernel. - constexpr auto page_size = kstd::units::KiB(4u); + constexpr auto page_size = kstd::KiB(4u); //! The size of a single frame of physical memory. //! //! Platforms that use different sizes of frames are expected to emulate 4 KiB pages towards the kernel. - constexpr auto frame_size = kstd::units::KiB(4u); + constexpr auto frame_size = kstd::KiB(4u); //! The linear base address of the higher-half direct map. //! |
