aboutsummaryrefslogtreecommitdiff
path: root/kernel/devices/src/storage/ram_disk
diff options
context:
space:
mode:
authorLukas Oesch <lukasoesch20@gmail.com>2026-03-17 11:49:13 +0100
committerLukas Oesch <lukasoesch20@gmail.com>2026-03-17 16:44:35 +0100
commit5801be615a50bf465a9663b7f75cafbcf0870f5c (patch)
treee3a6df2863ba9b6b24c76219bc685975be5e69d3 /kernel/devices/src/storage/ram_disk
parent471888c64ed490b1f1dbaa2c2f67a1e8d315905a (diff)
downloadteachos-5801be615a50bf465a9663b7f75cafbcf0870f5c.tar.xz
teachos-5801be615a50bf465a9663b7f75cafbcf0870f5c.zip
use kstd::vector instead of std::array and replace plain-pointers with kstd::shared_ptr
Diffstat (limited to 'kernel/devices/src/storage/ram_disk')
-rw-r--r--kernel/devices/src/storage/ram_disk/ram_disk_controller.cpp15
-rw-r--r--kernel/devices/src/storage/ram_disk/ram_disk_device.cpp4
2 files changed, 2 insertions, 17 deletions
diff --git a/kernel/devices/src/storage/ram_disk/ram_disk_controller.cpp b/kernel/devices/src/storage/ram_disk/ram_disk_controller.cpp
index b57dcfb..3d14faf 100644
--- a/kernel/devices/src/storage/ram_disk/ram_disk_controller.cpp
+++ b/kernel/devices/src/storage/ram_disk/ram_disk_controller.cpp
@@ -4,22 +4,14 @@
#include "devices/storage/ram_disk/ram_disk_device.hpp"
+#include <kstd/memory>
#include <kstd/print>
#include <algorithm>
-#include <array>
#include <cstddef>
-#include <optional>
namespace devices::storage::ram_disk
{
- namespace
- {
- // TODO BA-FS26 @Felix gibts besseren weg (ausser dynamic Memory)
- // TODO BA-FS26 remove again, when dynamic memory available
- constinit auto static active_ram_disk_device = std::optional<ram_disk_device>{};
- } // namespace
-
ram_disk_controller::ram_disk_controller(kapi::boot_modules::boot_module_registry const * registry)
: m_boot_module_registry(registry)
{}
@@ -30,10 +22,7 @@ namespace devices::storage::ram_disk
std::ranges::for_each(*m_boot_module_registry, [this, &current_device_index](auto const & module) {
auto const minor = current_device_index++ * m_minors_per_device;
-
- // TODO BA-FS26 use push_back from kstd::vector when available
- active_ram_disk_device.emplace(module, m_major, minor);
- m_devices.at(0) = &*active_ram_disk_device;
+ m_devices.push_back(kstd::make_shared<ram_disk_device>(module, m_major, minor));
});
}
} // namespace devices::storage::ram_disk \ No newline at end of file
diff --git a/kernel/devices/src/storage/ram_disk/ram_disk_device.cpp b/kernel/devices/src/storage/ram_disk/ram_disk_device.cpp
index 774e949..6ff2a83 100644
--- a/kernel/devices/src/storage/ram_disk/ram_disk_device.cpp
+++ b/kernel/devices/src/storage/ram_disk/ram_disk_device.cpp
@@ -28,10 +28,6 @@ namespace devices::storage::ram_disk
}
} // namespace
- ram_disk_device::ram_disk_device() // TODO BA-FS26 remove when kstd::vector is available
- : block_device(0, 0, determine_device_name(0), RAM_DISK_BLOCK_SIZE)
- {}
-
ram_disk_device::ram_disk_device(kapi::boot_modules::boot_module const & module, size_t major, size_t minor)
: block_device(major, minor, determine_device_name(minor), RAM_DISK_BLOCK_SIZE)
, m_boot_module(module)