dosfs.h (1467B)
1 typedef struct Dosboot Dosboot; 2 typedef struct Dos Dos; 3 typedef struct Dosdir Dosdir; 4 typedef struct Dosfile Dosfile; 5 typedef struct Dospart Dospart; 6 7 struct Dospart 8 { 9 uchar flag; /* active flag */ 10 uchar shead; /* starting head */ 11 uchar scs[2]; /* starting cylinder/sector */ 12 uchar type; /* partition type */ 13 uchar ehead; /* ending head */ 14 uchar ecs[2]; /* ending cylinder/sector */ 15 uchar start[4]; /* starting sector */ 16 uchar len[4]; /* length in sectors */ 17 }; 18 19 #define FAT12 0x01 20 #define FAT16 0x04 21 #define EXTEND 0x05 22 #define FATHUGE 0x06 23 #define FAT32 0x0b 24 #define FAT32X 0x0c 25 #define EXTHUGE 0x0f 26 #define DMDDO 0x54 27 #define PLAN9 0x39 28 #define LEXTEND 0x85 29 30 struct Dosfile{ 31 Dos *dos; /* owning dos file system */ 32 char name[8]; 33 char ext[3]; 34 uchar attr; 35 long length; 36 long pstart; /* physical start cluster address */ 37 long pcurrent; /* physical current cluster address */ 38 long lcurrent; /* logical current cluster address */ 39 long offset; 40 }; 41 42 struct Dos{ 43 long start; /* start of file system */ 44 int sectsize; /* in bytes */ 45 int clustsize; /* in sectors */ 46 int clustbytes; /* in bytes */ 47 int nresrv; /* sectors */ 48 int nfats; /* usually 2 */ 49 int rootsize; /* number of entries */ 50 int volsize; /* in sectors */ 51 int mediadesc; 52 int fatsize; /* in sectors */ 53 int fatclusters; 54 int fatbits; /* 12 or 16 */ 55 long fataddr; /* sector number */ 56 long rootaddr; 57 long rootclust; 58 long dataaddr; 59 long freeptr; 60 }; 61 62 extern int dosinit(Fs*);