|
|
1.1 root 1: /*
2: * Mach Operating System
3: * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4: * All Rights Reserved.
5: *
6: * Permission to use, copy, modify and distribute this software and its
7: * documentation is hereby granted, provided that both the copyright
8: * notice and this permission notice appear in all copies of the
9: * software, derivative works or modified versions, and any portions
10: * thereof, and that both notices appear in supporting documentation.
11: *
12: * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13: * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14: * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15: *
16: * Carnegie Mellon requests users of this software to return to
17: *
18: * Software Distribution Coordinator or [email protected]
19: * School of Computer Science
20: * Carnegie Mellon University
21: * Pittsburgh PA 15213-3890
22: *
23: * any improvements or extensions that they make and grant Carnegie Mellon
24: * the rights to redistribute these changes.
25: */
26: /*
27: Copyright 1988, 1989 by Intel Corporation, Santa Clara, California.
28:
29: All Rights Reserved
30:
31: Permission to use, copy, modify, and distribute this software and
32: its documentation for any purpose and without fee is hereby
33: granted, provided that the above copyright notice appears in all
34: copies and that both the copyright notice and this permission notice
35: appear in supporting documentation, and that the name of Intel
36: not be used in advertising or publicity pertaining to distribution
37: of the software without specific, written prior permission.
38:
39: INTEL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
40: INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
41: IN NO EVENT SHALL INTEL BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
42: CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
43: LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
44: NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
45: WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
46: */
47:
48: /*
49: * disk.h
50: */
51:
52: /* Grab the public part. */
53: #include <mach/machine/disk.h>
54:
55:
56:
57: #define MAX_ALTENTS 253 /* Maximum # of slots for alts */
58: /* allowed for in the table. */
59:
60: #define ALT_SANITY 0xdeadbeef /* magic # to validate alt table */
61:
62: struct alt_table {
63: u_short alt_used; /* # of alternates already assigned */
64: u_short alt_reserved; /* # of alternates reserved on disk */
65: long alt_base; /* 1st sector (abs) of the alt area */
66: long alt_bad[MAX_ALTENTS]; /* list of bad sectors/tracks */
67: };
68:
69: struct alt_info { /* table length should be multiple of 512 */
70: long alt_sanity; /* to validate correctness */
71: u_short alt_version; /* to corroborate vintage */
72: u_short alt_pad; /* padding for alignment */
73: struct alt_table alt_trk; /* bad track table */
74: struct alt_table alt_sec; /* bad sector table */
75: };
76: typedef struct alt_info altinfo_t;
77:
78: #define V_NUMPAR 16 /* maximum number of partitions */
79:
80: #define VTOC_SANE 0x600DDEEE /* Indicates a sane VTOC */
81: #define PDLOCATION 29 /* location of VTOC */
82:
83: #define BAD_BLK 0x80 /* needed for V_VERIFY */
84: /* BAD_BLK moved from old hdreg.h */
85:
86:
87: #define HDPDLOC 29 /* location of pdinfo/vtoc */
88: #define LBLLOC 1 /* label block for xxxbsd */
89:
90: /* Partition permission flags */
91: #define V_OPEN 0x100 /* Partition open (for driver use) */
92: #define V_VALID 0x200 /* Partition is valid to use */
93:
94:
95:
96: /* Sanity word for the physical description area */
97: #define VALID_PD 0xCA5E600D
98:
99: struct localpartition {
100: u_int p_flag; /*permision flags*/
101: long p_start; /*physical start sector no of partition*/
102: long p_size; /*# of physical sectors in partition*/
103: };
104: typedef struct localpartition localpartition_t;
105:
106: struct evtoc {
107: u_int fill0[6];
108: u_int cyls; /*number of cylinders per drive*/
109: u_int tracks; /*number tracks per cylinder*/
110: u_int sectors; /*number sectors per track*/
111: u_int fill1[13];
112: u_int version; /*layout version*/
113: u_int alt_ptr; /*byte offset of alternates table*/
114: u_short alt_len; /*byte length of alternates table*/
115: u_int sanity; /*to verify vtoc sanity*/
116: u_int xcyls; /*number of cylinders per drive*/
117: u_int xtracks; /*number tracks per cylinder*/
118: u_int xsectors; /*number sectors per track*/
119: u_short nparts; /*number of partitions*/
120: u_short fill2; /*pad for 286 compiler*/
121: char label[40];
122: struct localpartition part[V_NUMPAR];/*partition headers*/
123: char fill[512-352];
124: };
125:
126: union io_arg {
127: struct {
128: u_short ncyl; /* number of cylinders on drive */
129: u_char nhead; /* number of heads/cyl */
130: u_char nsec; /* number of sectors/track */
131: u_short secsiz; /* number of bytes/sector */
132: } ia_cd; /* used for Configure Drive cmd */
133: struct {
134: u_short flags; /* flags (see below) */
135: long bad_sector; /* absolute sector number */
136: long new_sector; /* RETURNED alternate sect assigned */
137: } ia_abs; /* used for Add Bad Sector cmd */
138: struct {
139: u_short start_trk; /* first track # */
140: u_short num_trks; /* number of tracks to format */
141: u_short intlv; /* interleave factor */
142: } ia_fmt; /* used for Format Tracks cmd */
143: struct {
144: u_short start_trk; /* first track */
145: char *intlv_tbl; /* interleave table */
146: } ia_xfmt; /* used for the V_XFORMAT ioctl */
147: };
148:
149:
150: #define BOOTSZ 446 /* size of boot code in master boot block */
151: #define FD_NUMPART 4 /* number of 'partitions' in fdisk table */
152: #define ACTIVE 128 /* indicator of active partition */
153: #define BOOT_MAGIC 0xAA55 /* signature of the boot record */
154: #define UNIXOS 99 /* UNIX partition */
155: #define BSDOS 165
156: #define LINUXSWAP 130
157: #define LINUXOS 131
158: extern int OS; /* what partition we came from */
159:
160: /*
161: * structure to hold the fdisk partition table
162: */
163: struct ipart {
164: u_char bootid; /* bootable or not */
165: u_char beghead; /* beginning head, sector, cylinder */
166: u_char begsect; /* begcyl is a 10-bit number. High 2 bits */
167: u_char begcyl; /* are in begsect. */
168: u_char systid; /* OS type */
169: u_char endhead; /* ending head, sector, cylinder */
170: u_char endsect; /* endcyl is a 10-bit number. High 2 bits */
171: u_char endcyl; /* are in endsect. */
172: long relsect; /* first sector relative to start of disk */
173: long numsect; /* number of sectors in partition */
174: };
175:
176: /*
177: * structure to hold master boot block in physical sector 0 of the disk.
178: * Note that partitions stuff can't be directly included in the structure
179: * because of lameo '386 compiler alignment design.
180: */
181: struct mboot { /* master boot block */
182: char bootinst[BOOTSZ];
183: char parts[FD_NUMPART * sizeof(struct ipart)];
184: u_short signature;
185: };
186:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.