block: link child partitions to parent bdev

This commit is contained in:
Michael Shaw 2024-03-02 00:35:50 -05:00
commit 20e25dad40
2 changed files with 6 additions and 0 deletions

View file

@ -44,6 +44,7 @@ void block_gpt_init(struct block_device *dev)
* that is found.
*/
size_t used_count = 0;
struct block_device **list = &dev->next_part;
for (size_t i = 0; i < header->entry_count; i++) {
struct gpt_entry *entry = &entries[i];
@ -70,6 +71,9 @@ void block_gpt_init(struct block_device *dev)
bdev->lba_start = entry->lba_first;
bdev->block_count = entry->lba_last - entry->lba_first + 1;
bdev->parent = dev;
*list = bdev;
list = &bdev->next_part;
}
dev->partition_count = used_count;