65 lines
1.2 KiB
C
65 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
#ifndef _FAT32_H_
|
|
#define _FAT32_H_
|
|
|
|
#include <fs/vfs.h>
|
|
#include <kernel/block.h>
|
|
|
|
#define FS_TYPE_FAT32 0x46415433 /* "FAT3" */
|
|
|
|
struct fat_bpb {
|
|
char padding[3];
|
|
char oem[8];
|
|
u16 bytes_per_sec;
|
|
u8 secs_per_clr;
|
|
u16 n_reserved_secs;
|
|
u8 n_fats;
|
|
u16 n_root_dirents;
|
|
u16 n_sectors;
|
|
u8 mdt;
|
|
u16 ignore;
|
|
u16 secs_per_trk;
|
|
u16 n_nheads;
|
|
u32 n_hidden;
|
|
u32 n_sectors_long;
|
|
} PACKED;
|
|
|
|
struct f32_ebr {
|
|
struct fat_bpb bpb;
|
|
u32 secs_per_fat;
|
|
u16 flags;
|
|
u16 fat_version;
|
|
u32 root_clr_nio;
|
|
u16 fsinfo_sec_no;
|
|
u16 backup_boot_sec_no;
|
|
char reserved[12];
|
|
u8 drive_no;
|
|
u8 reserved1;
|
|
u8 signature;
|
|
u32 serial_no;
|
|
char vol_label[11];
|
|
char sys_id[8];
|
|
char boot_code[420];
|
|
char boot_signature[2];
|
|
} PACKED;
|
|
|
|
struct f32_fsinfo {
|
|
u32 signature; /* 0x41615252 */
|
|
char reserved[480];
|
|
u32 signature2; /* 0x61417272 */
|
|
u32 last_free_clr_count;
|
|
u32 clr_search_start;
|
|
char reserved2[12];
|
|
u32 trail_signature; /* 0xAA550000 */
|
|
} PACKED;
|
|
|
|
struct f32_sb {
|
|
struct f32_ebr *ebr;
|
|
struct f32_fsinfo *info;
|
|
struct block_device *bdev;
|
|
};
|
|
|
|
int fat32_create(struct block_device *bdev, u64 flags, fs_t **out);
|
|
void fat32_init(void);
|
|
|
|
#endif /* _FAT32_H_ */
|