1 typedef struct Dosboot Dosboot;
2 typedef struct Dosboot32 Dosboot32;
3 typedef struct Dosbpb Dosbpb;
4 typedef struct Dosdir Dosdir;
5 typedef struct Dospart Dospart;
6 typedef struct Dosptr Dosptr;
7 typedef struct Fatinfo Fatinfo;
8 typedef struct Xfs Xfs;
9 typedef struct Xfile Xfile;
28 FAT16 = 0x04, /* partitions smaller than 32MB */
29 FATHUGE = 0x06, /* fat16 partitions larger than 32MB */
35 FATRESRV = 2, /* number of reserved fat entries */
39 * dos boot sector, the start of every dos partition
55 uchar bigvolsize[4]; /* same as Dosboot32 up to here */
65 * dos boot sector for FAT32
69 NOFATMIRROR = 0x0080, /* masks for extflags */
87 uchar bigvolsize[4]; /* same as Dosboot up to here */
88 uchar fatsize32[4]; /* sectors per fat */
89 uchar extflags[2]; /* active fat flags */
90 uchar version1[2]; /* fat32 version; major & minor bytes */
91 uchar rootstart[4]; /* starting cluster of root dir */
92 uchar infospec[2]; /* fat allocation info sector */
93 uchar backupboot[2]; /* backup boot sector */
98 * optional FAT32 info sector
102 FATINFOSIG1 = 0x41615252UL,
103 FATINFOSIG = 0x61417272UL,
111 uchar freeclust[4]; /* num frre clusters; -1 is unknown */
112 uchar nextfree[4]; /* most recently allocated cluster */
117 * BIOS paramater block
120 MLock; /* access to fat */
121 int sectsize; /* in bytes */
122 int clustsize; /* in sectors */
123 int nresrv; /* sectors */
124 int nfats; /* usually 2; modified to 1 if fat mirroring disabled */
125 int rootsize; /* number of entries, for fat12 and fat16 */
126 long volsize; /* in sectors */
128 long fatsize; /* in sectors */
130 int fatbits; /* 12, 16, or 32 */
131 long fataddr; /* sector number of first valid fat entry */
132 long rootaddr; /* for fat16 or fat12, sector of root dir */
133 long rootstart; /* for fat32, cluster of root dir */
134 long dataaddr; /* initial sector of data clusters */
135 long freeptr; /* next free cluster candidate */
136 long freeclusters; /* count of free clusters, for fat32 */
137 int fatinfo; /* fat info sector location; 0 => none */
143 DOSEMPTY = 0xe5, /* first char in name if entry is unused */
144 DOSRUNE = 13, /* runes per dosdir in a long file name */
145 DOSNAMELEN = 261 /* max dos file name length */
153 uchar ctime[3]; /* creation time */
154 uchar cdate[2]; /* creation date */
155 uchar adate[2]; /* last access date */
156 uchar hstart[2]; /* high bits of start for fat32 */
157 uchar time[2]; /* last modified time */
158 uchar date[2]; /* last modified date */
173 #define GSHORT(p) (((p)[0])|(p)[1]<<8)
174 #define GLONG(p) (((long)(p)[0])|(p)[1]<<8|(p)[2]<<16|(p)[3]<<24)
175 #define PSHORT(p,v) ((p)[0]=(v),(p)[1]=(v)>>8)
176 #define PLONG(p,v) ((p)[0]=(v),(p)[1]=(v)>>8,(p)[2]=(v)>>16,(p)[3]=(v)>>24)
179 ulong addr; /* sector & entry within of file's directory entry */
181 ulong paddr; /* of parent's directory entry */
183 ulong iclust; /* ordinal within file */
185 ulong naddr; /* next block in directory (for writing multi entry elements) */
191 #define QIDPATH(p) ((p)->addr*(Sectorsize/DOSDIRSIZE) + \
192 (p)->offset/DOSDIRSIZE)
196 int omode; /* of file containing external fs */
197 char *name; /* of file containing external f.s. */
198 Qid qid; /* of file containing external f.s. */
199 long ref; /* attach count */
200 Qid rootqid; /* of plan9 constructed root directory */
201 uchar isfat32; /* is a fat 32 file system? */
209 Xfile *next; /* in hash bucket */
222 Invalid, Short, ShortLower, Long
225 enum{ /* Xfile flags */
254 extern char *deffile;