From: Tulio A M Mendes Date: Tue, 26 May 2026 04:05:55 +0000 (-0300) Subject: ext2: add ext2_mount_partition helper (Etapa 5) X-Git-Url: https://projects.tadryanom.me/?a=commitdiff_plain;h=674f823c045eeb46865bf5c16036d7bc6f8c6141;p=AdrOS.git ext2: add ext2_mount_partition helper (Etapa 5) - Added ext2_mount_partition(partition_t*) helper function - Extracts parent block device and start_lba from partition - Calls ext2_mount with extracted parameters - Maintains compatibility with existing ext2_mount signature - Tests: 124/124 PASS --- diff --git a/include/ext2.h b/include/ext2.h index 04098a99..29d22352 100644 --- a/include/ext2.h +++ b/include/ext2.h @@ -14,6 +14,7 @@ #include "blockdev.h" #include +struct partition; struct ext2_group_desc; /* Per-mount filesystem state */ @@ -37,6 +38,9 @@ struct ext2_mount { * LBA offset. Returns a mount result with root node and superblock, or {NULL, NULL} on failure. */ vfs_mount_result_t ext2_mount(block_device_t* bdev, uint32_t partition_lba); +/* Mount ext2 filesystem from a partition (uses partition's parent and start_lba) */ +vfs_mount_result_t ext2_mount_partition(struct partition* part); + /* Unmount an ext2 filesystem and free its resources */ void ext2_umount(struct ext2_mount* em); diff --git a/src/kernel/ext2.c b/src/kernel/ext2.c index 677ce5d5..371ff64d 100644 --- a/src/kernel/ext2.c +++ b/src/kernel/ext2.c @@ -10,6 +10,7 @@ #include "ext2.h" #include "fs.h" #include "blockdev.h" +#include "partition.h" #include "heap.h" #include "utils.h" #include "console.h" @@ -1571,3 +1572,11 @@ void ext2_umount(struct ext2_mount* em) { kfree(em); } } + +vfs_mount_result_t ext2_mount_partition(struct partition* part) { + if (!part || !part->parent) { + vfs_mount_result_t result = {NULL, NULL}; + return result; + } + return ext2_mount(part->parent, part->start_lba); +}