aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/mtree/BSD.include.dist2
-rw-r--r--include/Makefile1
-rw-r--r--sys/sys/apm.h70
-rw-r--r--sys/sys/disk/apm.h69
-rw-r--r--sys/sys/disk/bsd.h191
-rw-r--r--sys/sys/disk/gpt.h237
-rw-r--r--sys/sys/disk/mbr.h84
-rw-r--r--sys/sys/disk/pc98.h75
-rw-r--r--sys/sys/disk/vtoc.h108
-rw-r--r--sys/sys/disklabel.h170
-rw-r--r--sys/sys/diskmbr.h49
-rw-r--r--sys/sys/diskpc98.h41
-rw-r--r--sys/sys/gpt.h177
-rw-r--r--sys/sys/vtoc.h109
14 files changed, 796 insertions, 587 deletions
diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist
index 19289844573d..5beaf3d2db60 100644
--- a/etc/mtree/BSD.include.dist
+++ b/etc/mtree/BSD.include.dist
@@ -336,6 +336,8 @@
ssp
..
sys
+ disk
+ ..
..
teken
..
diff --git a/include/Makefile b/include/Makefile
index ebac8822959b..44c3ff1bdc6c 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -59,6 +59,7 @@ LSUBDIRS= cam/ata cam/nvme cam/scsi \
security/audit \
security/mac_biba security/mac_bsdextended security/mac_lomac \
security/mac_mls security/mac_partition \
+ sys/disk \
ufs/ffs ufs/ufs
LSUBSUBDIRS= dev/mpt/mpilib
diff --git a/sys/sys/apm.h b/sys/sys/apm.h
index a17591db822e..ef076ea594b4 100644
--- a/sys/sys/apm.h
+++ b/sys/sys/apm.h
@@ -1,69 +1,5 @@
/*-
- * Copyright (c) 2007 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
*/
-
-#ifndef _SYS_APM_H_
-#define _SYS_APM_H_
-
-/* Driver Descriptor Record. */
-struct apm_ddr {
- uint16_t ddr_sig;
-#define APM_DDR_SIG 0x4552
- uint16_t ddr_blksize;
- uint32_t ddr_blkcount;
-};
-
-#define APM_ENT_NAMELEN 32
-#define APM_ENT_TYPELEN 32
-
-/* Partition Map Entry Record. */
-struct apm_ent {
- uint16_t ent_sig;
-#define APM_ENT_SIG 0x504d
- uint16_t _pad_;
- uint32_t ent_pmblkcnt;
- uint32_t ent_start;
- uint32_t ent_size;
- char ent_name[APM_ENT_NAMELEN];
- char ent_type[APM_ENT_TYPELEN];
-};
-
-#define APM_ENT_TYPE_SELF "Apple_partition_map"
-#define APM_ENT_TYPE_UNUSED "Apple_Free"
-
-#define APM_ENT_TYPE_FREEBSD "FreeBSD"
-#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs"
-#define APM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap"
-#define APM_ENT_TYPE_FREEBSD_UFS "FreeBSD-UFS"
-#define APM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum"
-#define APM_ENT_TYPE_FREEBSD_ZFS "FreeBSD-ZFS"
-
-#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap"
-#define APM_ENT_TYPE_APPLE_HFS "Apple_HFS"
-#define APM_ENT_TYPE_APPLE_UFS "Apple_UNIX_SVR2"
-
-#endif /* _SYS_APM_H_ */
+/* $FreeBSD$ */
+#include <sys/disk/apm.h>
diff --git a/sys/sys/disk/apm.h b/sys/sys/disk/apm.h
new file mode 100644
index 000000000000..a9183b5e3aa7
--- /dev/null
+++ b/sys/sys/disk/apm.h
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2007 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_APM_H_
+#define _SYS_DISK_APM_H_
+
+/* Driver Descriptor Record. */
+struct apm_ddr {
+ uint16_t ddr_sig;
+#define APM_DDR_SIG 0x4552
+ uint16_t ddr_blksize;
+ uint32_t ddr_blkcount;
+};
+
+#define APM_ENT_NAMELEN 32
+#define APM_ENT_TYPELEN 32
+
+/* Partition Map Entry Record. */
+struct apm_ent {
+ uint16_t ent_sig;
+#define APM_ENT_SIG 0x504d
+ uint16_t _pad_;
+ uint32_t ent_pmblkcnt;
+ uint32_t ent_start;
+ uint32_t ent_size;
+ char ent_name[APM_ENT_NAMELEN];
+ char ent_type[APM_ENT_TYPELEN];
+};
+
+#define APM_ENT_TYPE_SELF "Apple_partition_map"
+#define APM_ENT_TYPE_UNUSED "Apple_Free"
+
+#define APM_ENT_TYPE_FREEBSD "FreeBSD"
+#define APM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs"
+#define APM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap"
+#define APM_ENT_TYPE_FREEBSD_UFS "FreeBSD-UFS"
+#define APM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum"
+#define APM_ENT_TYPE_FREEBSD_ZFS "FreeBSD-ZFS"
+
+#define APM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap"
+#define APM_ENT_TYPE_APPLE_HFS "Apple_HFS"
+#define APM_ENT_TYPE_APPLE_UFS "Apple_UNIX_SVR2"
+
+#endif /* _SYS_DISK_APM_H_ */
diff --git a/sys/sys/disk/bsd.h b/sys/sys/disk/bsd.h
new file mode 100644
index 000000000000..829663bcf55c
--- /dev/null
+++ b/sys/sys/disk/bsd.h
@@ -0,0 +1,191 @@
+/*-
+ * Copyright (c) 1987, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_BSD_H_
+#define _SYS_DISK_BSD_H_
+
+/* The disk magic number */
+#define BSD_MAGIC 0x82564557U
+
+#define BSD_NPARTS_MIN 8
+#define BSD_NPARTS_MAX 20
+
+/* Size of bootblock area in sector-size neutral bytes */
+#define BSD_BOOTBLOCK_SIZE 8192
+
+/* partition containing whole disk */
+#define BSD_PART_RAW 2
+
+/* partition normally containing swap */
+#define BSD_PART_SWAP 1
+
+/* Drive-type specific data size (in number of 32-bit inegrals) */
+#define BSD_NDRIVEDATA 5
+
+/* Number of spare 32-bit integrals following drive-type data */
+#define BSD_NSPARE 5
+
+struct disklabel {
+ uint32_t d_magic; /* the magic number */
+ uint16_t d_type; /* drive type */
+ uint16_t d_subtype; /* controller/d_type specific */
+ char d_typename[16]; /* type name, e.g. "eagle" */
+
+ char d_packname[16]; /* pack identifier */
+
+ /* disk geometry: */
+ uint32_t d_secsize; /* # of bytes per sector */
+ uint32_t d_nsectors; /* # of data sectors per track */
+ uint32_t d_ntracks; /* # of tracks per cylinder */
+ uint32_t d_ncylinders; /* # of data cylinders per unit */
+ uint32_t d_secpercyl; /* # of data sectors per cylinder */
+ uint32_t d_secperunit; /* # of data sectors per unit */
+
+ /*
+ * Spares (bad sector replacements) below are not counted in
+ * d_nsectors or d_secpercyl. Spare sectors are assumed to
+ * be physical sectors which occupy space at the end of each
+ * track and/or cylinder.
+ */
+ uint16_t d_sparespertrack; /* # of spare sectors per track */
+ uint16_t d_sparespercyl; /* # of spare sectors per cylinder */
+ /*
+ * Alternate cylinders include maintenance, replacement, configuration
+ * description areas, etc.
+ */
+ uint32_t d_acylinders; /* # of alt. cylinders per unit */
+
+ /* hardware characteristics: */
+ /*
+ * d_interleave, d_trackskew and d_cylskew describe perturbations
+ * in the media format used to compensate for a slow controller.
+ * Interleave is physical sector interleave, set up by the
+ * formatter or controller when formatting. When interleaving is
+ * in use, logically adjacent sectors are not physically
+ * contiguous, but instead are separated by some number of
+ * sectors. It is specified as the ratio of physical sectors
+ * traversed per logical sector. Thus an interleave of 1:1
+ * implies contiguous layout, while 2:1 implies that logical
+ * sector 0 is separated by one sector from logical sector 1.
+ * d_trackskew is the offset of sector 0 on track N relative to
+ * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
+ * is the offset of sector 0 on cylinder N relative to sector 0
+ * on cylinder N-1.
+ */
+ uint16_t d_rpm; /* rotational speed */
+ uint16_t d_interleave; /* hardware sector interleave */
+ uint16_t d_trackskew; /* sector 0 skew, per track */
+ uint16_t d_cylskew; /* sector 0 skew, per cylinder */
+ uint32_t d_headswitch; /* head switch time, usec */
+ uint32_t d_trkseek; /* track-to-track seek, usec */
+ uint32_t d_flags; /* generic flags */
+ uint32_t d_drivedata[BSD_NDRIVEDATA]; /* drive-type specific data */
+ uint32_t d_spare[BSD_NSPARE]; /* reserved for future use */
+ uint32_t d_magic2; /* the magic number (again) */
+ uint16_t d_checksum; /* xor of data incl. partitions */
+
+ /* filesystem and partition information: */
+ uint16_t d_npartitions; /* number of partitions in following */
+ uint32_t d_bbsize; /* size of boot area at sn0, bytes */
+ uint32_t d_sbsize; /* max size of fs superblock, bytes */
+ struct partition { /* the partition table */
+ uint32_t p_size; /* number of sectors in partition */
+ uint32_t p_offset; /* starting sector */
+ uint32_t p_fsize; /* filesystem basic fragment size */
+ uint8_t p_fstype; /* filesystem type, see below */
+ uint8_t p_frag; /* filesystem fragments per block */
+ uint16_t p_cpg; /* filesystem cylinders per group */
+ } d_partitions[BSD_NPARTS_MIN]; /* actually may be more */
+};
+#ifdef CTASSERT
+CTASSERT(sizeof(struct disklabel) == 148 + BSD_NPARTS_MIN * 16);
+#endif
+
+/* d_type values: */
+#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
+#define DTYPE_MSCP 2 /* MSCP */
+#define DTYPE_DEC 3 /* other DEC (rk, rl) */
+#define DTYPE_SCSI 4 /* SCSI */
+#define DTYPE_ESDI 5 /* ESDI interface */
+#define DTYPE_ST506 6 /* ST506 etc. */
+#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
+#define DTYPE_HPFL 8 /* HP Fiber-link */
+#define DTYPE_FLOPPY 10 /* floppy */
+#define DTYPE_CCD 11 /* concatenated disk */
+#define DTYPE_VINUM 12 /* vinum volume */
+#define DTYPE_DOC2K 13 /* Msys DiskOnChip */
+#define DTYPE_RAID 14 /* CMU RAIDFrame */
+#define DTYPE_JFS2 16 /* IBM JFS 2 */
+
+/*
+ * Filesystem type and version.
+ * Used to interpret other filesystem-specific
+ * per-partition information.
+ */
+#define FS_UNUSED 0 /* unused */
+#define FS_SWAP 1 /* swap */
+#define FS_V6 2 /* Sixth Edition */
+#define FS_V7 3 /* Seventh Edition */
+#define FS_SYSV 4 /* System V */
+#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
+#define FS_V8 6 /* Eighth Edition, 4K blocks */
+#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */
+#define FS_MSDOS 8 /* MSDOS filesystem */
+#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */
+#define FS_OTHER 10 /* in use, but unknown/unsupported */
+#define FS_HPFS 11 /* OS/2 high-performance filesystem */
+#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
+#define FS_BOOT 13 /* partition contains bootstrap */
+#define FS_VINUM 14 /* Vinum drive */
+#define FS_RAID 15 /* RAIDFrame drive */
+#define FS_FILECORE 16 /* Acorn Filecore Filing System */
+#define FS_EXT2FS 17 /* ext2fs */
+#define FS_NTFS 18 /* Windows/NT file system */
+#define FS_CCD 20 /* concatenated disk component */
+#define FS_JFS2 21 /* IBM JFS2 */
+#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */
+#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */
+#define FS_UDF 24 /* UDF */
+#define FS_EFS 26 /* SGI's Extent File system */
+#define FS_ZFS 27 /* Sun's ZFS */
+#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */
+
+/*
+ * flags shared by various drives:
+ */
+#define D_REMOVABLE 0x01 /* removable media */
+#define D_ECC 0x02 /* supports ECC */
+#define D_BADSECT 0x04 /* supports bad sector forw. */
+#define D_RAMDISK 0x08 /* disk emulator */
+#define D_CHAIN 0x10 /* can do back-back transfers */
+
+#endif /* !_SYS_DISK_BSD_H_ */
diff --git a/sys/sys/disk/gpt.h b/sys/sys/disk/gpt.h
new file mode 100644
index 000000000000..a3df2927beec
--- /dev/null
+++ b/sys/sys/disk/gpt.h
@@ -0,0 +1,237 @@
+/*-
+ * Copyright (c) 2002 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_GPT_H_
+#define _SYS_DISK_GPT_H_
+
+/*
+ * Applications can define GPT_UUID_TYPE if they want the GPT structures
+ * to use a particular type definition for UUIDs/GUIDs. This header uses
+ * a generic (DCE 1.1 compatible) definition otherwise.
+ */
+#ifndef GPT_UUID_TYPE
+struct gpt_uuid {
+ uint32_t time_low;
+ uint16_t time_mid;
+ uint16_t time_hi_and_version;
+ uint8_t clock_seq_hi_and_reserved;
+ uint8_t clock_seq_low;
+ uint8_t node[6];
+};
+#define GPT_UUID_TYPE struct gpt_uuid
+#endif /* !GPT_UUID_TYPE */
+
+typedef GPT_UUID_TYPE gpt_uuid_t;
+
+#ifdef CTASSERT
+CTASSERT(sizeof(gpt_uuid_t) == 16);
+#endif
+
+struct gpt_hdr {
+ char hdr_sig[8];
+#define GPT_HDR_SIG "EFI PART"
+ uint32_t hdr_revision;
+#define GPT_HDR_REVISION 0x00010000
+ uint32_t hdr_size;
+ uint32_t hdr_crc_self;
+ uint32_t __reserved;
+ uint64_t hdr_lba_self;
+ uint64_t hdr_lba_alt;
+ uint64_t hdr_lba_start;
+ uint64_t hdr_lba_end;
+ gpt_uuid_t hdr_uuid;
+ uint64_t hdr_lba_table;
+ uint32_t hdr_entries;
+ uint32_t hdr_entsz;
+ uint32_t hdr_crc_table;
+ /*
+ * The header as defined in the EFI spec is not a multiple of 8 bytes
+ * and given that the alignment requirement is on an 8 byte boundary,
+ * padding will happen. We make the padding explicit so that we can
+ * correct the value returned by sizeof() when we put the size of the
+ * header in field hdr_size, or otherwise use offsetof().
+ */
+ uint32_t padding;
+};
+#ifdef CTASSERT
+CTASSERT(offsetof(struct gpt_hdr, padding) == 92);
+#endif
+
+struct gpt_ent {
+ gpt_uuid_t ent_type;
+ gpt_uuid_t ent_uuid;
+ uint64_t ent_lba_start;
+ uint64_t ent_lba_end;
+ uint64_t ent_attr;
+#define GPT_ENT_ATTR_PLATFORM (1ULL << 0)
+#define GPT_ENT_ATTR_BOOTME (1ULL << 59)
+#define GPT_ENT_ATTR_BOOTONCE (1ULL << 58)
+#define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57)
+ uint16_t ent_name[36]; /* UTF-16. */
+};
+#ifdef CTASSERT
+CTASSERT(sizeof(struct gpt_ent) == 128);
+#endif /* CTASSERT */
+
+#define GPT_ENT_TYPE_UNUSED \
+ {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}
+#define GPT_ENT_TYPE_EFI \
+ {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}
+#define GPT_ENT_TYPE_MBR \
+ {0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}
+#define GPT_ENT_TYPE_FREEBSD \
+ {0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_FREEBSD_BOOT \
+ {0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
+#define GPT_ENT_TYPE_FREEBSD_NANDFS \
+ {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}}
+#define GPT_ENT_TYPE_FREEBSD_SWAP \
+ {0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_FREEBSD_UFS \
+ {0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_FREEBSD_VINUM \
+ {0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_FREEBSD_ZFS \
+ {0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+#define GPT_ENT_TYPE_PREP_BOOT \
+ {0x9e1a2d38,0xc612,0x4316,0xaa,0x26,{0x8b,0x49,0x52,0x1e,0x5a,0x8b}}
+
+/*
+ * The following are unused but documented here to avoid reuse.
+ *
+ * GPT_ENT_TYPE_FREEBSD_UFS2 \
+ * {0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
+ */
+
+/*
+ * Foreign partition types that we're likely to encounter. Note that Linux
+ * apparently choose to share data partitions with MS. I don't what the
+ * advantage might be. I can see how sharing swap partitions is advantageous
+ * though.
+ */
+#define GPT_ENT_TYPE_MS_BASIC_DATA \
+ {0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}
+#define GPT_ENT_TYPE_MS_LDM_DATA \
+ {0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}
+#define GPT_ENT_TYPE_MS_LDM_METADATA \
+ {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}}
+#define GPT_ENT_TYPE_MS_RECOVERY \
+ {0xde94bba4,0x06d1,0x4d40,0xa1,0x6a,{0xbf,0xd5,0x01,0x79,0xd6,0xac}}
+#define GPT_ENT_TYPE_MS_RESERVED \
+ {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}}
+#define GPT_ENT_TYPE_MS_SPACES \
+ {0xe75caf8f,0xf680,0x4cee,0xaf,0xa3,{0xb0,0x01,0xe5,0x6e,0xfc,0x2d}}
+
+#define GPT_ENT_TYPE_LINUX_DATA \
+ {0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}}
+#define GPT_ENT_TYPE_LINUX_RAID \
+ {0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}
+#define GPT_ENT_TYPE_LINUX_SWAP \
+ {0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}}
+#define GPT_ENT_TYPE_LINUX_LVM \
+ {0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}
+
+#define GPT_ENT_TYPE_VMFS \
+ {0xaa31e02a,0x400f,0x11db,0x95,0x90,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
+#define GPT_ENT_TYPE_VMKDIAG \
+ {0x9d275380,0x40ad,0x11db,0xbf,0x97,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
+#define GPT_ENT_TYPE_VMRESERVED \
+ {0x9198effc,0x31c0,0x11db,0x8f,0x78,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
+#define GPT_ENT_TYPE_VMVSANHDR \
+ {0x381cfccc,0x7288,0x11e0,0x92,0xee,{0x00,0x0c,0x29,0x11,0xd0,0xb2}}
+
+#define GPT_ENT_TYPE_APPLE_BOOT \
+ {0x426F6F74,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_HFS \
+ {0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_UFS \
+ {0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_ZFS \
+ {0x6a898cc3,0x1dd2,0x11b2,0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}}
+#define GPT_ENT_TYPE_APPLE_RAID \
+ {0x52414944,0x0000,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_RAID_OFFLINE \
+ {0x52414944,0x5f4f,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_LABEL \
+ {0x4C616265,0x6c00,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_TV_RECOVERY \
+ {0x5265636f,0x7665,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+#define GPT_ENT_TYPE_APPLE_CORE_STORAGE \
+ {0x53746f72,0x6167,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
+
+#define GPT_ENT_TYPE_NETBSD_FFS \
+ {0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define GPT_ENT_TYPE_NETBSD_LFS \
+ {0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define GPT_ENT_TYPE_NETBSD_SWAP \
+ {0x49f48d32,0xb10e,0x11dc,0xB9,0x9B,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define GPT_ENT_TYPE_NETBSD_RAID \
+ {0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define GPT_ENT_TYPE_NETBSD_CCD \
+ {0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+#define GPT_ENT_TYPE_NETBSD_CGD \
+ {0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
+
+#define GPT_ENT_TYPE_DRAGONFLY_LABEL32 \
+ {0x9d087404,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_SWAP \
+ {0x9d58fdbd,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_UFS1 \
+ {0x9d94ce7c,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_VINUM \
+ {0x9dd4478f,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_CCD \
+ {0xdbd5211b,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_LABEL64 \
+ {0x3d48ce54,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_LEGACY \
+ {0xbd215ab2,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_HAMMER \
+ {0x61dc63ac,0x6e38,0x11dc,0x85,0x13,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+#define GPT_ENT_TYPE_DRAGONFLY_HAMMER2 \
+ {0x5cbb9ad1,0x862d,0x11dc,0xa9,0x4d,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
+
+#define GPT_ENT_TYPE_CHROMEOS_FIRMWARE \
+ {0xcab6e88e,0xabf3,0x4102,0xa0,0x7a,{0xd4,0xbb,0x9b,0xe3,0xc1,0xd3}}
+#define GPT_ENT_TYPE_CHROMEOS_KERNEL \
+ {0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}
+#define GPT_ENT_TYPE_CHROMEOS_RESERVED \
+ {0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}
+#define GPT_ENT_TYPE_CHROMEOS_ROOT \
+ {0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}
+
+#define GPT_ENT_TYPE_OPENBSD_DATA \
+ {0x824cc7a0,0x36a8,0x11e3,0x89,0x0a,{0x95,0x25,0x19,0xad,0x3f,0x61}}
+
+/*
+ * Boot partition used by GRUB 2.
+ */
+#define GPT_ENT_TYPE_BIOS_BOOT \
+ {0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
+
+#endif /* _SYS_DISK_GPT_H_ */
diff --git a/sys/sys/disk/mbr.h b/sys/sys/disk/mbr.h
new file mode 100644
index 000000000000..33d1fc577dd2
--- /dev/null
+++ b/sys/sys/disk/mbr.h
@@ -0,0 +1,84 @@
+/*-
+ * Copyright (c) 1987, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_MBR_H_
+#define _SYS_DISK_MBR_H_
+
+#define DOSBBSECTOR 0 /* DOS boot block relative sector number */
+#define DOSDSNOFF 440 /* WinNT/2K/XP Drive Serial Number offset */
+#define DOSPARTOFF 446
+#define DOSPARTSIZE 16
+#define NDOSPART 4
+#define NEXTDOSPART 32
+#define DOSMAGICOFFSET 510
+#define DOSMAGIC 0xAA55
+
+#define DOSPTYP_EXT 0x05 /* DOS extended partition */
+#define DOSPTYP_FAT16 0x06 /* FAT16 partition */
+#define DOSPTYP_NTFS 0x07 /* NTFS partition */
+#define DOSPTYP_FAT32 0x0b /* FAT32 partition */
+#define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */
+#define DOSPTYP_PPCBOOT 0x41 /* PReP/CHRP boot partition */
+#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */
+#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */
+#define DOSPTYP_LINUX 0x83 /* Linux partition */
+#define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */
+#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
+#define DOSPTYP_APPLE_UFS 0xa8 /* Apple Mac OS X boot */
+#define DOSPTYP_APPLE_BOOT 0xab /* Apple Mac OS X UFS */
+#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */
+#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */
+#define DOSPTYP_EFI 0xef /* EFI FAT parition */
+#define DOSPTYP_VMFS 0xfb /* VMware VMFS partition */
+#define DOSPTYP_VMKDIAG 0xfc /* VMware vmkDiagnostic partition */
+#define DOSPTYP_LINRAID 0xfd /* Linux raid partition */
+
+struct dos_partition {
+ unsigned char dp_flag; /* bootstrap flags */
+ unsigned char dp_shd; /* starting head */
+ unsigned char dp_ssect; /* starting sector */
+ unsigned char dp_scyl; /* starting cylinder */
+ unsigned char dp_typ; /* partition type */
+ unsigned char dp_ehd; /* end head */
+ unsigned char dp_esect; /* end sector */
+ unsigned char dp_ecyl; /* end cylinder */
+ uint32_t dp_start; /* absolute starting sector number */
+ uint32_t dp_size; /* partition size in sectors */
+};
+#ifdef CTASSERT
+CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE);
+#endif
+
+#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
+#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
+
+#endif /* !_SYS_DISK_MBR_H_ */
diff --git a/sys/sys/disk/pc98.h b/sys/sys/disk/pc98.h
new file mode 100644
index 000000000000..c5ff46c0a584
--- /dev/null
+++ b/sys/sys/disk/pc98.h
@@ -0,0 +1,75 @@
+/*-
+ * Copyright (c) 1987, 1988, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)disklabel.h 8.2 (Berkeley) 7/10/94
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_PC98_H_
+#define _SYS_DISK_PC98_H_
+
+#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */
+#define PC98_PARTOFF 0
+#define PC98_PARTSIZE 32
+#define PC98_NPARTS 16
+#define PC98_MAGICOFS 510
+#define PC98_MAGIC 0xAA55
+
+#define PC98_MID_BOOTABLE 0x80
+#define PC98_MID_MASK 0x7f
+#define PC98_MID_386BSD 0x14
+
+#define PC98_SID_ACTIVE 0x80
+#define PC98_SID_MASK 0x7f
+#define PC98_SID_386BSD 0x44
+
+#define __DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE)
+#define __DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE)
+#define PC98_PTYP_386BSD (__DOSSID_386BSD << 8 | __DOSMID_386BSD)
+
+struct pc98_partition {
+ unsigned char dp_mid;
+ unsigned char dp_sid;
+ unsigned char dp_dum1;
+ unsigned char dp_dum2;
+ unsigned char dp_ipl_sct;
+ unsigned char dp_ipl_head;
+ unsigned short dp_ipl_cyl;
+ unsigned char dp_ssect; /* starting sector */
+ unsigned char dp_shd; /* starting head */
+ unsigned short dp_scyl; /* starting cylinder */
+ unsigned char dp_esect; /* end sector */
+ unsigned char dp_ehd; /* end head */
+ unsigned short dp_ecyl; /* end cylinder */
+ unsigned char dp_name[16];
+};
+#ifdef CTASSERT
+CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE);
+#endif
+
+#endif /* !_SYS_DISK_PC98_H_ */
diff --git a/sys/sys/disk/vtoc.h b/sys/sys/disk/vtoc.h
new file mode 100644
index 000000000000..c784d92717cf
--- /dev/null
+++ b/sys/sys/disk/vtoc.h
@@ -0,0 +1,108 @@
+/*-
+ * Copyright (c) 2008 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _SYS_DISK_VTOC_H_
+#define _SYS_DISK_VTOC_H_
+
+#define VTOC_TAG_UNASSIGNED 0x00
+#define VTOC_TAG_BOOT 0x01
+#define VTOC_TAG_ROOT 0x02
+#define VTOC_TAG_SWAP 0x03
+#define VTOC_TAG_USR 0x04
+#define VTOC_TAG_BACKUP 0x05 /* "c" partition */
+#define VTOC_TAG_STAND 0x06
+#define VTOC_TAG_VAR 0x07
+#define VTOC_TAG_HOME 0x08
+#define VTOC_TAG_ALTSCTR 0x09 /* alternate sector partition */
+#define VTOC_TAG_CACHE 0x0a /* Solaris cachefs partition */
+#define VTOC_TAG_VXVM_PUB 0x0e /* VxVM public region */
+#define VTOC_TAG_VXVM_PRIV 0x0f /* VxVM private region */
+
+/* NetBSD/mips defines this */
+#define VTOC_TAG_NETBSD_FFS 0xff
+
+/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */
+#define VTOC_TAG_FREEBSD_SWAP 0x0901
+#define VTOC_TAG_FREEBSD_UFS 0x0902
+#define VTOC_TAG_FREEBSD_VINUM 0x0903
+#define VTOC_TAG_FREEBSD_ZFS 0x0904
+#define VTOC_TAG_FREEBSD_NANDFS 0x0905
+
+#define VTOC_FLAG_UNMNT 0x01 /* unmountable partition */
+#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */
+
+#define VTOC_ASCII_LEN 128
+#define VTOC_BOOTSIZE 8192 /* 16 sectors */
+#define VTOC_MAGIC 0xdabe
+#define VTOC_RAW_PART 2
+#define VTOC_SANITY 0x600ddeee
+#define VTOC_VERSION 1
+#define VTOC_VOLUME_LEN 8
+
+#define VTOC8_NPARTS 8
+
+struct vtoc8 {
+ char ascii[VTOC_ASCII_LEN];
+ uint32_t version;
+ char volume[VTOC_VOLUME_LEN];
+ uint16_t nparts;
+ struct {
+ uint16_t tag;
+ uint16_t flag;
+ } part[VTOC8_NPARTS];
+ uint16_t __alignment;
+ uint32_t bootinfo[3];
+ uint32_t sanity;
+ uint32_t reserved[10];
+ uint32_t timestamp[VTOC8_NPARTS];
+ uint16_t wskip;
+ uint16_t rskip;
+ char padding[152];
+ uint16_t rpm;
+ uint16_t physcyls;
+ uint16_t sparesecs;
+ uint16_t spare1[2];
+ uint16_t interleave;
+ uint16_t ncyls;
+ uint16_t altcyls;
+ uint16_t nheads;
+ uint16_t nsecs;
+ uint16_t spare2[2];
+ struct {
+ uint32_t cyl;
+ uint32_t nblks;
+ } map[VTOC8_NPARTS];
+ uint16_t magic;
+ uint16_t cksum;
+};
+
+#ifdef CTASSERT
+CTASSERT(sizeof(struct vtoc8) == 512);
+#endif
+
+#endif /* _SYS_DISK_VTOC_H_ */
diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h
index 42c757aaf3a0..f534d5cfcba0 100644
--- a/sys/sys/disklabel.h
+++ b/sys/sys/disklabel.h
@@ -38,115 +38,38 @@
#endif
#include <sys/ioccom.h>
-/*
- * Disk description table, see disktab(5)
- */
+#include <sys/disk/bsd.h>
+
+/* Disk description table, see disktab(5) */
#define _PATH_DISKTAB "/etc/disktab"
/*
- * Each disk has a label which includes information about the hardware
- * disk geometry, filesystem partitions, and drive specific information.
* The label is in block 0 or 1, possibly offset from the beginning
* to leave room for a bootstrap, etc.
+ * XXX these should be defined per controller (or drive) elsewhere, not here!
+ * XXX in actuality it can't even be per controller or drive. It should be
+ * constant/fixed across storage hardware and CPU architectures. Disks can
+ * travel from one machine to another and a label created on one machine
+ * should be detectable and understood by the other.
*/
-
-/* XXX these should be defined per controller (or drive) elsewhere, not here! */
-#if defined(__i386__) || defined(__amd64__) || defined(__arm__) || \
- defined(__powerpc__) || defined(__mips__)
#define LABELSECTOR 1 /* sector containing label */
#define LABELOFFSET 0 /* offset of label in sector */
-#endif
-#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */
+#define DISKMAGIC BSD_MAGIC /* The disk magic number */
+
#ifndef MAXPARTITIONS
-#define MAXPARTITIONS 8
+#define MAXPARTITIONS BSD_NPARTS_MIN
#endif
/* Size of bootblock area in sector-size neutral bytes */
-#define BBSIZE 8192
-
-#define LABEL_PART 2 /* partition containing label */
-#define RAW_PART 2 /* partition containing whole disk */
-#define SWAP_PART 1 /* partition normally containing swap */
-
-struct disklabel {
- u_int32_t d_magic; /* the magic number */
- u_int16_t d_type; /* drive type */
- u_int16_t d_subtype; /* controller/d_type specific */
- char d_typename[16]; /* type name, e.g. "eagle" */
-
- char d_packname[16]; /* pack identifier */
-
- /* disk geometry: */
- u_int32_t d_secsize; /* # of bytes per sector */
- u_int32_t d_nsectors; /* # of data sectors per track */
- u_int32_t d_ntracks; /* # of tracks per cylinder */
- u_int32_t d_ncylinders; /* # of data cylinders per unit */
- u_int32_t d_secpercyl; /* # of data sectors per cylinder */
- u_int32_t d_secperunit; /* # of data sectors per unit */
-
- /*
- * Spares (bad sector replacements) below are not counted in
- * d_nsectors or d_secpercyl. Spare sectors are assumed to
- * be physical sectors which occupy space at the end of each
- * track and/or cylinder.
- */
- u_int16_t d_sparespertrack; /* # of spare sectors per track */
- u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */
- /*
- * Alternate cylinders include maintenance, replacement, configuration
- * description areas, etc.
- */
- u_int32_t d_acylinders; /* # of alt. cylinders per unit */
+#define BBSIZE BSD_BOOTBLOCK_SIZE
- /* hardware characteristics: */
- /*
- * d_interleave, d_trackskew and d_cylskew describe perturbations
- * in the media format used to compensate for a slow controller.
- * Interleave is physical sector interleave, set up by the
- * formatter or controller when formatting. When interleaving is
- * in use, logically adjacent sectors are not physically
- * contiguous, but instead are separated by some number of
- * sectors. It is specified as the ratio of physical sectors
- * traversed per logical sector. Thus an interleave of 1:1
- * implies contiguous layout, while 2:1 implies that logical
- * sector 0 is separated by one sector from logical sector 1.
- * d_trackskew is the offset of sector 0 on track N relative to
- * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew
- * is the offset of sector 0 on cylinder N relative to sector 0
- * on cylinder N-1.
- */
- u_int16_t d_rpm; /* rotational speed */
- u_int16_t d_interleave; /* hardware sector interleave */
- u_int16_t d_trackskew; /* sector 0 skew, per track */
- u_int16_t d_cylskew; /* sector 0 skew, per cylinder */
- u_int32_t d_headswitch; /* head switch time, usec */
- u_int32_t d_trkseek; /* track-to-track seek, usec */
- u_int32_t d_flags; /* generic flags */
-#define NDDATA 5
- u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */
-#define NSPARE 5
- u_int32_t d_spare[NSPARE]; /* reserved for future use */
- u_int32_t d_magic2; /* the magic number (again) */
- u_int16_t d_checksum; /* xor of data incl. partitions */
+#define LABEL_PART BSD_PART_RAW
+#define RAW_PART BSD_PART_RAW
+#define SWAP_PART BSD_PART_SWAP
- /* filesystem and partition information: */
- u_int16_t d_npartitions; /* number of partitions in following */
- u_int32_t d_bbsize; /* size of boot area at sn0, bytes */
- u_int32_t d_sbsize; /* max size of fs superblock, bytes */
- struct partition { /* the partition table */
- u_int32_t p_size; /* number of sectors in partition */
- u_int32_t p_offset; /* starting sector */
- u_int32_t p_fsize; /* filesystem basic fragment size */
- u_int8_t p_fstype; /* filesystem type, see below */
- u_int8_t p_frag; /* filesystem fragments per block */
- u_int16_t p_cpg; /* filesystem cylinders per group */
- } d_partitions[MAXPARTITIONS]; /* actually may be more */
-};
-
-#ifdef CTASSERT
-CTASSERT(sizeof(struct disklabel) == 148 + MAXPARTITIONS * 16);
-#endif
+#define NDDATA BSD_NDRIVEDATA
+#define NSPARE BSD_NSPARE
static __inline u_int16_t dkcksum(struct disklabel *lp);
static __inline u_int16_t
@@ -162,23 +85,6 @@ dkcksum(struct disklabel *lp)
return (sum);
}
-
-/* d_type values: */
-#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */
-#define DTYPE_MSCP 2 /* MSCP */
-#define DTYPE_DEC 3 /* other DEC (rk, rl) */
-#define DTYPE_SCSI 4 /* SCSI */
-#define DTYPE_ESDI 5 /* ESDI interface */
-#define DTYPE_ST506 6 /* ST506 etc. */
-#define DTYPE_HPIB 7 /* CS/80 on HP-IB */
-#define DTYPE_HPFL 8 /* HP Fiber-link */
-#define DTYPE_FLOPPY 10 /* floppy */
-#define DTYPE_CCD 11 /* concatenated disk */
-#define DTYPE_VINUM 12 /* vinum volume */
-#define DTYPE_DOC2K 13 /* Msys DiskOnChip */
-#define DTYPE_RAID 14 /* CMU RAIDFrame */
-#define DTYPE_JFS2 16 /* IBM JFS 2 */
-
#ifdef DKTYPENAMES
static const char *dktypenames[] = {
"unknown",
@@ -203,39 +109,6 @@ static const char *dktypenames[] = {
#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
#endif
-/*
- * Filesystem type and version.
- * Used to interpret other filesystem-specific
- * per-partition information.
- */
-#define FS_UNUSED 0 /* unused */
-#define FS_SWAP 1 /* swap */
-#define FS_V6 2 /* Sixth Edition */
-#define FS_V7 3 /* Seventh Edition */
-#define FS_SYSV 4 /* System V */
-#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */
-#define FS_V8 6 /* Eighth Edition, 4K blocks */
-#define FS_BSDFFS 7 /* 4.2BSD fast filesystem */
-#define FS_MSDOS 8 /* MSDOS filesystem */
-#define FS_BSDLFS 9 /* 4.4BSD log-structured filesystem */
-#define FS_OTHER 10 /* in use, but unknown/unsupported */
-#define FS_HPFS 11 /* OS/2 high-performance filesystem */
-#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */
-#define FS_BOOT 13 /* partition contains bootstrap */
-#define FS_VINUM 14 /* Vinum drive */
-#define FS_RAID 15 /* RAIDFrame drive */
-#define FS_FILECORE 16 /* Acorn Filecore Filing System */
-#define FS_EXT2FS 17 /* ext2fs */
-#define FS_NTFS 18 /* Windows/NT file system */
-#define FS_CCD 20 /* concatenated disk component */
-#define FS_JFS2 21 /* IBM JFS2 */
-#define FS_HAMMER 22 /* DragonFlyBSD Hammer FS */
-#define FS_HAMMER2 23 /* DragonFlyBSD Hammer2 FS */
-#define FS_UDF 24 /* UDF */
-#define FS_EFS 26 /* SGI's Extent File system */
-#define FS_ZFS 27 /* Sun's ZFS */
-#define FS_NANDFS 30 /* FreeBSD nandfs (NiLFS derived) */
-
#ifdef FSTYPENAMES
static const char *fstypenames[] = {
"unused",
@@ -275,15 +148,6 @@ static const char *fstypenames[] = {
#endif
/*
- * flags shared by various drives:
- */
-#define D_REMOVABLE 0x01 /* removable media */
-#define D_ECC 0x02 /* supports ECC */
-#define D_BADSECT 0x04 /* supports bad sector forw. */
-#define D_RAMDISK 0x08 /* disk emulator */
-#define D_CHAIN 0x10 /* can do back-back transfers */
-
-/*
* NB: <sys/disk.h> defines ioctls from 'd'/128 and up.
*/
diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h
index 5f49eb9e8d06..deed3399a0f8 100644
--- a/sys/sys/diskmbr.h
+++ b/sys/sys/diskmbr.h
@@ -33,59 +33,12 @@
#ifndef _SYS_DISKMBR_H_
#define _SYS_DISKMBR_H_
+#include <sys/disk/mbr.h>
#include <sys/ioccom.h>
-#define DOSBBSECTOR 0 /* DOS boot block relative sector number */
-#define DOSDSNOFF 440 /* WinNT/2K/XP Drive Serial Number offset */
-#define DOSPARTOFF 446
-#define DOSPARTSIZE 16
-#define NDOSPART 4
-#define NEXTDOSPART 32
-#define DOSMAGICOFFSET 510
-#define DOSMAGIC 0xAA55
-
-#define DOSPTYP_EXT 0x05 /* DOS extended partition */
-#define DOSPTYP_FAT16 0x06 /* FAT16 partition */
-#define DOSPTYP_NTFS 0x07 /* NTFS partition */
-#define DOSPTYP_FAT32 0x0b /* FAT32 partition */
-#define DOSPTYP_EXTLBA 0x0f /* DOS extended partition */
-#define DOSPTYP_PPCBOOT 0x41 /* PReP/CHRP boot partition */
-#define DOSPTYP_LDM 0x42 /* Win2k dynamic extended partition */
-#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */
-#define DOSPTYP_LINUX 0x83 /* Linux partition */
-#define DOSPTYP_LINLVM 0x8e /* Linux LVM partition */
-#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */
-#define DOSPTYP_APPLE_UFS 0xa8 /* Apple Mac OS X boot */
-#define DOSPTYP_APPLE_BOOT 0xab /* Apple Mac OS X UFS */
-#define DOSPTYP_HFS 0xaf /* HFS/HFS+ partition type */
-#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */
-#define DOSPTYP_EFI 0xef /* EFI FAT parition */
-#define DOSPTYP_VMFS 0xfb /* VMware VMFS partition */
-#define DOSPTYP_VMKDIAG 0xfc /* VMware vmkDiagnostic partition */
-#define DOSPTYP_LINRAID 0xfd /* Linux raid partition */
-
-struct dos_partition {
- unsigned char dp_flag; /* bootstrap flags */
- unsigned char dp_shd; /* starting head */
- unsigned char dp_ssect; /* starting sector */
- unsigned char dp_scyl; /* starting cylinder */
- unsigned char dp_typ; /* partition type */
- unsigned char dp_ehd; /* end head */
- unsigned char dp_esect; /* end sector */
- unsigned char dp_ecyl; /* end cylinder */
- u_int32_t dp_start; /* absolute starting sector number */
- u_int32_t dp_size; /* partition size in sectors */
-};
-#ifdef CTASSERT
-CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE);
-#endif
-
void dos_partition_dec(void const *pp, struct dos_partition *d);
void dos_partition_enc(void *pp, struct dos_partition *d);
-#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */
-#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */
-
#define DIOCSMBR _IOW('M', 129, u_char[512])
#endif /* !_SYS_DISKMBR_H_ */
diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h
index aa0bb0a8f212..5b75df7016b7 100644
--- a/sys/sys/diskpc98.h
+++ b/sys/sys/diskpc98.h
@@ -33,46 +33,11 @@
#ifndef _SYS_DISKPC98_H_
#define _SYS_DISKPC98_H_
+#include <sys/disk/pc98.h>
#include <sys/ioccom.h>
-#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */
-#define PC98_PARTOFF 0
-#define PC98_PARTSIZE 32
-#define PC98_NPARTS 16
-#define PC98_MAGICOFS 510
-#define PC98_MAGIC 0xAA55
-
-#define PC98_MID_BOOTABLE 0x80
-#define PC98_MID_MASK 0x7f
-#define PC98_MID_386BSD 0x14
-
-#define PC98_SID_ACTIVE 0x80
-#define PC98_SID_MASK 0x7f
-#define PC98_SID_386BSD 0x44
-
-#define DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE)
-#define DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE)
-#define PC98_PTYP_386BSD (DOSSID_386BSD << 8 | DOSMID_386BSD)
-
-struct pc98_partition {
- unsigned char dp_mid;
- unsigned char dp_sid;
- unsigned char dp_dum1;
- unsigned char dp_dum2;
- unsigned char dp_ipl_sct;
- unsigned char dp_ipl_head;
- unsigned short dp_ipl_cyl;
- unsigned char dp_ssect; /* starting sector */
- unsigned char dp_shd; /* starting head */
- unsigned short dp_scyl; /* starting cylinder */
- unsigned char dp_esect; /* end sector */
- unsigned char dp_ehd; /* end head */
- unsigned short dp_ecyl; /* end cylinder */
- unsigned char dp_name[16];
-};
-#ifdef CTASSERT
-CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE);
-#endif
+#define DOSMID_386BSD __DOSMID_386BSD
+#define DOSSID_386BSD __DOSSID_386BSD
void pc98_partition_dec(void const *pp, struct pc98_partition *d);
void pc98_partition_enc(void *pp, struct pc98_partition *d);
diff --git a/sys/sys/gpt.h b/sys/sys/gpt.h
index 3ef76b9bf3a2..1f9faac055f6 100644
--- a/sys/sys/gpt.h
+++ b/sys/sys/gpt.h
@@ -31,180 +31,7 @@
#include <sys/uuid.h>
-struct gpt_hdr {
- char hdr_sig[8];
-#define GPT_HDR_SIG "EFI PART"
- uint32_t hdr_revision;
-#define GPT_HDR_REVISION 0x00010000
- uint32_t hdr_size;
- uint32_t hdr_crc_self;
- uint32_t __reserved;
- uint64_t hdr_lba_self;
- uint64_t hdr_lba_alt;
- uint64_t hdr_lba_start;
- uint64_t hdr_lba_end;
- struct uuid hdr_uuid;
- uint64_t hdr_lba_table;
- uint32_t hdr_entries;
- uint32_t hdr_entsz;
- uint32_t hdr_crc_table;
- /*
- * The header as defined in the EFI spec is not a multiple of 8 bytes
- * and given that the alignment requirement is on an 8 byte boundary,
- * padding will happen. We make the padding explicit so that we can
- * correct the value returned by sizeof() when we put the size of the
- * header in field hdr_size, or otherwise use offsetof().
- */
- uint32_t padding;
-};
-
-struct gpt_ent {
- struct uuid ent_type;
- struct uuid ent_uuid;
- uint64_t ent_lba_start;
- uint64_t ent_lba_end;
- uint64_t ent_attr;
-#define GPT_ENT_ATTR_PLATFORM (1ULL << 0)
-#define GPT_ENT_ATTR_BOOTME (1ULL << 59)
-#define GPT_ENT_ATTR_BOOTONCE (1ULL << 58)
-#define GPT_ENT_ATTR_BOOTFAILED (1ULL << 57)
- uint16_t ent_name[36]; /* UTF-16. */
-};
-
-#define GPT_ENT_TYPE_UNUSED \
- {0x00000000,0x0000,0x0000,0x00,0x00,{0x00,0x00,0x00,0x00,0x00,0x00}}
-#define GPT_ENT_TYPE_EFI \
- {0xc12a7328,0xf81f,0x11d2,0xba,0x4b,{0x00,0xa0,0xc9,0x3e,0xc9,0x3b}}
-#define GPT_ENT_TYPE_MBR \
- {0x024dee41,0x33e7,0x11d3,0x9d,0x69,{0x00,0x08,0xc7,0x81,0xf3,0x9f}}
-#define GPT_ENT_TYPE_FREEBSD \
- {0x516e7cb4,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
-#define GPT_ENT_TYPE_FREEBSD_BOOT \
- {0x83bd6b9d,0x7f41,0x11dc,0xbe,0x0b,{0x00,0x15,0x60,0xb8,0x4f,0x0f}}
-#define GPT_ENT_TYPE_FREEBSD_NANDFS \
- {0x74ba7dd9,0xa689,0x11e1,0xbd,0x04,{0x00,0xe0,0x81,0x28,0x6a,0xcf}}
-#define GPT_ENT_TYPE_FREEBSD_SWAP \
- {0x516e7cb5,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
-#define GPT_ENT_TYPE_FREEBSD_UFS \
- {0x516e7cb6,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
-#define GPT_ENT_TYPE_FREEBSD_VINUM \
- {0x516e7cb8,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
-#define GPT_ENT_TYPE_FREEBSD_ZFS \
- {0x516e7cba,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
-#define GPT_ENT_TYPE_PREP_BOOT \
- {0x9e1a2d38,0xc612,0x4316,0xaa,0x26,{0x8b,0x49,0x52,0x1e,0x5a,0x8b}}
-
-/*
- * The following are unused but documented here to avoid reuse.
- *
- * GPT_ENT_TYPE_FREEBSD_UFS2 \
- * {0x516e7cb7,0x6ecf,0x11d6,0x8f,0xf8,{0x00,0x02,0x2d,0x09,0x71,0x2b}}
- */
-
-/*
- * Foreign partition types that we're likely to encounter. Note that Linux
- * apparently choose to share data partitions with MS. I don't what the
- * advantage might be. I can see how sharing swap partitions is advantageous
- * though.
- */
-#define GPT_ENT_TYPE_MS_BASIC_DATA \
- {0xebd0a0a2,0xb9e5,0x4433,0x87,0xc0,{0x68,0xb6,0xb7,0x26,0x99,0xc7}}
-#define GPT_ENT_TYPE_MS_LDM_DATA \
- {0xaf9b60a0,0x1431,0x4f62,0xbc,0x68,{0x33,0x11,0x71,0x4a,0x69,0xad}}
-#define GPT_ENT_TYPE_MS_LDM_METADATA \
- {0x5808c8aa,0x7e8f,0x42e0,0x85,0xd2,{0xe1,0xe9,0x04,0x34,0xcf,0xb3}}
-#define GPT_ENT_TYPE_MS_RECOVERY \
- {0xde94bba4,0x06d1,0x4d40,0xa1,0x6a,{0xbf,0xd5,0x01,0x79,0xd6,0xac}}
-#define GPT_ENT_TYPE_MS_RESERVED \
- {0xe3c9e316,0x0b5c,0x4db8,0x81,0x7d,{0xf9,0x2d,0xf0,0x02,0x15,0xae}}
-#define GPT_ENT_TYPE_MS_SPACES \
- {0xe75caf8f,0xf680,0x4cee,0xaf,0xa3,{0xb0,0x01,0xe5,0x6e,0xfc,0x2d}}
-
-#define GPT_ENT_TYPE_LINUX_DATA \
- {0x0fc63daf,0x8483,0x4772,0x8e,0x79,{0x3d,0x69,0xd8,0x47,0x7d,0xe4}}
-#define GPT_ENT_TYPE_LINUX_RAID \
- {0xa19d880f,0x05fc,0x4d3b,0xa0,0x06,{0x74,0x3f,0x0f,0x84,0x91,0x1e}}
-#define GPT_ENT_TYPE_LINUX_SWAP \
- {0x0657fd6d,0xa4ab,0x43c4,0x84,0xe5,{0x09,0x33,0xc8,0x4b,0x4f,0x4f}}
-#define GPT_ENT_TYPE_LINUX_LVM \
- {0xe6d6d379,0xf507,0x44c2,0xa2,0x3c,{0x23,0x8f,0x2a,0x3d,0xf9,0x28}}
-
-#define GPT_ENT_TYPE_VMFS \
- {0xaa31e02a,0x400f,0x11db,0x95,0x90,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
-#define GPT_ENT_TYPE_VMKDIAG \
- {0x9d275380,0x40ad,0x11db,0xbf,0x97,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
-#define GPT_ENT_TYPE_VMRESERVED \
- {0x9198effc,0x31c0,0x11db,0x8f,0x78,{0x00,0x0c,0x29,0x11,0xd1,0xb8}}
-#define GPT_ENT_TYPE_VMVSANHDR \
- {0x381cfccc,0x7288,0x11e0,0x92,0xee,{0x00,0x0c,0x29,0x11,0xd0,0xb2}}
-
-#define GPT_ENT_TYPE_APPLE_BOOT \
- {0x426F6F74,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_HFS \
- {0x48465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_UFS \
- {0x55465300,0x0000,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_ZFS \
- {0x6a898cc3,0x1dd2,0x11b2,0x99,0xa6,{0x08,0x00,0x20,0x73,0x66,0x31}}
-#define GPT_ENT_TYPE_APPLE_RAID \
- {0x52414944,0x0000,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_RAID_OFFLINE \
- {0x52414944,0x5f4f,0x11aa,0xaa,0x22,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_LABEL \
- {0x4C616265,0x6c00,0x11aa,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_TV_RECOVERY \
- {0x5265636f,0x7665,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-#define GPT_ENT_TYPE_APPLE_CORE_STORAGE \
- {0x53746f72,0x6167,0x11AA,0xaa,0x11,{0x00,0x30,0x65,0x43,0xec,0xac}}
-
-#define GPT_ENT_TYPE_NETBSD_FFS \
- {0x49f48d5a,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-#define GPT_ENT_TYPE_NETBSD_LFS \
- {0x49f48d82,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-#define GPT_ENT_TYPE_NETBSD_SWAP \
- {0x49f48d32,0xb10e,0x11dc,0xB9,0x9B,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-#define GPT_ENT_TYPE_NETBSD_RAID \
- {0x49f48daa,0xb10e,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-#define GPT_ENT_TYPE_NETBSD_CCD \
- {0x2db519c4,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-#define GPT_ENT_TYPE_NETBSD_CGD \
- {0x2db519ec,0xb10f,0x11dc,0xb9,0x9b,{0x00,0x19,0xd1,0x87,0x96,0x48}}
-
-#define GPT_ENT_TYPE_DRAGONFLY_LABEL32 \
- {0x9d087404,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_SWAP \
- {0x9d58fdbd,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_UFS1 \
- {0x9d94ce7c,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_VINUM \
- {0x9dd4478f,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_CCD \
- {0xdbd5211b,0x1ca5,0x11dc,0x88,0x17,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_LABEL64 \
- {0x3d48ce54,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_LEGACY \
- {0xbd215ab2,0x1d16,0x11dc,0x86,0x96,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_HAMMER \
- {0x61dc63ac,0x6e38,0x11dc,0x85,0x13,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-#define GPT_ENT_TYPE_DRAGONFLY_HAMMER2 \
- {0x5cbb9ad1,0x862d,0x11dc,0xa9,0x4d,{0x01,0x30,0x1b,0xb8,0xa9,0xf5}}
-
-#define GPT_ENT_TYPE_CHROMEOS_FIRMWARE \
- {0xcab6e88e,0xabf3,0x4102,0xa0,0x7a,{0xd4,0xbb,0x9b,0xe3,0xc1,0xd3}}
-#define GPT_ENT_TYPE_CHROMEOS_KERNEL \
- {0xfe3a2a5d,0x4f32,0x41a7,0xb7,0x25,{0xac,0xcc,0x32,0x85,0xa3,0x09}}
-#define GPT_ENT_TYPE_CHROMEOS_RESERVED \
- {0x2e0a753d,0x9e48,0x43b0,0x83,0x37,{0xb1,0x51,0x92,0xcb,0x1b,0x5e}}
-#define GPT_ENT_TYPE_CHROMEOS_ROOT \
- {0x3cb8e202,0x3b7e,0x47dd,0x8a,0x3c,{0x7f,0xf2,0xa1,0x3c,0xfc,0xec}}
-
-#define GPT_ENT_TYPE_OPENBSD_DATA \
- {0x824cc7a0,0x36a8,0x11e3,0x89,0x0a,{0x95,0x25,0x19,0xad,0x3f,0x61}}
-
-/*
- * Boot partition used by GRUB 2.
- */
-#define GPT_ENT_TYPE_BIOS_BOOT \
- {0x21686148,0x6449,0x6e6f,0x74,0x4e,{0x65,0x65,0x64,0x45,0x46,0x49}}
+#define GPT_UUID_TYPE struct uuid
+#include <sys/disk/gpt.h>
#endif /* _SYS_GPT_H_ */
diff --git a/sys/sys/vtoc.h b/sys/sys/vtoc.h
index 82c6a57dc138..85b5fb6d6614 100644
--- a/sys/sys/vtoc.h
+++ b/sys/sys/vtoc.h
@@ -1,108 +1,5 @@
/*-
- * Copyright (c) 2008 Marcel Moolenaar
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
+ * This file is in the public domain.
*/
-
-#ifndef _SYS_VTOC_H_
-#define _SYS_VTOC_H_
-
-#define VTOC_TAG_UNASSIGNED 0x00
-#define VTOC_TAG_BOOT 0x01
-#define VTOC_TAG_ROOT 0x02
-#define VTOC_TAG_SWAP 0x03
-#define VTOC_TAG_USR 0x04
-#define VTOC_TAG_BACKUP 0x05 /* "c" partition */
-#define VTOC_TAG_STAND 0x06
-#define VTOC_TAG_VAR 0x07
-#define VTOC_TAG_HOME 0x08
-#define VTOC_TAG_ALTSCTR 0x09 /* alternate sector partition */
-#define VTOC_TAG_CACHE 0x0a /* Solaris cachefs partition */
-#define VTOC_TAG_VXVM_PUB 0x0e /* VxVM public region */
-#define VTOC_TAG_VXVM_PRIV 0x0f /* VxVM private region */
-
-/* NetBSD/mips defines this */
-#define VTOC_TAG_NETBSD_FFS 0xff
-
-/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */
-#define VTOC_TAG_FREEBSD_SWAP 0x0901
-#define VTOC_TAG_FREEBSD_UFS 0x0902
-#define VTOC_TAG_FREEBSD_VINUM 0x0903
-#define VTOC_TAG_FREEBSD_ZFS 0x0904
-#define VTOC_TAG_FREEBSD_NANDFS 0x0905
-
-#define VTOC_FLAG_UNMNT 0x01 /* unmountable partition */
-#define VTOC_FLAG_RDONLY 0x10 /* partition is read/only */
-
-#define VTOC_ASCII_LEN 128
-#define VTOC_BOOTSIZE 8192 /* 16 sectors */
-#define VTOC_MAGIC 0xdabe
-#define VTOC_RAW_PART 2
-#define VTOC_SANITY 0x600ddeee
-#define VTOC_VERSION 1
-#define VTOC_VOLUME_LEN 8
-
-#define VTOC8_NPARTS 8
-
-struct vtoc8 {
- char ascii[VTOC_ASCII_LEN];
- uint32_t version;
- char volume[VTOC_VOLUME_LEN];
- uint16_t nparts;
- struct {
- uint16_t tag;
- uint16_t flag;
- } part[VTOC8_NPARTS] __packed;
- uint16_t __alignment;
- uint32_t bootinfo[3];
- uint32_t sanity;
- uint32_t reserved[10];
- uint32_t timestamp[VTOC8_NPARTS];
- uint16_t wskip;
- uint16_t rskip;
- char padding[152];
- uint16_t rpm;
- uint16_t physcyls;
- uint16_t sparesecs;
- uint16_t spare1[2];
- uint16_t interleave;
- uint16_t ncyls;
- uint16_t altcyls;
- uint16_t nheads;
- uint16_t nsecs;
- uint16_t spare2[2];
- struct {
- uint32_t cyl;
- uint32_t nblks;
- } map[VTOC8_NPARTS];
- uint16_t magic;
- uint16_t cksum;
-} __packed;
-
-#ifdef CTASSERT
-CTASSERT(sizeof(struct vtoc8) == 512);
-#endif
-
-#endif /* _SYS_VTOC_H_ */
+/* $FreeBSD$ */
+#include <sys/disk/vtoc.h>