#ifndef _FAT_FS_H #define _FAT_FS_H #include "types.h" #define FAT_DIR_ENTRY_SIZE 32 #define FAT_ATTR_READ_ONLY 0x01 #define FAT_ATTR_HIDDEN 0x02 #define FAT_ATTR_SYSTEM 0x04 #define FAT_ATTR_VOLUME_ID 0x08 #define FAT_ATTR_DIRECTORY 0x10 #define FAT_ATTR_ARCHIVE 0x20 #define FAT_MAXFILE 256 #define FAT_ATTR_LONG_NAME (FAT_ATTR_READ_ONLY \ | FAT_ATTR_HIDDEN \ | FAT_ATTR_SYSTEM \ | FAT_ATTR_VOLUME_ID) #define FAT_ATTR_VALID (FAT_ATTR_READ_ONLY \ | FAT_ATTR_HIDDEN \ | FAT_ATTR_SYSTEM \ | FAT_ATTR_DIRECTORY \ | FAT_ATTR_ARCHIVE) /* * The fat file system structures */ struct fat_bpb { __u8 jmp_boot[3]; __u8 oem_name[8]; __u16 sector_size; __u8 bxSecPerClust; __u16 bxResSectors; __u8 bxFATs; __u16 bxRootDirEnts; __u16 bxSectors; __u8 media; __u16 bxFATsecs; __u16 sectors_per_track; __u16 num_heads; __u32 num_hidden_sectors; __u32 bsHugeSectors; union { struct { __u8 num_ph_drive; __u8 reserved; __u8 boot_sig; __u32 num_serial; __u8 label[11]; __u8 fstype[8]; } __attribute__ ((packed)) fat12_16; struct { __u32 bxFATsecs_32; __u16 extended_flags; __u16 fs_version; __u32 root_cluster; __u16 fs_info; __u16 backup_boot_sector; __u8 reserved[12]; __u8 num_ph_drive; __u8 reserved1; __u8 boot_sig; __u32 num_serial; __u8 label[11]; __u8 fstype[8]; } __attribute__ ((packed)) fat32; } __attribute__ ((packed)) u; } __attribute__ ((packed)); struct fat_dir_entry { __u8 name[11]; __u8 attr; __u8 nt_reserved; __u8 c_time_tenth; __u16 c_time; __u16 c_date; __u16 a_date; __u16 first_cluster_high; __u16 w_time; __u16 w_date; __u16 first_cluster_low; __u32 file_size; } __attribute__ ((packed)); struct fat_long_name_entry { __u8 id; __u16 name1[5]; __u8 attr; __u8 reserved; __u8 checksum; __u16 name2[6]; __u16 first_cluster; __u16 name3[2]; } __attribute__ ((packed)); #endif /* fat_fs.h */