summaryrefslogtreecommitdiff
path: root/Kernel/Storage/RamdiskDevice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Storage/RamdiskDevice.cpp')
-rw-r--r--Kernel/Storage/RamdiskDevice.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/Kernel/Storage/RamdiskDevice.cpp b/Kernel/Storage/RamdiskDevice.cpp
index baa859181e..5f18732231 100644
--- a/Kernel/Storage/RamdiskDevice.cpp
+++ b/Kernel/Storage/RamdiskDevice.cpp
@@ -15,14 +15,20 @@ namespace Kernel {
NonnullRefPtr<RamdiskDevice> RamdiskDevice::create(const RamdiskController& controller, NonnullOwnPtr<Memory::Region>&& region, int major, int minor)
{
- auto device_or_error = DeviceManagement::try_create_device<RamdiskDevice>(controller, move(region), major, minor);
+ // FIXME: Try to not hardcode a maximum of 16 partitions per drive!
+ size_t drive_index = minor / 16;
+ // FIXME: We need a way of formatting strings with KString!
+ auto device_name = String::formatted("ramdisk{}", drive_index);
+ auto device_name_kstring = KString::must_create(device_name.view());
+
+ auto device_or_error = DeviceManagement::try_create_device<RamdiskDevice>(controller, move(region), major, minor, move(device_name_kstring));
// FIXME: Find a way to propagate errors
VERIFY(!device_or_error.is_error());
return device_or_error.release_value();
}
-RamdiskDevice::RamdiskDevice(const RamdiskController& controller, NonnullOwnPtr<Memory::Region>&& region, int major, int minor)
- : StorageDevice(controller, major, minor, 512, region->size() / 512)
+RamdiskDevice::RamdiskDevice(const RamdiskController& controller, NonnullOwnPtr<Memory::Region>&& region, int major, int minor, NonnullOwnPtr<KString> device_name)
+ : StorageDevice(controller, major, minor, 512, region->size() / 512, move(device_name))
, m_region(move(region))
{
dmesgln("Ramdisk: Device #{} @ {}, Capacity={}", minor, m_region->vaddr(), max_addressable_block() * 512);
@@ -59,11 +65,4 @@ void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request)
}
}
-String RamdiskDevice::storage_name() const
-{
- // FIXME: Try to not hardcode a maximum of 16 partitions per drive!
- size_t drive_index = minor() / 16;
- return String::formatted("ramdisk{}", drive_index);
-}
-
}