summaryrefslogtreecommitdiff
path: root/Kernel/Storage/RamdiskDevice.cpp
diff options
context:
space:
mode:
authorJean-Baptiste Boric <jblbeurope@gmail.com>2021-01-21 18:49:56 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-22 22:17:39 +0100
commitf64e287b82fceb81c843bdaf6bad4e608330ae60 (patch)
treec7e326d98481975f97eac54c91bc7d9f24770e9f /Kernel/Storage/RamdiskDevice.cpp
parenta2601e13088d61b796220dbb1085ec74a3f6d9fd (diff)
downloadserenity-f64e287b82fceb81c843bdaf6bad4e608330ae60.zip
Kernel: Make device generate their own names
Besides removing the monolithic DevFSDeviceInode::determine_name() method, being able to determine a device's name inside the /dev hierarchy outside of DevFS has its uses.
Diffstat (limited to 'Kernel/Storage/RamdiskDevice.cpp')
-rw-r--r--Kernel/Storage/RamdiskDevice.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Kernel/Storage/RamdiskDevice.cpp b/Kernel/Storage/RamdiskDevice.cpp
index 1c407f80b8..c73e47b431 100644
--- a/Kernel/Storage/RamdiskDevice.cpp
+++ b/Kernel/Storage/RamdiskDevice.cpp
@@ -82,4 +82,11 @@ void RamdiskDevice::start_request(AsyncBlockDeviceRequest& request)
}
}
+String RamdiskDevice::device_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);
+}
+
}