inet6: only mark autoconf addresses tentative if detached
[dragonfly.git] / sys / vfs / msdosfs / bpb.h
blob3578b98a730094f7258b494fa163ac4f3aaa366a
1 /* $FreeBSD$ */
2 /* $NetBSD: bpb.h,v 1.7 1997/11/17 15:36:24 ws Exp $ */
4 /*-
5 * Written by Paul Popelka (paulp@uts.amdahl.com)
7 * You can do anything you want with this software, just don't say you wrote
8 * it, and don't remove this notice.
10 * This software is provided "as is".
12 * The author supplies this software to be publicly redistributed on the
13 * understanding that the author is not responsible for the correct
14 * functioning of this software in any circumstances and is not liable for
15 * any damages caused by this software.
17 * October 1992
20 #ifndef _FS_MSDOSFS_BPB_H_
21 #define _FS_MSDOSFS_BPB_H_
23 #include <sys/types.h>
26 * BIOS Parameter Block (BPB) for DOS 3.3
28 struct bpb33 {
29 uint16_t bpbBytesPerSec; /* bytes per sector */
30 uint8_t bpbSecPerClust; /* sectors per cluster */
31 uint16_t bpbResSectors; /* number of reserved sectors */
32 uint8_t bpbFATs; /* number of FATs */
33 uint16_t bpbRootDirEnts; /* number of root directory entries */
34 uint16_t bpbSectors; /* total number of sectors */
35 uint8_t bpbMedia; /* media descriptor */
36 uint16_t bpbFATsecs; /* number of sectors per FAT */
37 uint16_t bpbSecPerTrack; /* sectors per track */
38 uint16_t bpbHeads; /* number of heads */
39 uint16_t bpbHiddenSecs; /* number of hidden sectors */
43 * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
44 * and bpbHugeSectors is not in the 3.3 bpb.
46 struct bpb50 {
47 uint16_t bpbBytesPerSec; /* bytes per sector */
48 uint8_t bpbSecPerClust; /* sectors per cluster */
49 uint16_t bpbResSectors; /* number of reserved sectors */
50 uint8_t bpbFATs; /* number of FATs */
51 uint16_t bpbRootDirEnts; /* number of root directory entries */
52 uint16_t bpbSectors; /* total number of sectors */
53 uint8_t bpbMedia; /* media descriptor */
54 uint16_t bpbFATsecs; /* number of sectors per FAT */
55 uint16_t bpbSecPerTrack; /* sectors per track */
56 uint16_t bpbHeads; /* number of heads */
57 uint32_t bpbHiddenSecs; /* # of hidden sectors */
58 uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
62 * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
64 struct bpb710 {
65 uint16_t bpbBytesPerSec; /* bytes per sector */
66 uint8_t bpbSecPerClust; /* sectors per cluster */
67 uint16_t bpbResSectors; /* number of reserved sectors */
68 uint8_t bpbFATs; /* number of FATs */
69 uint16_t bpbRootDirEnts; /* number of root directory entries */
70 uint16_t bpbSectors; /* total number of sectors */
71 uint8_t bpbMedia; /* media descriptor */
72 uint16_t bpbFATsecs; /* number of sectors per FAT */
73 uint16_t bpbSecPerTrack; /* sectors per track */
74 uint16_t bpbHeads; /* number of heads */
75 uint32_t bpbHiddenSecs; /* # of hidden sectors */
76 uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
77 uint32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
78 uint16_t bpbExtFlags; /* extended flags: */
79 #define FATNUM 0xf /* mask for numbering active FAT */
80 #define FATMIRROR 0x80 /* FAT is mirrored (like it always was) */
81 uint16_t bpbFSVers; /* filesystem version */
82 #define FSVERS 0 /* currently only 0 is understood */
83 uint32_t bpbRootClust; /* start cluster for root directory */
84 uint16_t bpbFSInfo; /* filesystem info structure sector */
85 uint16_t bpbBackup; /* backup boot sector */
86 uint8_t bpbReserved[12]; /* reserved for future expansion */
90 * The following structures represent how the bpb's look on disk. shorts
91 * and longs are just character arrays of the appropriate length. This is
92 * because the compiler forces shorts and longs to align on word or
93 * halfword boundaries.
96 #include <sys/endian.h>
98 #define getushort(x) le16dec(x)
99 #define getulong(x) le32dec(x)
100 #define putushort(p, v) le16enc(p, v)
101 #define putulong(p, v) le32enc(p, v)
104 * BIOS Parameter Block (BPB) for DOS 3.3
106 struct byte_bpb33 {
107 int8_t bpbBytesPerSec[2]; /* bytes per sector */
108 int8_t bpbSecPerClust; /* sectors per cluster */
109 int8_t bpbResSectors[2]; /* number of reserved sectors */
110 int8_t bpbFATs; /* number of FATs */
111 int8_t bpbRootDirEnts[2]; /* number of root directory entries */
112 int8_t bpbSectors[2]; /* total number of sectors */
113 int8_t bpbMedia; /* media descriptor */
114 int8_t bpbFATsecs[2]; /* number of sectors per FAT */
115 int8_t bpbSecPerTrack[2]; /* sectors per track */
116 int8_t bpbHeads[2]; /* number of heads */
117 int8_t bpbHiddenSecs[2]; /* number of hidden sectors */
121 * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
122 * and bpbHugeSectors is not in the 3.3 bpb.
124 struct byte_bpb50 {
125 int8_t bpbBytesPerSec[2]; /* bytes per sector */
126 int8_t bpbSecPerClust; /* sectors per cluster */
127 int8_t bpbResSectors[2]; /* number of reserved sectors */
128 int8_t bpbFATs; /* number of FATs */
129 int8_t bpbRootDirEnts[2]; /* number of root directory entries */
130 int8_t bpbSectors[2]; /* total number of sectors */
131 int8_t bpbMedia; /* media descriptor */
132 int8_t bpbFATsecs[2]; /* number of sectors per FAT */
133 int8_t bpbSecPerTrack[2]; /* sectors per track */
134 int8_t bpbHeads[2]; /* number of heads */
135 int8_t bpbHiddenSecs[4]; /* number of hidden sectors */
136 int8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
140 * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
142 struct byte_bpb710 {
143 uint8_t bpbBytesPerSec[2]; /* bytes per sector */
144 uint8_t bpbSecPerClust; /* sectors per cluster */
145 uint8_t bpbResSectors[2]; /* number of reserved sectors */
146 uint8_t bpbFATs; /* number of FATs */
147 uint8_t bpbRootDirEnts[2]; /* number of root directory entries */
148 uint8_t bpbSectors[2]; /* total number of sectors */
149 uint8_t bpbMedia; /* media descriptor */
150 uint8_t bpbFATsecs[2]; /* number of sectors per FAT */
151 uint8_t bpbSecPerTrack[2]; /* sectors per track */
152 uint8_t bpbHeads[2]; /* number of heads */
153 uint8_t bpbHiddenSecs[4]; /* # of hidden sectors */
154 uint8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
155 uint8_t bpbBigFATsecs[4]; /* like bpbFATsecs for FAT32 */
156 uint8_t bpbExtFlags[2]; /* extended flags: */
157 uint8_t bpbFSVers[2]; /* filesystem version */
158 uint8_t bpbRootClust[4]; /* start cluster for root directory */
159 uint8_t bpbFSInfo[2]; /* filesystem info structure sector */
160 uint8_t bpbBackup[2]; /* backup boot sector */
161 uint8_t bpbReserved[12]; /* reserved for future expansion */
165 * FAT32 FSInfo block.
167 struct fsinfo {
168 uint8_t fsisig1[4];
169 uint8_t fsifill1[480];
170 uint8_t fsisig2[4];
171 uint8_t fsinfree[4];
172 uint8_t fsinxtfree[4];
173 uint8_t fsifill2[12];
174 uint8_t fsisig3[4];
176 #endif /* !_FS_MSDOSFS_BPB_H_ */