diff --git a/fs/gpt.c b/fs/gpt.c index fddd6ce..7199495 100644 --- a/fs/gpt.c +++ b/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; diff --git a/include/kernel/block.h b/include/kernel/block.h index 64642ca..5232751 100644 --- a/include/kernel/block.h +++ b/include/kernel/block.h @@ -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);