mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
Kernel: Make enumerate_disk_partitions function not const
The enumerate_disk_partitions function doesn't need to be const. Remove the constness and use the newly added `add_partition` function.
This commit is contained in:
parent
2c810332b6
commit
9ae2285675
2 changed files with 4 additions and 6 deletions
|
@ -110,10 +110,9 @@ UNMAP_AFTER_INIT OwnPtr<PartitionTable> StorageManagement::try_to_initialize_par
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() const
|
UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions()
|
||||||
{
|
{
|
||||||
VERIFY(!m_storage_devices.is_empty());
|
VERIFY(!m_storage_devices.is_empty());
|
||||||
NonnullRefPtrVector<DiskPartition> partitions;
|
|
||||||
size_t device_index = 0;
|
size_t device_index = 0;
|
||||||
for (auto& device : m_storage_devices) {
|
for (auto& device : m_storage_devices) {
|
||||||
auto partition_table = try_to_initialize_partition_table(device);
|
auto partition_table = try_to_initialize_partition_table(device);
|
||||||
|
@ -124,9 +123,8 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_disk_partitions() const
|
||||||
if (!partition_metadata.has_value())
|
if (!partition_metadata.has_value())
|
||||||
continue;
|
continue;
|
||||||
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
|
// FIXME: Try to not hardcode a maximum of 16 partitions per drive!
|
||||||
auto disk_partition = DiskPartition::create(const_cast<StorageDevice&>(device), (partition_index + (16 * device_index)), partition_metadata.value());
|
auto disk_partition = DiskPartition::create(device, (partition_index + (16 * device_index)), partition_metadata.value());
|
||||||
MUST(partitions.try_append(disk_partition));
|
device.add_partition(disk_partition);
|
||||||
MUST(const_cast<StorageDevice&>(device).m_partitions.try_append(disk_partition));
|
|
||||||
}
|
}
|
||||||
device_index++;
|
device_index++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ private:
|
||||||
|
|
||||||
void enumerate_controllers(bool force_pio);
|
void enumerate_controllers(bool force_pio);
|
||||||
void enumerate_storage_devices();
|
void enumerate_storage_devices();
|
||||||
void enumerate_disk_partitions() const;
|
void enumerate_disk_partitions();
|
||||||
|
|
||||||
void determine_boot_device();
|
void determine_boot_device();
|
||||||
void determine_boot_device_with_partition_uuid();
|
void determine_boot_device_with_partition_uuid();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue