blob: 040e61f5d4bc4da335680d519b68aa14666345ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "kernel/devices/storage/ram_disk/controller.hpp"
#include "kapi/boot_module/boot_module_registry.hpp"
#include "kernel/devices/storage/ram_disk/device.hpp"
#include <kstd/memory>
#include <algorithm>
#include <cstddef>
namespace kernel::devices::storage::ram_disk
{
controller::controller(kapi::boot_modules::boot_module_registry const * registry)
: m_boot_module_registry(registry)
{}
auto controller::probe() -> void
{
size_t current_device_index = 0;
std::ranges::for_each(*m_boot_module_registry, [this, ¤t_device_index](auto const & module) {
auto const minor = current_device_index++ * m_minors_per_device;
m_devices.push_back(kstd::make_shared<device>(module, m_major, minor));
});
}
} // namespace kernel::devices::storage::ram_disk
|