Kernel: Fix ATA disk and partition numbering

This commit is contained in:
Bananymous 2023-07-13 12:12:47 +03:00
parent e341a36287
commit 2576bdbd14
1 changed files with 2 additions and 7 deletions

View File

@ -27,22 +27,17 @@ namespace Kernel
auto devices = controller->devices();
for (size_t i = 0; i < devices.size(); i++)
{
char device_name[4] { 'h', 'd', 'a', '\0' };
device_name[2] += i;
char device_name[4] { 'h', 'd', (char)('a' + i), '\0' };
DevFileSystem::get().add_device(device_name, devices[i]);
if (auto res = devices[i]->initialize_partitions(); res.is_error())
dprintln("{}", res.error());
else
{
char partition_name[5] { 'h', 'd', 'a', '1', '\0' };
partition_name[2] += i;
auto& partitions = devices[i]->partitions();
for (size_t j = 0; j < partitions.size(); j++)
{
partition_name[3] += j;
char partition_name[5] { 'h', 'd', (char)('a' + i), (char)('1' + j), '\0' };
DevFileSystem::get().add_device(partition_name, partitions[j]);
}
}