FAT
include/fs/fat.h View source View on GitHubfat32_ prefixed things are exclusively FAT32 fat_ prefixed things are usable in 12, 16, and 32 fat12_16_ prefixed things are exclusively FAT12/16 etc…
TODO
errno :boom:
Structs
Section titled “Structs”fat12_16_ext_bpb
Section titled “fat12_16_ext_bpb” struct fat12_16_ext_bpb (7 fields) source
fat32_ext_bpb
Section titled “fat32_ext_bpb” struct fat32_ext_bpb (14 fields) source
§
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] fat_bpb
Section titled “fat_bpb” struct fat_bpb (15 fields) source
§
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 total_sectors_32 §
union §
struct fat32_ext_bpb ext_32 §
struct fat12_16_ext_bpb ext_12_16 fat_date
Section titled “fat_date”fat_time
Section titled “fat_time”fat_dirent
Section titled “fat_dirent” struct fat_dirent (12 fields) source
fat_fs
Section titled “fat_fs” struct fat_fs (18 fields) source
§
enum fat_fstype type §
struct block_device *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 below is defined differently in 12/16 and 32
§
uint8_t boot_signature §
uint8_t drive_number §
uint32_t volume_id §
uint8_t volume_label[11] §
uint8_t fs_type[8] fat_fstype
Section titled “fat_fstype”fat_fileattr
Section titled “fat_fileattr” enum fat_fileattr : uint8_t (6 variants) source
Type Aliases
Section titled “Type Aliases”fat_walk_callback
Section titled “fat_walk_callback”typedef bool (*fat_walk_callback)(
struct fat_dirent * *,
uint32_t,
void * *
) source Functions
Section titled “Functions”get_fileattr_string
Section titled “get_fileattr_string”const char * get_fileattr_string(enum fat_fileattr f) source fat32_read_bpb
Section titled “fat32_read_bpb”fat12_16_print_bpb
Section titled “fat12_16_print_bpb”fat_eoc
Section titled “fat_eoc”fat_is_eoc
Section titled “fat_is_eoc”fat_get_dir_cluster
Section titled “fat_get_dir_cluster”uint32_t fat_get_dir_cluster(struct fat_dirent *d) source fat_format_filename_83
Section titled “fat_format_filename_83”void fat_format_filename_83(const char *name, char out[11]) source fat_first_data_sector
Section titled “fat_first_data_sector”fat_cluster_to_lba
Section titled “fat_cluster_to_lba”fat_get_current_date
Section titled “fat_get_current_date”fat_get_current_time
Section titled “fat_get_current_time”fat_g_mount
Section titled “fat_g_mount”fat_g_print
Section titled “fat_g_print”fat32_print_bpb
Section titled “fat32_print_bpb”fat_print_dirent
Section titled “fat_print_dirent”void fat_print_dirent(const struct fat_dirent *ent) source fat_list_root
Section titled “fat_list_root”fat_read_cluster
Section titled “fat_read_cluster”fat_write_cluster
Section titled “fat_write_cluster”fat_write_dirent
Section titled “fat_write_dirent”bool fat_write_dirent(
struct fat_fs *fs,
uint32_t dir_cluster,
const struct fat_dirent *dirent_to_write,
uint32_t entry_index
) source fat_write_fat_entry
Section titled “fat_write_fat_entry”fat_read_fat_entry
Section titled “fat_read_fat_entry”fat_alloc_cluster
Section titled “fat_alloc_cluster”fat_free_chain
Section titled “fat_free_chain”fat_write_fsinfo
Section titled “fat_write_fsinfo”fat_create
Section titled “fat_create”bool fat_create(
struct fat_fs *fs,
uint32_t dir_cluster,
const char *filename,
struct fat_dirent *out_dirent,
enum fat_fileattr attr,
uint32_t *out_cluster
) source fat_delete
Section titled “fat_delete”fat_rename
Section titled “fat_rename”fat_read_file
Section titled “fat_read_file”bool fat_read_file(
struct fat_fs *fs,
struct fat_dirent *ent,
uint32_t offset,
uint32_t size,
uint8_t *out_buf
) source fat_write_file
Section titled “fat_write_file”bool fat_write_file(
struct fat_fs *fs,
struct fat_dirent *ent,
uint32_t offset,
const uint8_t *data,
uint32_t size
) source fat_walk_cluster
Section titled “fat_walk_cluster”bool fat_walk_cluster(
struct fat_fs *fs,
uint32_t cluster,
fat_walk_callback cb,
void *ctx
) source fat_lookup
Section titled “fat_lookup”struct fat_dirent * fat_lookup(
struct fat_fs *fs,
uint32_t cluster,
const char *f,
uint32_t *out_index
) source fat_contains
Section titled “fat_contains”fat_mkdir
Section titled “fat_mkdir”bool fat_mkdir(
struct fat_fs *fs,
uint32_t parent_cluster,
const char *name,
struct fat_dirent *out_dirent
) source Macros
Section titled “Macros”FAT12_PARTITION_TYPE
Section titled “FAT12_PARTITION_TYPE”#define FAT12_PARTITION_TYPE 0x01 source FAT12, CHS addressing
FAT16_PARTITION_TYPE
Section titled “FAT16_PARTITION_TYPE”#define FAT16_PARTITION_TYPE 0x04 source FAT16, CHS addressing (less than 32MB)
FAT16_PARTITION_TYPE2
Section titled “FAT16_PARTITION_TYPE2”#define FAT16_PARTITION_TYPE2 0x06 source FAT16, LBA addressing (greater than 32MB)
FAT32_PARTITION_TYPE1
Section titled “FAT32_PARTITION_TYPE1”#define FAT32_PARTITION_TYPE1 0x0B source FAT32, CHS addressing
FAT32_PARTITION_TYPE2
Section titled “FAT32_PARTITION_TYPE2”#define FAT32_PARTITION_TYPE2 0x0C source FAT32, LBA addressing
FAT_DIR_CLUSTER_ROOT
Section titled “FAT_DIR_CLUSTER_ROOT”#define FAT_DIR_CLUSTER_ROOT 0xFFFFFFFF source