2 * Copyright (c) 2002 Marcel Moolenaar
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 uint8_t part_flag; /* bootstrap flags */
34 uint8_t part_shd; /* starting head */
35 uint8_t part_ssect; /* starting sector */
36 uint8_t part_scyl; /* starting cylinder */
37 uint8_t part_typ; /* partition type */
38 uint8_t part_ehd; /* end head */
39 uint8_t part_esect; /* end sector */
40 uint8_t part_ecyl; /* end cylinder */
41 uint16_t part_start_lo; /* absolute starting ... */
42 uint16_t part_start_hi; /* ... sector number */
43 uint16_t part_size_lo; /* partition size ... */
44 uint16_t part_size_hi; /* ... in sectors */
48 uint16_t mbr_code[223];
49 struct mbr_part mbr_part[4];
51 #define MBR_SIG 0xAA55
54 extern char device_name[];
58 extern int readonly, verbose;
60 uint32_t crc32(const void *, size_t);
62 int gpt_open(const char *);
63 void* gpt_read(int, off_t, size_t);
64 int gpt_write(int, map_t *);
65 void unicode16(short *, const wchar_t *, size_t);
67 int cmd_add(int, char *[]);
68 int cmd_create(int, char *[]);
69 int cmd_destroy(int, char *[]);
70 int cmd_migrate(int, char *[]);
71 int cmd_recover(int, char *[]);
72 int cmd_show(int, char *[]);