1 /* @(#)diskmbr.h	1.2 04/03/02 Copyright 1999-2004 J. Schilling */
2 /*
3  *	Header file diskmbr.h - assorted structure definitions and macros
4  *	describing standard PC partition table
5  *
6  *	Copyright (c) 1999-2004 J. Schilling
7  */
8 /*
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License version 2
11  * as published by the Free Software Foundation.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along with
19  * this program; see the file COPYING.  If not, write to the Free Software
20  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef _DISKMBR_H
24 #define	_DISKMBR_H
25 
26 #define	MBR_MAGIC		0xAA55
27 
28 #define	PARTITION_UNUSED	0x00
29 #define	PARTITION_ACTIVE	0x80
30 
31 #define	PARTITION_COUNT		4
32 
33 #define	MBR_SECTOR(x)		((x)&0x3F)
34 #define	MBR_CYLINDER(x)		((x)>>8|((x)<<2&0x300))
35 
36 struct disk_partition {
37 	unsigned char	status;
38 	unsigned char	s_head;
39 	unsigned char	s_cyl_sec[2];
40 	unsigned char	type;
41 	unsigned char	e_head;
42 	unsigned char	e_cyl_sec[2];
43 	unsigned char	boot_sec[4];
44 	unsigned char	size[4];
45 };
46 
47 struct disk_master_boot_record {
48 	char			pad[0x1BE];
49 	struct disk_partition	partition[PARTITION_COUNT];
50 	unsigned char		magic[2];
51 };
52 
53 #endif	/* _DISKMBR_H */
54