Initial import, 0.1 + pk 0.2.4-B1
[unix-history] / sys / pcfs / bootsect.h
CommitLineData
15637ed4
RG
1/*
2 * Written by Paul Popelka (paulp@uts.amdahl.com)
3 *
4 * You can do anything you want with this software,
5 * just don't say you wrote it,
6 * and don't remove this notice.
7 *
8 * This software is provided "as is".
9 *
10 * The author supplies this software to be publicly
11 * redistributed on the understanding that the author
12 * is not responsible for the correct functioning of
13 * this software in any circumstances and is not liable
14 * for any damages caused by this software.
15 *
16 * October 1992
17 *
18 * $Header: /usr/src/CVS/sys/pcfs/bootsect.h,v 1.1.2.1 1993/02/07 21:57:06 friedl Exp $
19 *
20 */
21
22/*
23 * Format of a boot sector. This is the first sector
24 * on a DOS floppy disk or the fist sector of a partition
25 * on a hard disk. But, it is not the first sector of
26 * a partitioned hard disk.
27 */
28struct bootsector33 {
29 char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */
30 char bsOemName[8]; /* OEM name and version */
31 char bsBPB[19]; /* BIOS parameter block */
32 char bsDriveNumber; /* drive number (0x80) */
33 char bsBootCode[474]; /* pad so structure is 512 bytes long */
34 u_short bsBootSectSig;
35#define BOOTSIG 0xaa55
36};
37
38struct bootsector50 {
39 char bsJump[3]; /* jump instruction E9xxxx or EBxx90 */
40 char bsOemName[8]; /* OEM name and version */
41 char bsBPB[25]; /* BIOS parameter block */
42 char bsDriveNumber; /* drive number (0x80) */
43 char bsReserved1; /* reserved */
44 char bsBootSignature; /* extended boot signature (0x29) */
45#define EXBOOTSIG 0x29
46 char bsVolumeID[4]; /* volume ID number */
47 char bsVolumeLabel[11]; /* volume label */
48 char bsFileSysType[8]; /* file system type (FAT12 or FAT16) */
49 char bsBootCode[448]; /* pad so structure is 512 bytes long */
50 u_short bsBootSectSig;
51#define BOOTSIG 0xaa55
52};
53
54union bootsector {
55 struct bootsector33 bs33;
56 struct bootsector50 bs50;
57};
58
59/*
60 * Shorthand for fields in the bpb.
61 */
62#define bsBytesPerSec bsBPB.bpbBytesPerSec
63#define bsSectPerClust bsBPB.bpbSectPerClust
64#define bsResSectors bsBPB.bpbResSectors
65#define bsFATS bsBPB.bpbFATS
66#define bsRootDirEnts bsBPB.bpbRootDirEnts
67#define bsSectors bsBPB.bpbSectors
68#define bsMedia bsBPB.bpbMedia
69#define bsFATsecs bsBPB.bpbFATsecs
70#define bsSectPerTrack bsBPB.bpbSectPerTrack
71#define bsHeads bsBPB.bpbHeads
72#define bsHiddenSecs bsBPB.bpbHiddenSecs
73#define bsHugeSectors bsBPB.bpbHugeSectors