1 | /* |
---|
2 | * Copyright (c) 1992-1998 Michael A. Cooper. |
---|
3 | * This software may be freely used and distributed provided it is not |
---|
4 | * sold for profit or used in part or in whole for commercial gain |
---|
5 | * without prior written agreement, and the author is credited |
---|
6 | * appropriately. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * $Revision: 1.1.1.1 $ |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef __dospart_h__ |
---|
14 | #define __dospart_h__ |
---|
15 | |
---|
16 | /* |
---|
17 | * This stuff is from <sys/disklabel.h> in FreeBSD 2.2.6 |
---|
18 | */ |
---|
19 | #ifdef PC98 |
---|
20 | #define DOS_BB_SECTOR 0 /* DOS Boot Block relative sector */ |
---|
21 | #define DOS_LABEL_SECTOR 1 /* 0: 256b/s, 1: 512b/s */ |
---|
22 | #define DOS_PART_OFF 0 /* Partition offset */ |
---|
23 | #define DOS_NPARTS 16 /* # of DOS Partitions */ |
---|
24 | |
---|
25 | typedef struct { |
---|
26 | u_char dp_mid; |
---|
27 | /*#define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ |
---|
28 | u_char dp_sid; |
---|
29 | /*#define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ |
---|
30 | u_char dp_dum1; |
---|
31 | u_char dp_dum2; |
---|
32 | u_char dp_ipl_sct; |
---|
33 | u_char dp_ipl_head; |
---|
34 | u_short dp_ipl_cyl; |
---|
35 | u_char dp_ssect; /* starting sector */ |
---|
36 | u_char dp_shd; /* starting head */ |
---|
37 | u_short dp_scyl; /* starting cylinder */ |
---|
38 | u_char dp_esect; /* end sector */ |
---|
39 | u_char dp_ehd; /* end head */ |
---|
40 | u_short dp_ecyl; /* end cylinder */ |
---|
41 | u_char dp_name[16]; |
---|
42 | } DosPart_t; |
---|
43 | |
---|
44 | #else /* IBMPC */ |
---|
45 | #define DOS_BB_SECTOR 0 /* DOS boot block relative sector */ |
---|
46 | #define DOS_PART_SIZE 446 |
---|
47 | #define DOS_NPARTS 4 |
---|
48 | |
---|
49 | typedef struct { |
---|
50 | u_char dp_flags; /* bootstrap flags */ |
---|
51 | u_char dp_shd; /* starting head */ |
---|
52 | u_char dp_ssect; /* starting sector */ |
---|
53 | u_char dp_scyl; /* starting cylinder */ |
---|
54 | u_char dp_type; /* partititon type */ |
---|
55 | u_char dp_ehd; /* end head */ |
---|
56 | u_char dp_esect; /* end sector */ |
---|
57 | u_char dp_ecyl; /* end cylinder */ |
---|
58 | u_long dp_start; /* absolute starting sector number */ |
---|
59 | u_long dp_size; /* partition size in sectors */ |
---|
60 | } DosPart_t; |
---|
61 | #endif |
---|
62 | |
---|
63 | /* |
---|
64 | * Partition Types |
---|
65 | */ |
---|
66 | typedef struct { |
---|
67 | u_char Type; /* Value == dp_typ */ |
---|
68 | char *Desc; /* Description */ |
---|
69 | } DosPartType_t; |
---|
70 | |
---|
71 | #define DOS_ACTIVE 0x80 /* Is Active */ |
---|
72 | #define DOS_BOOT_MAGIC 0xAA55 /* Boot Magic signature */ |
---|
73 | |
---|
74 | #define MIN_SEC_SIZE 512 |
---|
75 | #define MAX_SEC_SIZE 2048 |
---|
76 | |
---|
77 | /* |
---|
78 | * Master Boot Record |
---|
79 | */ |
---|
80 | typedef struct { |
---|
81 | u_char Padding[2]; |
---|
82 | u_char BootInst[DOS_PART_SIZE]; |
---|
83 | DosPart_t Parts[DOS_NPARTS]; |
---|
84 | u_short Signature; |
---|
85 | /* Overflow allows us to read in large MBR's */ |
---|
86 | u_char Overflow[MAX_SEC_SIZE-MIN_SEC_SIZE]; |
---|
87 | } MBR_t; |
---|
88 | |
---|
89 | #endif /* __dospart_h__ */ |
---|