FAT
| Member Type | Member Name |
|---|---|
uint8_t | drive_number |
uint8_t | reserved |
uint8_t | boot_signature |
uint32_t | volume_id |
uint8_t | volume_label[11] |
uint8_t | fs_type[8] |
uint8_t | reserved1[448] |
| Member Type | Member Name |
|---|---|
uint32_t | fat_size_32 |
uint16_t | ext_flags |
uint16_t | fs_version |
uint32_t | root_cluster |
uint16_t | fs_info |
uint16_t | backup_boot_sector |
uint8_t | reserved[12] |
uint8_t | drive_number |
uint8_t | reserved1 |
uint8_t | boot_signature |
uint32_t | volume_id |
uint8_t | volume_label[11] |
uint8_t | fs_type[8] |
uint8_t | reserved2[420] |
| Member Type | Member Name |
|---|---|
uint8_t | jump_boot[3] |
uint8_t | oem_name[8] |
uint16_t | bytes_per_sector |
uint8_t | sectors_per_cluster |
uint16_t | reserved_sector_count |
uint8_t | num_fats |
uint16_t | root_entry_count |
uint16_t | total_sectors_16 |
uint8_t | media |
uint16_t | fat_size_16 |
uint16_t | sectors_per_track |
uint16_t | num_heads |
uint32_t | hidden_sectors |
uint32_t | total_sectors_32 |
union { struct fat32_ext_bpb ext_32; struct fat12_16_ext_bpb ext_12_16; } | None |
| Member Type | Member Name |
|---|---|
uint16_t | day |
uint16_t | month |
uint16_t | year |
| Member Type | Member Name |
|---|---|
uint16_t | second |
uint16_t | minute |
uint16_t | hour |
| Member Type | Member Name |
|---|---|
char | name[11] |
enum fat_fileattr | attr |
uint8_t | ntres |
uint8_t | crttimetenth |
struct fat_time | crttime |
struct fat_date | crtdate |
struct fat_date | lastaccess |
uint16_t | high_cluster |
struct fat_time | modtime |
struct fat_date | moddate |
uint16_t | low_cluster |
uint32_t | filesize |
| Member Type | Member Name |
|---|---|
enum fat_fstype | type |
struct fat_bpb | *bpb |
struct generic_partition | *partition |
struct generic_disk | *disk |
uint32_t | volume_base_lba |
uint32_t | total_clusters |
uint32_t | root_cluster |
uint32_t | cluster_size |
uint32_t | fsinfo_sector |
uint32_t | free_clusters |
uint32_t | last_alloc_cluster |
uint32_t | entries_per_cluster |
uint16_t | fat_size |
uint8_t | boot_signature |
uint8_t | drive_number |
uint32_t | volume_id |
uint8_t | volume_label[11] |
uint8_t | fs_type[8] |
| Name | Value |
|---|---|
FAT_12 | None |
FAT_16 | None |
FAT_32 | None |
| Name | Value |
|---|---|
FAT_RO | 0x01 |
FAT_HIDDEN | 0x02 |
FAT_SYSTEM | 0x04 |
FAT_VOL_ID | 0x08 |
FAT_DIR | 0x10 |
FAT_ARCHIVE | 0x20 |
type alias
Section titled “type alias”(*fat_walk_callback) : bool (struct fat_dirent *, uint32_t, void *)
static inline const char *get_fileattr_string(enum fat_fileattrf)struct fat_bpb *fat32_read_bpb(struct generic_partition*)voidfat12_16_print_bpb(struct fat_bpb*bpb)uint32_tfat_eoc(struct fat_fs*fs)boolfat_is_eoc(struct fat_fs*fs,uint32_t cluster)uint32_tfat_get_dir_cluster(struct fat_dirent*d)voidfat_format_filename_83(char *name,char out[11])uint32_tfat_first_data_sector(struct fat_fs*fs)uint32_tfat_cluster_to_lba(struct fat_fs*fs,uint32_t cluster)struct fat_datefat_get_current_date()struct fat_timefat_get_current_time()struct vfs_node *fat_g_mount(struct generic_partition*p)voidfat_g_print(struct generic_partition*)voidfat32_print_bpb(struct fat_bpb*bpb)voidfat_print_dirent(struct fat_dirent*ent)voidfat_list_root(struct fat_fs*fs)boolfat_read_cluster(struct fat_fs*fs,uint32_t cluster,uint8_t *buffer)boolfat_write_cluster(struct fat_fs*fs,uint32_t cluster,uint8_t *buffer)boolfat_write_dirent(struct fat_fs*fs,uint32_t dir_cluster,struct fat_dirent*dirent_to_write,uint32_t entry_index)boolfat_write_fat_entry(struct fat_fs*fs,uint32_t cluster,uint32_t value)uint32_tfat_read_fat_entry(struct fat_fs*fs,uint32_t cluster)uint32_tfat_alloc_cluster(struct fat_fs*fs)voidfat_free_chain(struct fat_fs*fs,uint32_t start_cluster)voidfat_write_fsinfo(struct fat_fs*fs)boolfat_create(struct fat_fs*fs,uint32_t dir_cluster,char *filename,struct fat_dirent*out_dirent,enum fat_fileattrattr,uint32_t *out_cluster)boolfat_delete(struct fat_fs*fs,uint32_t dir_cluster,char *filename)boolfat_rename(struct fat_fs*fs,uint32_t dir_cluster,char *filename,char *new_filename)boolfat_read_file(struct fat_fs*fs,struct fat_dirent*ent,uint32_t offset,uint32_t size,uint8_t *out_buf)boolfat_write_file(struct fat_fs*fs,struct fat_dirent*ent,uint32_t offset,uint8_t *data,uint32_t size)boolfat_walk_cluster(struct fat_fs*fs,uint32_t cluster,fat_walk_callback cb,void *ctx)struct fat_dirent *fat_lookup(struct fat_fs*fs,uint32_t cluster,char *f,uint32_t *out_index)boolfat_contains(struct fat_fs*fs,uint32_t cluster,char *f)boolfat_mkdir(struct fat_fs*fs,uint32_t parent_cluster,char *name,struct fat_dirent*out_dirent)
Defines
Section titled “Defines”FAT12_PARTITION_TYPE:0x01 // FAT12, CHS addressingFAT16_PARTITION_TYPE:0x04 // FAT16, CHS addressing (less than 32MB)FAT16_PARTITION_TYPE2:0x06 // FAT16, LBA addressing (greater than 32MB)FAT32_PARTITION_TYPE1:0x0B // FAT32, CHS addressingFAT32_PARTITION_TYPE2:0x0C // FAT32, LBA addressingFAT_DIR_CLUSTER_ROOT:0xFFFFFFFF