- 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
#include "blockdev.h"
#include <stdint.h>
+struct partition;
struct ext2_group_desc;
/* Per-mount filesystem state */
* 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);
#include "ext2.h"
#include "fs.h"
#include "blockdev.h"
+#include "partition.h"
#include "heap.h"
#include "utils.h"
#include "console.h"
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);
+}