From 5801be615a50bf465a9663b7f75cafbcf0870f5c Mon Sep 17 00:00:00 2001 From: Lukas Oesch Date: Tue, 17 Mar 2026 11:49:13 +0100 Subject: use kstd::vector instead of std::array and replace plain-pointers with kstd::shared_ptr --- .../include/devices/storage/ram_disk/ram_disk_device.hpp | 2 -- .../include/devices/storage/storage_controller.hpp | 11 ++++++----- .../include/devices/storage/storage_management.hpp | 15 ++++++++------- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'kernel/devices/include') 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 678ee99..1edf48c 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 @@ -14,8 +14,6 @@ namespace devices::storage::ram_disk */ struct ram_disk_device : block_device { - ram_disk_device(); // TODO BA-FS26 remove when kstd::vector is available - /** * @brief Create a RAM disk for the @p module. * @param module Boot module providing the memory region. diff --git a/kernel/devices/include/devices/storage/storage_controller.hpp b/kernel/devices/include/devices/storage/storage_controller.hpp index d10d27d..e90b01c 100644 --- a/kernel/devices/include/devices/storage/storage_controller.hpp +++ b/kernel/devices/include/devices/storage/storage_controller.hpp @@ -3,7 +3,9 @@ #include "devices/device.hpp" -#include +#include +#include + #include namespace devices::storage @@ -46,8 +48,7 @@ namespace devices::storage [[nodiscard]] auto devices_count() const -> size_t; // TODO BA-FS26 add comment - // TODO BA-FS26 use kstd::vector when available - [[nodiscard]] auto all_devices() const -> std::array const &; + [[nodiscard]] auto all_devices() const -> kstd::vector> const &; /** * @brief Find a managed device by major/minor numbers. @@ -55,12 +56,12 @@ namespace devices::storage * @param minor Device minor number. * @return Matching block device, or nullptr if no device matches. */ - [[nodiscard]] auto device_by_minor(size_t minor) const -> device *; + [[nodiscard]] auto device_by_minor(size_t minor) const -> kstd::shared_ptr; protected: size_t m_major{}; size_t m_minors_per_device{}; - std::array m_devices{}; // TODO BA-FS26 use kstd::vector when available + kstd::vector> m_devices{}; }; } // namespace devices::storage diff --git a/kernel/devices/include/devices/storage/storage_management.hpp b/kernel/devices/include/devices/storage/storage_management.hpp index 550db65..dc2f6c9 100644 --- a/kernel/devices/include/devices/storage/storage_management.hpp +++ b/kernel/devices/include/devices/storage/storage_management.hpp @@ -4,7 +4,9 @@ #include "devices/device.hpp" #include "devices/storage/storage_controller.hpp" -#include +#include +#include + #include namespace devices::storage @@ -40,11 +42,10 @@ namespace devices::storage * * Assigns controller IDs (major number range and minors per device). */ - auto add_controller(storage_controller * controller) -> void; + auto add_controller(kstd::shared_ptr controller) -> void; // TODO BA-FS26 add comment - // TODO BA-FS26 use kstd::vector when available - [[nodiscard]] auto all_controllers() const -> std::array const &; + [[nodiscard]] auto all_controllers() const -> kstd::vector> const &; /** * @brief Find a device by major/minor numbers. @@ -52,13 +53,13 @@ namespace devices::storage * @param minor Device minor number. * @return Matching device, or nullptr if no device matches. */ - auto device_by_major_minor(size_t major, size_t minor) -> device *; + auto device_by_major_minor(size_t major, size_t minor) -> kstd::shared_ptr; /** * @brief Determine the boot device. * @return Boot device, or nullptr if it cannot be determined. */ - auto determine_boot_device() -> device *; + auto determine_boot_device() -> kstd::shared_ptr; private: /** @@ -66,7 +67,7 @@ namespace devices::storage */ storage_management() = default; - std::array m_controllers{}; // TODO BA-FS26 use kstd::vector when available + kstd::vector> m_controllers{}; }; } // namespace devices::storage -- cgit v1.2.3