diff options
Diffstat (limited to 'kapi')
| -rw-r--r-- | kapi/kapi/cpu.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/devices.hpp | 5 | ||||
| -rw-r--r-- | kapi/kapi/filesystem.hpp | 27 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/file_status.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/filesystem/file_type.hpp | 4 | ||||
| -rw-r--r-- | kapi/kapi/interrupts.hpp | 2 | ||||
| -rw-r--r-- | kapi/kapi/test_support/devices.hpp | 4 |
7 files changed, 26 insertions, 22 deletions
diff --git a/kapi/kapi/cpu.hpp b/kapi/kapi/cpu.hpp index ce35c18b..18ff104e 100644 --- a/kapi/kapi/cpu.hpp +++ b/kapi/kapi/cpu.hpp @@ -19,7 +19,7 @@ namespace kapi::cpu struct exception { //! The type of the exception, which identifies the reason for it being raised. - enum class type : std::uint8_t + enum struct type : std::uint8_t { //! The reason for the exception is unknown or platform-specific unknown, diff --git a/kapi/kapi/devices.hpp b/kapi/kapi/devices.hpp index 21ecde14..c4bda9b9 100644 --- a/kapi/kapi/devices.hpp +++ b/kapi/kapi/devices.hpp @@ -46,7 +46,7 @@ namespace kapi::devices //! @param device The device to publish the facet for. //! @param name A stable name for the device. template<typename Facet> - auto publish_facet(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void> + [[nodiscard]] auto publish_facet(kstd::shared_ptr<device> device, kstd::string name) -> kstd::result<void> { return facet_registry::get().publish<Facet>(device, std::move(name)); } @@ -58,7 +58,8 @@ namespace kapi::devices //! @param name A stable name for the device. //! @param implementation The implementation of the facet for the device. template<typename Facet> - auto publish_facet(kstd::shared_ptr<device> device, kstd::string name, Facet * implementation) -> kstd::result<void> + [[nodiscard]] auto publish_facet(kstd::shared_ptr<device> device, kstd::string name, Facet * implementation) + -> kstd::result<void> { return facet_registry::get().publish(device, std::move(name), implementation); } diff --git a/kapi/kapi/filesystem.hpp b/kapi/kapi/filesystem.hpp index 99466dfd..076edbb3 100644 --- a/kapi/kapi/filesystem.hpp +++ b/kapi/kapi/filesystem.hpp @@ -36,39 +36,39 @@ namespace kapi::filesystem //! @param source The source device or filesystem to mount. //! @param target The target mount point. //! @return Nothing on success, an error code otherwise. - auto mount(std::string_view source, std::string_view target) -> kstd::result<void>; + [[nodiscard]] auto mount(std::string_view source, std::string_view target) -> kstd::result<void>; //! Unmount a filesystem from the specified target path. //! //! @param target The target mount point to unmount. //! @return Nothing on success, an error code otherwise. - auto umount(std::string_view target) -> kstd::result<void>; + [[nodiscard]] auto umount(std::string_view target) -> kstd::result<void>; //! Open a file at the specified path. //! //! @param path The path to the file to open. //! @return A file descriptor on success, an error code otherwise. - auto open(std::string_view path) -> kstd::result<std::size_t>; + [[nodiscard]] auto open(std::string_view path) -> kstd::result<std::size_t>; //! Close a file descriptor. //! //! @param file_descriptor The file descriptor to close. //! @return Nothing on success, an error code otherwise . - auto close(std::size_t file_descriptor) -> kstd::result<void>; + [[nodiscard]] auto close(std::size_t file_descriptor) -> kstd::result<void>; //! Read bytes from a file into a given buffer. //! //! @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(std::size_t file_descriptor, std::span<std::byte> buffer) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto read(std::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(std::size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto write(std::size_t file_descriptor, std::span<std::byte const> buffer) -> kstd::result<kstd::bytes>; //! Adjust the current position in the file. //! @@ -76,13 +76,14 @@ namespace kapi::filesystem //! @param offset The offset to seek to, 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(std::size_t file_descriptor, kstd::offset offset, seek_origin origin) -> kstd::result<kstd::bytes>; + [[nodiscard]] auto seek(std::size_t file_descriptor, kstd::offset offset, seek_origin origin) + -> kstd::result<kstd::bytes>; //! Create a new directory at the specified path. //! //! @param path The path where the new directory should be created. //! @return Nothing on success, an error on failure. - auto mkdir(std::string_view path) -> kstd::result<void>; + [[nodiscard]] auto mkdir(std::string_view path) -> kstd::result<void>; //! Create a new file at the specified path. //! @@ -91,13 +92,13 @@ namespace kapi::filesystem //! //! @param path The path where the new file should be created. //! @return Nothing on success, an error on failure. - auto create(std::string_view path) -> kstd::result<void>; + [[nodiscard]] auto create(std::string_view path) -> kstd::result<void>; //! Get the status information for the file at a given path. //! //! @param path The path to the file to query information for. //! @return A populated file status object on success, an error otherwise. - auto status(std::string_view path) -> kstd::result<file_status>; + [[nodiscard]] auto status(std::string_view path) -> kstd::result<file_status>; //! Create a persistent device node at the given path //! @@ -105,14 +106,16 @@ namespace kapi::filesystem //! @param type The type of device referenced by the new node. //! @param number The number of the reference device. //! @return Nothing on success, an error on failure - auto create_device_node(std::string_view path, file_type type, device_number number) -> kstd::result<void>; + [[nodiscard]] auto create_device_node(std::string_view path, file_type type, device_number number) + -> kstd::result<void>; //! List the contents of a directory. //! //! @param file_descriptor A file descriptor pointing to an open directory. //! @param buffer A buffer to write the directory entries into. //! @return The number of entries read on success, an error otherwise. - auto read_directory(std::size_t file_descriptor, std::span<directory_entry> buffer) -> kstd::result<std::size_t>; + [[nodiscard]] auto read_directory(std::size_t file_descriptor, std::span<directory_entry> buffer) + -> kstd::result<std::size_t>; //! @} } // namespace kapi::filesystem diff --git a/kapi/kapi/filesystem/file_status.hpp b/kapi/kapi/filesystem/file_status.hpp index 25ea16f6..6a57bd6f 100644 --- a/kapi/kapi/filesystem/file_status.hpp +++ b/kapi/kapi/filesystem/file_status.hpp @@ -1,5 +1,5 @@ -#ifndef TEACH_KAPI_FILESYSTEM_FILE_STATUS_HPP -#define TEACH_KAPI_FILESYSTEM_FILE_STATUS_HPP +#ifndef TEACHOS_KAPI_FILESYSTEM_FILE_STATUS_HPP +#define TEACHOS_KAPI_FILESYSTEM_FILE_STATUS_HPP // IWYU pragma: private, include <kapi/filesystem.hpp> diff --git a/kapi/kapi/filesystem/file_type.hpp b/kapi/kapi/filesystem/file_type.hpp index 6b1124bf..3aef28c9 100644 --- a/kapi/kapi/filesystem/file_type.hpp +++ b/kapi/kapi/filesystem/file_type.hpp @@ -1,5 +1,5 @@ -#ifndef TEACH_KAPI_FILESYSTEM_FILE_TYPE_HPP -#define TEACH_KAPI_FILESYSTEM_FILE_TYPE_HPP +#ifndef TEACHOS_KAPI_FILESYSTEM_FILE_TYPE_HPP +#define TEACHOS_KAPI_FILESYSTEM_FILE_TYPE_HPP // IWYU pragma: private, include <kapi/filesystem.hpp> diff --git a/kapi/kapi/interrupts.hpp b/kapi/kapi/interrupts.hpp index 41710c2b..9e41b727 100644 --- a/kapi/kapi/interrupts.hpp +++ b/kapi/kapi/interrupts.hpp @@ -12,7 +12,7 @@ namespace kapi::interrupts //! @{ //! A status that indicates whether an interrupt was handled by a handler. - enum class status : bool + enum struct status : bool { //! The interrupt was not handled by any handler. unhandled, diff --git a/kapi/kapi/test_support/devices.hpp b/kapi/kapi/test_support/devices.hpp index 623bb87a..9c5e29ac 100644 --- a/kapi/kapi/test_support/devices.hpp +++ b/kapi/kapi/test_support/devices.hpp @@ -1,5 +1,5 @@ -#ifndef KAPI_TEST_SUPPORT_DEVICES_HPP -#define KAPI_TEST_SUPPORT_DEVICES_HPP +#ifndef TEACHOS_KAPI_TEST_SUPPORT_DEVICES_HPP +#define TEACHOS_KAPI_TEST_SUPPORT_DEVICES_HPP namespace kapi::test_support::devices { |
