block: link child partitions to parent bdev
This commit is contained in:
parent
b5d8e0a2f7
commit
20e25dad40
2 changed files with 6 additions and 0 deletions
4
fs/gpt.c
4
fs/gpt.c
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ struct block_device {
|
|||
size_t partition_count;
|
||||
|
||||
void *fs;
|
||||
struct block_device *parent;
|
||||
struct block_device *next_part; /* singly linked list */
|
||||
};
|
||||
|
||||
struct block_device *block_register(char *name, struct block_device_ops *ops, void *data, size_t block_count, size_t block_size);
|
||||
|
|
|
|||
Loading…
Reference in a new issue