1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

Kernel/Storage: Don't hardcode a maximum of 16 partitions per drive

In the near future, we will be able to figure out connections between
storage devices and their partitions, so there's no need to hardcode 16
partitions per storage device - each storage device should be able to
have "infinite" count of partitions in it, and we should be able to use
and figure out about them.
This commit is contained in:
Liav A 2022-07-23 11:15:35 +03:00 committed by Linus Groh
parent cb68619b7f
commit 1102089f9f
5 changed files with 17 additions and 12 deletions

View file

@ -15,9 +15,7 @@ namespace Kernel {
NonnullRefPtr<RamdiskDevice> RamdiskDevice::create(RamdiskController const& controller, NonnullOwnPtr<Memory::Region>&& region, int major, int minor)
{
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
size_t drive_index = minor / 16;
auto device_name = MUST(KString::formatted("ramdisk{}", drive_index));
auto device_name = MUST(KString::formatted("ramdisk{}", minor));
auto device_or_error = DeviceManagement::try_create_device<RamdiskDevice>(controller, move(region), major, minor, move(device_name));
// FIXME: Find a way to propagate errors