173dba51marcel/*-
273dba51marcel * Copyright (c) 2008 Marcel Moolenaar
373dba51marcel * All rights reserved.
473dba51marcel *
573dba51marcel * Redistribution and use in source and binary forms, with or without
673dba51marcel * modification, are permitted provided that the following conditions
773dba51marcel * are met:
873dba51marcel *
973dba51marcel * 1. Redistributions of source code must retain the above copyright
1073dba51marcel *    notice, this list of conditions and the following disclaimer.
1173dba51marcel * 2. Redistributions in binary form must reproduce the above copyright
1273dba51marcel *    notice, this list of conditions and the following disclaimer in the
1373dba51marcel *    documentation and/or other materials provided with the distribution.
1473dba51marcel *
1573dba51marcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1673dba51marcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1773dba51marcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1873dba51marcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1973dba51marcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2073dba51marcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2173dba51marcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2273dba51marcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2373dba51marcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2473dba51marcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2573dba51marcel *
2673dba51marcel * $FreeBSD$
2773dba51marcel */
2873dba51marcel
2973dba51marcel#ifndef _SYS_DISK_VTOC_H_
3073dba51marcel#define	_SYS_DISK_VTOC_H_
3173dba51marcel
3273dba51marcel#define	VTOC_TAG_UNASSIGNED	0x00
3373dba51marcel#define	VTOC_TAG_BOOT		0x01
3473dba51marcel#define	VTOC_TAG_ROOT		0x02
3573dba51marcel#define	VTOC_TAG_SWAP		0x03
3673dba51marcel#define	VTOC_TAG_USR		0x04
3773dba51marcel#define	VTOC_TAG_BACKUP		0x05	/* "c" partition */
3873dba51marcel#define	VTOC_TAG_STAND		0x06
3973dba51marcel#define	VTOC_TAG_VAR		0x07
4073dba51marcel#define	VTOC_TAG_HOME		0x08
4173dba51marcel#define	VTOC_TAG_ALTSCTR	0x09	/* alternate sector partition */
4273dba51marcel#define	VTOC_TAG_CACHE		0x0a	/* Solaris cachefs partition */
4373dba51marcel#define	VTOC_TAG_VXVM_PUB	0x0e	/* VxVM public region */
4473dba51marcel#define	VTOC_TAG_VXVM_PRIV	0x0f	/* VxVM private region */
4573dba51marcel
4673dba51marcel/* NetBSD/mips defines this */
4773dba51marcel#define	VTOC_TAG_NETBSD_FFS	0xff
4873dba51marcel
4973dba51marcel/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */
5073dba51marcel#define	VTOC_TAG_FREEBSD_SWAP	0x0901
5173dba51marcel#define	VTOC_TAG_FREEBSD_UFS	0x0902
5273dba51marcel#define	VTOC_TAG_FREEBSD_VINUM	0x0903
5373dba51marcel#define	VTOC_TAG_FREEBSD_ZFS	0x0904
5473dba51marcel#define	VTOC_TAG_FREEBSD_NANDFS	0x0905
5573dba51marcel
5673dba51marcel#define	VTOC_FLAG_UNMNT		0x01	/* unmountable partition */
5773dba51marcel#define	VTOC_FLAG_RDONLY	0x10    /* partition is read/only */
5873dba51marcel
5973dba51marcel#define	VTOC_ASCII_LEN	128
6073dba51marcel#define	VTOC_BOOTSIZE	8192		/* 16 sectors */
6173dba51marcel#define	VTOC_MAGIC	0xdabe
6273dba51marcel#define	VTOC_RAW_PART	2
6373dba51marcel#define	VTOC_SANITY	0x600ddeee
6473dba51marcel#define	VTOC_VERSION	1
6573dba51marcel#define	VTOC_VOLUME_LEN	8
6673dba51marcel
6773dba51marcel#define	VTOC8_NPARTS	8
6873dba51marcel
6973dba51marcelstruct vtoc8 {
7073dba51marcel	char		ascii[VTOC_ASCII_LEN];
7173dba51marcel	uint32_t	version;
7273dba51marcel	char		volume[VTOC_VOLUME_LEN];
7373dba51marcel	uint16_t	nparts;
7473dba51marcel	struct {
7573dba51marcel		uint16_t	tag;
7673dba51marcel		uint16_t	flag;
7773dba51marcel	} part[VTOC8_NPARTS];
7873dba51marcel	uint16_t	__alignment;
7973dba51marcel	uint32_t	bootinfo[3];
8073dba51marcel	uint32_t	sanity;
8173dba51marcel	uint32_t	reserved[10];
8273dba51marcel	uint32_t	timestamp[VTOC8_NPARTS];
8373dba51marcel	uint16_t	wskip;
8473dba51marcel	uint16_t	rskip;
8573dba51marcel	char		padding[152];
8673dba51marcel	uint16_t	rpm;
8773dba51marcel	uint16_t	physcyls;
8873dba51marcel	uint16_t	sparesecs;
8973dba51marcel	uint16_t	spare1[2];
9073dba51marcel	uint16_t	interleave;
9173dba51marcel	uint16_t	ncyls;
9273dba51marcel	uint16_t	altcyls;
9373dba51marcel	uint16_t	nheads;
9473dba51marcel	uint16_t	nsecs;
9573dba51marcel	uint16_t	spare2[2];
9673dba51marcel	struct {
9773dba51marcel		uint32_t	cyl;
9873dba51marcel		uint32_t	nblks;
9973dba51marcel	} map[VTOC8_NPARTS];
10073dba51marcel	uint16_t	magic;
10173dba51marcel	uint16_t	cksum;
10273dba51marcel};
10373dba51marcel
10473dba51marcel#ifdef CTASSERT
10573dba51marcelCTASSERT(sizeof(struct vtoc8) == 512);
10673dba51marcel#endif
10773dba51marcel
10873dba51marcel#endif /* _SYS_DISK_VTOC_H_ */
109