Adjust VFS_SET() to deal with the change to struct vfsconf
[dragonfly.git] / sys / sys / gpt.h
1 /*-
2  * Copyright (c) 2002 Marcel Moolenaar
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
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.
14  *
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.
25  *
26  * $FreeBSD: src/sys/sys/gpt.h,v 1.10 2006/06/22 22:11:12 marcel Exp $
27  * $DragonFly: src/sys/sys/gpt.h,v 1.3 2007/06/19 06:07:51 dillon Exp $
28  */
29
30 #ifndef _SYS_GPT_H_
31 #define _SYS_GPT_H_
32
33 #include <sys/uuid.h>
34
35 struct gpt_hdr {
36         char            hdr_sig[8];
37         uint32_t        hdr_revision;
38         uint32_t        hdr_size;
39         uint32_t        hdr_crc_self;
40         uint32_t        __reserved;
41         uint64_t        hdr_lba_self;
42         uint64_t        hdr_lba_alt;
43         uint64_t        hdr_lba_start;
44         uint64_t        hdr_lba_end;
45         struct uuid     hdr_uuid;
46         uint64_t        hdr_lba_table;
47         uint32_t        hdr_entries;
48         uint32_t        hdr_entsz;
49         uint32_t        hdr_crc_table;
50         /*
51          * The header as defined in the EFI spec is not a multiple of 8 bytes
52          * and given that the alignment requirement is on an 8 byte boundary,
53          * padding will happen. We make the padding explicit so that we can
54          * correct the value returned by sizeof() when we put the size of the
55          * header in field hdr_size, or otherwise use offsetof().
56          */
57         uint32_t        padding;
58 };
59
60 #define GPT_MIN_HDR_SIZE        offsetof(struct gpt_hdr, padding)
61 #define GPT_HDR_SIG             "EFI PART"
62 #define GPT_HDR_REVISION        0x00010000
63
64 struct gpt_ent {
65         struct uuid     ent_type;
66         struct uuid     ent_uuid;
67         uint64_t        ent_lba_start;
68         uint64_t        ent_lba_end;
69         uint64_t        ent_attr;
70         uint16_t        ent_name[36];           /* UTF-16. */
71 };
72
73 #define GPT_ENT_ATTR_PLATFORM           (1ULL << 0)
74
75
76 #define GPT_ENT_TYPE_UNUSED             \
77         {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}
78 #define GPT_ENT_TYPE_EFI                \
79         {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}
80 #define GPT_ENT_TYPE_MBR                \
81         {0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}
82
83 #define GPT_ENT_TYPE_DRAGONFLY_LABEL32  \
84         {0x9d087404,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
85 #define GPT_ENT_TYPE_DRAGONFLY_SWAP     \
86         {0x9d58fdbd,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
87 #define GPT_ENT_TYPE_DRAGONFLY_UFS1     \
88         {0x9d94ce7c,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
89 #define GPT_ENT_TYPE_DRAGONFLY_VINUM    \
90         {0x9dd4478f,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
91 #define GPT_ENT_TYPE_DRAGONFLY_CCD      \
92         {0xdbd5211b,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
93 #define GPT_ENT_TYPE_DRAGONFLY_LABEL64  \
94         {0x3d48ce54,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
95 #define GPT_ENT_TYPE_DRAGONFLY_LEGACY   \
96         {0xbd215ab2,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
97
98 #define GPT_ENT_TYPE_FREEBSD            \
99         {0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
100 #define GPT_ENT_TYPE_FREEBSD_SWAP       \
101         {0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
102 #define GPT_ENT_TYPE_FREEBSD_UFS        \
103         {0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
104 #define GPT_ENT_TYPE_FREEBSD_VINUM      \
105         {0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
106
107 /*
108  * The following are unused but documented here to avoid reuse.
109  *
110  * GPT_ENT_TYPE_FREEBSD_UFS2    \
111  *      {0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
112  */
113
114 /*
115  * Foreign partition types that we're likely to encounter. Note that Linux
116  * apparently choose to share data partitions with MS. I don't what the
117  * advantage might be. I can see how sharing swap partitions is advantaous
118  * though.
119  */
120 #define GPT_ENT_TYPE_MS_RESERVED        \
121         {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}}
122 #define GPT_ENT_TYPE_MS_BASIC_DATA      \
123         {0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}
124 #define GPT_ENT_TYPE_MS_LDM_METADATA    \
125         {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}}
126 #define GPT_ENT_TYPE_MS_LDM_DATA        \
127         {0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}
128
129 #define GPT_ENT_TYPE_LINUX_DATA         GPT_ENT_TYPE_MS_BASIC_DATA
130 #define GPT_ENT_TYPE_LINUX_RAID         \
131         {0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}
132 #define GPT_ENT_TYPE_LINUX_SWAP         \
133         {0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}}
134 #define GPT_ENT_TYPE_LINUX_LVM          \
135         {0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}
136
137 #define GPT_ENT_TYPE_APPLE_HFS          \
138         {0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
139
140 #endif /* _SYS_GPT_H_ */