]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commitdiff
fat: add fat_mount_partition helper (Etapa 4)
authorTulio A M Mendes <[email protected]>
Tue, 26 May 2026 04:02:13 +0000 (01:02 -0300)
committerTulio A M Mendes <[email protected]>
Wed, 3 Jun 2026 04:02:35 +0000 (01:02 -0300)
- 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
src/kernel/fat.c

index 5465a13fbf8eed7bb2e5bd4cfc2c2018737a2e6d..0505eeb54ba192c3c94e7b37d10316af1d28560f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "fs.h"
 #include "blockdev.h"
+#include "partition.h"
 #include <stdint.h>
 
 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);
 
index 8e5991c7f4419780b6ae758b125698eceae74ddd..5b8bd0ee9bd95e307ba62040c77f791e7fe48bb5 100644 (file)
@@ -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);
+}