diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-05-30 19:47:56 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-05-30 19:47:56 +0000 |
commit | 827cee37d7c005fc7a0f608c1f2b9ea4d3c4f360 (patch) | |
tree | 79bd346fdf3858d9bb53f6de155d97db199260ba /firmware/drivers/fat.c | |
parent | 6573d6d4b4651a80b0daaa1725b14a085b2831c8 (diff) |
struct bpb does not have to be global
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@832 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 88d13c3eab..91019faf0e 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -114,6 +114,49 @@ struct fsinfo { #define FSINFO_FREECOUNT 488 #define FSINFO_NEXTFREE 492 +struct bpb +{ + char bs_oemname[9]; /* OEM string, ending with \0 */ + int bpb_bytspersec; /* Bytes per sectory, typically 512 */ + int bpb_secperclus; /* Sectors per cluster */ + int bpb_rsvdseccnt; /* Number of reserved sectors */ + int bpb_numfats; /* Number of FAT structures, typically 2 */ + int bpb_rootentcnt; /* Number of dir entries in the root */ + int bpb_totsec16; /* Number of sectors on the volume (old 16-bit) */ + int bpb_media; /* Media type (typically 0xf0 or 0xf8) */ + int bpb_fatsz16; /* Number of used sectors per FAT structure */ + int bpb_secpertrk; /* Number of sectors per track */ + int bpb_numheads; /* Number of heads */ + int bpb_hiddsec; /* Hidden sectors before the volume */ + unsigned int bpb_totsec32; /* Number of sectors on the volume + (new 32-bit) */ + int last_word; /* 0xAA55 */ + + /**** FAT12/16 specific *****/ + int bs_drvnum; /* Drive number */ + int bs_bootsig; /* Is 0x29 if the following 3 fields are valid */ + unsigned int bs_volid; /* Volume ID */ + char bs_vollab[12]; /* Volume label, 11 chars plus \0 */ + char bs_filsystype[9]; /* File system type, 8 chars plus \0 */ + + /**** FAT32 specific *****/ + int bpb_fatsz32; + int bpb_extflags; + int bpb_fsver; + int bpb_rootclus; + int bpb_fsinfo; + int bpb_bkbootsec; + + /* variables for internal use */ + int fatsize; + int totalsectors; + int rootdirsector; + int firstdatasector; + int startsector; +}; + +struct bpb fat_bpb; + static int first_sector_of_cluster(int cluster); static int bpb_is_sane(void); static void *cache_fat_sector(int secnum); |