1
0
Fork 0
forked from len0rd/rockbox

struct bpb does not have to be global

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@832 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-30 19:47:56 +00:00
parent 6573d6d4b4
commit 827cee37d7
2 changed files with 43 additions and 44 deletions

View file

@ -114,6 +114,49 @@ struct fsinfo {
#define FSINFO_FREECOUNT 488 #define FSINFO_FREECOUNT 488
#define FSINFO_NEXTFREE 492 #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 first_sector_of_cluster(int cluster);
static int bpb_is_sane(void); static int bpb_is_sane(void);
static void *cache_fat_sector(int secnum); static void *cache_fat_sector(int secnum);

View file

@ -22,47 +22,6 @@
#define SECTOR_SIZE 512 #define SECTOR_SIZE 512
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 fat_direntry struct fat_direntry
{ {
unsigned char name[256]; /* Name plus \0 */ unsigned char name[256]; /* Name plus \0 */
@ -101,9 +60,6 @@ struct fat_file
int sectornum; /* sector number in this cluster */ int sectornum; /* sector number in this cluster */
}; };
/* global FAT info struct */
extern struct bpb fat_bpb;
extern int fat_mount(int startsector); extern int fat_mount(int startsector);
#ifdef DISK_WRITE #ifdef DISK_WRITE