From 9391c5881a8a635677312df80888e972d7175cfa Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Tue, 17 Mar 2026 09:13:43 +0100 Subject: fix lint issues --- kernel/devices/include/devices/block_device.hpp | 10 +++++----- kernel/devices/include/devices/device.hpp | 12 ++++++------ .../include/devices/storage/ram_disk/ram_disk_device.hpp | 2 +- .../devices/include/devices/storage/storage_controller.hpp | 8 ++++---- .../devices/include/devices/storage/storage_management.hpp | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) (limited to 'kernel/devices/include') diff --git a/kernel/devices/include/devices/block_device.hpp b/kernel/devices/include/devices/block_device.hpp index a2c849f..4831be5 100644 --- a/kernel/devices/include/devices/block_device.hpp +++ b/kernel/devices/include/devices/block_device.hpp @@ -52,20 +52,20 @@ namespace devices * @brief Return logical block size in bytes. * @return One logical block size in bytes. */ - auto block_size() const -> size_t; + [[nodiscard]] auto block_size() const -> size_t; /** * @brief Return device capacity in bytes. * @return Total number of addressable bytes. */ - auto capacity() const -> size_t; + [[nodiscard]] auto capacity() const -> size_t; /** * @brief Override to identify block devices. * @return true if this device is a block device, false otherwise. */ - auto is_block_device() const -> bool override + [[nodiscard]] auto is_block_device() const -> bool override { return true; } @@ -85,14 +85,14 @@ namespace devices * @brief Return total device size in bytes. * @return Total number of addressable bytes. */ - virtual auto size() const -> size_t = 0; + [[nodiscard]] virtual auto size() const -> size_t = 0; /** * @brief Compute transfer information for @p block_index. * @param block_index Zero-based block index. * @return Computed transfer information for one logical block access. */ - auto calculate_transfer(size_t block_index) const -> transfer_info; + [[nodiscard]] auto calculate_transfer(size_t block_index) const -> transfer_info; size_t m_block_size; }; diff --git a/kernel/devices/include/devices/device.hpp b/kernel/devices/include/devices/device.hpp index d1c202d..d6f520f 100644 --- a/kernel/devices/include/devices/device.hpp +++ b/kernel/devices/include/devices/device.hpp @@ -7,12 +7,12 @@ namespace devices { /** - * @brief Base device identified by a major and minor number. + * @brief Base device identified by a major, minor number and name. */ struct device { /** - * @brief Create a device identifier from @p major and @p minor. + * @brief Create a device identifier from @p major, @p minor and @p name. * @param major Device major number. * @param minor Device minor number. * @param name Device name. @@ -28,25 +28,25 @@ namespace devices * @brief Returns the major number of the device. * @return Device major number. */ - auto major() const -> size_t; + [[nodiscard]] auto major() const -> size_t; /** * @brief Returns the minor number of the device. * @return Device minor number. */ - auto minor() const -> size_t; + [[nodiscard]] auto minor() const -> size_t; /** * @brief Returns the name of the device. * @return Device name. */ - auto name() const -> std::string_view; + [[nodiscard]] auto name() const -> std::string_view; /** * @brief Check if the device is a block device. * @return true if this device is a block device, false otherwise. */ - virtual auto is_block_device() const -> bool + [[nodiscard]] virtual auto is_block_device() const -> bool { return false; } diff --git a/kernel/devices/include/devices/storage/ram_disk/ram_disk_device.hpp b/kernel/devices/include/devices/storage/ram_disk/ram_disk_device.hpp index eebbcd7..678ee99 100644 --- a/kernel/devices/include/devices/storage/ram_disk/ram_disk_device.hpp +++ b/kernel/devices/include/devices/storage/ram_disk/ram_disk_device.hpp @@ -45,7 +45,7 @@ namespace devices::storage::ram_disk /** * @brief Return module size in bytes. */ - auto size() const -> size_t override; + [[nodiscard]] auto size() const -> size_t override; kapi::boot_modules::boot_module m_boot_module{}; }; diff --git a/kernel/devices/include/devices/storage/storage_controller.hpp b/kernel/devices/include/devices/storage/storage_controller.hpp index 0518e32..d10d27d 100644 --- a/kernel/devices/include/devices/storage/storage_controller.hpp +++ b/kernel/devices/include/devices/storage/storage_controller.hpp @@ -37,17 +37,17 @@ namespace devices::storage * @brief Return the assigned major number. * @return Assigned major number. */ - auto major() const -> size_t; + [[nodiscard]] auto major() const -> size_t; /** * @brief Return the number of devices managed by this controller. * @return Number of managed devices. */ - auto devices_count() const -> size_t; + [[nodiscard]] auto devices_count() const -> size_t; // TODO BA-FS26 add comment // TODO BA-FS26 use kstd::vector when available - auto all_devices() const -> std::array const &; + [[nodiscard]] auto all_devices() const -> std::array const &; /** * @brief Find a managed device by major/minor numbers. @@ -55,7 +55,7 @@ namespace devices::storage * @param minor Device minor number. * @return Matching block device, or nullptr if no device matches. */ - auto device_by_minor(size_t minor) const -> device *; + [[nodiscard]] auto device_by_minor(size_t minor) const -> device *; protected: size_t m_major{}; diff --git a/kernel/devices/include/devices/storage/storage_management.hpp b/kernel/devices/include/devices/storage/storage_management.hpp index 4bc7cbd..550db65 100644 --- a/kernel/devices/include/devices/storage/storage_management.hpp +++ b/kernel/devices/include/devices/storage/storage_management.hpp @@ -44,7 +44,7 @@ namespace devices::storage // TODO BA-FS26 add comment // TODO BA-FS26 use kstd::vector when available - auto all_controllers() const -> std::array const &; + [[nodiscard]] auto all_controllers() const -> std::array const &; /** * @brief Find a device by major/minor numbers. -- cgit v1.2.3