// // Created by rick on 07-02-21. // #include "fat.h" #include typedef struct { struct { u8 jump[3]; char oem_identifier[8]; u16 bytes_per_sector; u8 sectors_per_cluster; u16 reserved_sectors; u8 fats; u16 directories; u16 total_sectors; u8 media_descriptor; u16 sectors_per_fat; u16 sectors_per_track; u16 heads_sides; u32 hidden_sectors; u32 large_sector_count; } bpb; union { struct { u8 drive_number; u8 flags; u8 signature; u32 serial; u8 label[11]; u8 system_id[8]; } ebr_12_16; struct { u32 sectors_per_fat; u16 flags; u16 fat_version; u32 root_directory; u16 fs_info; u16 backup_boot; u8 reserved[12]; u8 drive_number; u8 flags_nt; u8 signature; u32 serial; u8 label[11]; u8 system_id[8]; } ebr_32; }; } fat_bpb; // steal validation code from here https://github.com/torvalds/linux/blob/fcadab740480e0e0e9fa9bd272acd409884d431a/fs/fat/inode.c#L1456