1/*  Copyright 1997,1998,2001-2003,2006,2009 Alain Knaff.
2 *  This file is part of mtools.
3 *
4 *  Mtools is free software: you can redistribute it and/or modify
5 *  it under the terms of the GNU General Public License as published by
6 *  the Free Software Foundation, either version 3 of the License, or
7 *  (at your option) any later version.
8 *
9 *  Mtools is distributed in the hope that it will be useful,
10 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *  GNU General Public License for more details.
13 *
14 *  You should have received a copy of the GNU General Public License
15 *  along with Mtools.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18typedef struct hsc {
19	unsigned char byte0;
20	unsigned char head;		/* starting head */
21	unsigned char sector;		/* starting sector */
22	unsigned char cyl;		/* starting cylinder */
23} hsc;
24
25#define head(x) ((unsigned int)((x).head))
26#define sector(x) ((unsigned int)((x).sector & 0x3f))
27#define cyl(x) ((unsigned int)((x).cyl | (((x).sector & 0xc0)<<2)))
28
29#define BEGIN(p) _DWORD((p).start_sect)
30#define END(p) (_DWORD((p).start_sect)+(_DWORD((p).nr_sects)))
31
32
33struct partition {
34	hsc start;
35	hsc end;
36	unsigned char start_sect[4];	/* starting sector counting from 0 */
37	unsigned char nr_sects[4];     	/* nr of sectors in partition */
38};
39
40#define boot_ind start.byte0
41#define sys_ind end.byte0
42
43int consistencyCheck(struct partition *partTable, int doprint, int verbose,
44		     int *has_activated, unsigned int *last_end,
45		     unsigned int *j,
46		     struct device *used_dev, int target_partition);
47
48void setBeginEnd(struct partition *partTable, int begin, int end,
49				 int heads, int sector, int activate, int type);
50