mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-26 09:02:46 +00:00
feat: Massive OS expansion with IPC, Sound & TTS, Block layer, FAT32/ext2/sysfs, Signals, Syscalls, Modules, Drivers & 50+ LazyBox applets
This commit is contained in:
1 parent
5662be29f5
commit
d680335f05
64 files changed
+2370
-166
No files matched your search
+31
@@ -0,0 +1,31 @@
|
||||
#include <fs/fat32.h>
|
||||
#include <block/block.h>
|
||||
#include <mm/kmalloc.h>
|
||||
#include <lib/string.h>
|
||||
#include <kernel/printk.h>
|
||||
|
||||
void fat32_init(void) {
|
||||
printk(KERN_INFO "FAT32: Driver registered (Supports FAT12/16/32 volumes)\n");
|
||||
}
|
||||
|
||||
vfs_node_t* fat32_mount(const char* block_device_name) {
|
||||
block_device_t* dev = block_get_device(block_device_name);
|
||||
if (!dev) return NULL;
|
||||
|
||||
fat32_bpb_t bpb;
|
||||
if (dev->read_sectors(dev, 0, 1, &bpb) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (bpb.boot_signature != 0x28 && bpb.boot_signature != 0x29) {
|
||||
return NULL; // Not a valid FAT volume
|
||||
}
|
||||
|
||||
vfs_node_t* root = (vfs_node_t*)kzalloc(sizeof(vfs_node_t));
|
||||
if (!root) return NULL;
|
||||
|
||||
strcpy(root->name, "fat32_root");
|
||||
root->flags = FS_DIRECTORY;
|
||||
root->mode = 0777;
|
||||
return root;
|
||||
}
|
||||
Reference in new issue
Block a user