From 75d9cd0f2b9d1c0ff890f9ceefbf5c34c0bdf10c Mon Sep 17 00:00:00 2001 From: Tulio A M Mendes Date: Tue, 26 May 2026 01:02:13 -0300 Subject: [PATCH] fat: add fat_mount_partition helper (Etapa 4) - Added fat_mount_partition(partition_t*) helper function - Extracts parent block device and start_lba from partition - Calls fat_mount with extracted parameters - Maintains compatibility with existing fat_mount signature - Tests: 124/124 PASS --- include/fat.h | 4 ++++ src/kernel/fat.c | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/include/fat.h b/include/fat.h index 5465a13f..0505eeb5 100644 --- a/include/fat.h +++ b/include/fat.h @@ -12,6 +12,7 @@ #include "fs.h" #include "blockdev.h" +#include "partition.h" #include enum fat_type { @@ -44,6 +45,9 @@ struct fat_mount { * Returns a mount result with root node and superblock, or {NULL, NULL} on failure. */ vfs_mount_result_t fat_mount(block_device_t* bdev, uint32_t partition_lba); +/* Mount FAT filesystem from a partition (uses partition's parent and start_lba) */ +vfs_mount_result_t fat_mount_partition(partition_t* part); + /* Unmount a FAT filesystem and free its resources */ void fat_umount(struct fat_mount* fm); diff --git a/src/kernel/fat.c b/src/kernel/fat.c index 8e5991c7..5b8bd0ee 100644 --- a/src/kernel/fat.c +++ b/src/kernel/fat.c @@ -10,6 +10,7 @@ #include "fat.h" #include "fs.h" #include "blockdev.h" +#include "partition.h" #include "heap.h" #include "utils.h" #include "console.h" @@ -1252,3 +1253,11 @@ void fat_umount(struct fat_mount* fm) { kfree(fm); } } + +vfs_mount_result_t fat_mount_partition(partition_t* part) { + if (!part || !part->parent) { + vfs_mount_result_t result = {NULL, NULL}; + return result; + } + return fat_mount(part->parent, part->start_lba); +} -- 2.43.0