Move all the code related to handling the current 32 bit disklabel
[dragonfly.git] / sys / sys / disklabel64.h
1 /*
2  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
3  * 
4  * This code is derived from software contributed to The DragonFly Project
5  * by Matthew Dillon <dillon@backplane.com>
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in
15  *    the documentation and/or other materials provided with the
16  *    distribution.
17  * 3. Neither the name of The DragonFly Project nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific, prior written permission.
20  * 
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  * 
34  * $DragonFly: src/sys/sys/disklabel64.h,v 1.1 2007/06/18 05:13:42 dillon Exp $
35  */
36
37 #ifndef _SYS_DISKLABEL64_H_
38 #define _SYS_DISKLABEL64_H_
39
40 #ifndef _SYS_TYPES_H_
41 #include <sys/types.h>
42 #endif
43 #if defined(_KERNEL) && !defined(_SYS_SYSTM_H_)
44 #include <sys/systm.h>
45 #endif
46 #ifndef _SYS_IOCCOM_H_
47 #include <sys/ioccom.h>
48 #endif
49 #ifndef _SYS_UUID_H_
50 #include <sys/uuid.h>
51 #endif
52
53 /*
54  * 64 disklabels start at offset 0 on the disk or slice they reside.  All
55  * values are byte offsets, not block numbers, in order to allow portability.
56  * Unlike the original 32 bit disklabels, the on-disk format for a 64 bit
57  * disklabel is slice-relative and does not have to be translated.
58  */
59
60 #define DISKMAGIC64     ((u_int32_t)0xc4464c59) /* The disk magic number */
61 #ifndef MAXPARTITIONS64
62 #define MAXPARTITIONS64 16
63 #endif
64
65 #ifndef LOCORE
66
67 struct disklabel64 {
68         u_int32_t d_magic;              /* the magic number */
69         u_int32_t d_crc;                /* crc32() */
70         u_int32_t d_align;              /* partition alignment requirement */
71         u_int32_t d_npartitions;        /* number of partitions */
72         struct uuid d_obj_uuid;         /* unique uuid for label */
73
74         u_int64_t d_total_size;         /* total size incl everything (bytes) */
75         u_int64_t d_bbase;              /* boot area base offset (bytes) */
76                                         /* boot area is pbase - bbase */
77         u_int64_t d_pbase;              /* first allocatable offset (bytes) */
78         u_int64_t d_pstop;              /* last allocatable offset+1 (bytes) */
79         u_int64_t d_abase;              /* location of backup copy if not 0 */
80
81         struct partition64 {            /* the partition table */
82                 u_int64_t p_boffset;    /* slice relative offset, in bytes */
83                 u_int64_t p_bsize;      /* size of partition, in bytes */
84                 u_int32_t p_unused00;   /* reserved for future use */
85                 u_int32_t p_unused01;   /* reserved for future use */
86                 u_int32_t p_unused02;   /* reserved for future use */
87                 u_int32_t p_unused03;   /* reserved for future use */
88                 struct uuid p_type_uuid;/* mount type as UUID */
89                 struct uuid p_obj_uuid; /* unique uuid for storage */
90         } d_partitions[MAXPARTITIONS64];/* actually may be more */
91 };
92
93 /*
94  * Disk-specific ioctls.
95  */
96 #define DIOCGDINFO64    _IOR('d', 101, struct disklabel64)
97 #define DIOCSDINFO64    _IOW('d', 102, struct disklabel64)
98 #define DIOCWDINFO64    _IOW('d', 103, struct disklabel64)
99 #define DIOCGDVIRGIN64  _IOR('d', 105, struct disklabel64)
100
101 #endif /* LOCORE */
102
103 #endif /* !_SYS_DISKLABEL64_H_ */