ftp: Update files for tnftp-20121224 import.
[dragonfly.git] / sbin / gpt / gpt.h
blob97a6d4839243a4a31b9e440ed4f32dc64c3adc6d
1 /*-
2 * Copyright (c) 2002 Marcel Moolenaar
3 * All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
26 * $FreeBSD: src/sbin/gpt/gpt.h,v 1.11 2006/06/22 22:05:28 marcel Exp $
27 * $DragonFly: src/sbin/gpt/gpt.h,v 1.2 2008/07/30 00:45:26 dillon Exp $
30 #ifndef _GPT_H_
31 #define _GPT_H_
33 #include <sys/endian.h>
34 #include <sys/gpt.h>
36 #include <uuid.h>
38 void le_uuid_dec(void const *, uuid_t *);
39 void le_uuid_enc(void *, uuid_t const *);
40 int parse_uuid(const char *, uuid_t *);
42 struct mbr_part {
43 uint8_t part_flag; /* bootstrap flags */
44 uint8_t part_shd; /* starting head */
45 uint8_t part_ssect; /* starting sector */
46 uint8_t part_scyl; /* starting cylinder */
47 uint8_t part_typ; /* partition type */
48 uint8_t part_ehd; /* end head */
49 uint8_t part_esect; /* end sector */
50 uint8_t part_ecyl; /* end cylinder */
51 uint16_t part_start_lo; /* absolute starting ... */
52 uint16_t part_start_hi; /* ... sector number */
53 uint16_t part_size_lo; /* partition size ... */
54 uint16_t part_size_hi; /* ... in sectors */
57 struct mbr {
58 uint16_t mbr_code[223];
59 struct mbr_part mbr_part[4];
60 uint16_t mbr_sig;
61 #define MBR_SIG 0xAA55
64 extern char *device_name;
65 extern off_t mediasz;
66 extern u_int parts;
67 extern u_int secsz;
68 extern int readonly, verbose;
70 uint32_t crc32(const void *, size_t);
71 void gpt_close(int);
72 int gpt_open(const char *);
73 void* gpt_read(int, off_t, size_t);
74 int gpt_write(int, map_t *);
76 uint8_t *utf16_to_utf8(uint16_t *);
77 void utf8_to_utf16(const uint8_t *, uint16_t *, size_t);
79 int cmd_add(int, char *[]);
80 int cmd_boot(int, char *[]);
81 int cmd_create(int, char *[]);
82 int cmd_destroy(int, char *[]);
83 int cmd_label(int, char *[]);
84 int cmd_migrate(int, char *[]);
85 int cmd_recover(int, char *[]);
86 int cmd_remove(int, char *[]);
87 int cmd_show(int, char *[]);
89 #endif /* _GPT_H_ */