vtoc.h revision 176718
1176718Smarcel/*-
2176718Smarcel * Copyright (c) 2008 Marcel Moolenaar
3176718Smarcel * All rights reserved.
4176718Smarcel *
5176718Smarcel * Redistribution and use in source and binary forms, with or without
6176718Smarcel * modification, are permitted provided that the following conditions
7176718Smarcel * are met:
8176718Smarcel *
9176718Smarcel * 1. Redistributions of source code must retain the above copyright
10176718Smarcel *    notice, this list of conditions and the following disclaimer.
11176718Smarcel * 2. Redistributions in binary form must reproduce the above copyright
12176718Smarcel *    notice, this list of conditions and the following disclaimer in the
13176718Smarcel *    documentation and/or other materials provided with the distribution.
14176718Smarcel *
15176718Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16176718Smarcel * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17176718Smarcel * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18176718Smarcel * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19176718Smarcel * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20176718Smarcel * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21176718Smarcel * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22176718Smarcel * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23176718Smarcel * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24176718Smarcel * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25176718Smarcel *
26176718Smarcel * $FreeBSD: head/sys/sys/vtoc.h 176718 2008-03-02 00:52:49Z marcel $
27176718Smarcel */
28176718Smarcel
29176718Smarcel#ifndef _SYS_VTOC_H_
30176718Smarcel#define	_SYS_VTOC_H_
31176718Smarcel
32176718Smarcel#define	VTOC_TAG_UNASSIGNED	0x00
33176718Smarcel#define	VTOC_TAG_BOOT		0x01
34176718Smarcel#define	VTOC_TAG_ROOT		0x02
35176718Smarcel#define	VTOC_TAG_SWAP		0x03
36176718Smarcel#define	VTOC_TAG_USR		0x04
37176718Smarcel#define	VTOC_TAG_BACKUP		0x05	/* "c" partition */
38176718Smarcel#define	VTOC_TAG_STAND		0x06
39176718Smarcel#define	VTOC_TAG_VAR		0x07
40176718Smarcel#define	VTOC_TAG_HOME		0x08
41176718Smarcel#define	VTOC_TAG_ALTSCTR	0x09	/* alternate sector partition */
42176718Smarcel#define	VTOC_TAG_CACHE		0x0a	/* Solaris cachefs partition */
43176718Smarcel#define	VTOC_TAG_VXVM_PUB	0x0e	/* VxVM public region */
44176718Smarcel#define	VTOC_TAG_VXVM_PRIV	0x0f	/* VxVM private region */
45176718Smarcel
46176718Smarcel/* NetBSD/mips defines this */
47176718Smarcel#define	VTOC_TAG_NETBSD_FFS	0xff
48176718Smarcel
49176718Smarcel/* FreeBSD tags: the high byte equals ELFOSABI_FREEBSD */
50176718Smarcel#define	VTOC_TAG_FREEBSD_SWAP	0x0901
51176718Smarcel#define	VTOC_TAG_FREEBSD_UFS	0x0902
52176718Smarcel#define	VTOC_TAG_FREEBSD_VINUM	0x0903
53176718Smarcel#define	VTOC_TAG_FREEBSD_ZFS	0x0904
54176718Smarcel
55176718Smarcel#define	VTOC_FLAG_UNMNT		0x01	/* unmountable partition */
56176718Smarcel#define VTOC_FLAG_RDONLY	0x10    /* partition is read/only */
57176718Smarcel
58176718Smarcel#define	VTOC_ASCII_LEN	128
59176718Smarcel#define	VTOC_MAGIC	0xdabe
60176718Smarcel#define	VTOC_RAW_PART	2
61176718Smarcel#define	VTOC_SANITY	0x600ddeee
62176718Smarcel#define	VTOC_VERSION	1
63176718Smarcel#define	VTOC_VOLUME_LEN	8
64176718Smarcel
65176718Smarcel#define	VTOC8_NPARTS	8
66176718Smarcel
67176718Smarcelstruct vtoc8 {
68176718Smarcel	char		ascii[VTOC_ASCII_LEN];
69176718Smarcel	uint32_t	version;
70176718Smarcel	char		volume[VTOC_VOLUME_LEN];
71176718Smarcel	uint16_t	nparts;
72176718Smarcel	struct {
73176718Smarcel		uint16_t	tag;
74176718Smarcel		uint16_t	flag;
75176718Smarcel	} part[VTOC8_NPARTS];
76176718Smarcel	uint16_t	__alignment;
77176718Smarcel	uint32_t	bootinfo[3];
78176718Smarcel	uint32_t	sanity;
79176718Smarcel	uint32_t	reserved[10];
80176718Smarcel	uint32_t	timestamp[VTOC8_NPARTS];
81176718Smarcel	uint16_t	wskip;
82176718Smarcel	uint16_t	rskip;
83176718Smarcel	char		padding[152];
84176718Smarcel	uint16_t	rpm;
85176718Smarcel	uint16_t	physcyls;
86176718Smarcel	uint16_t	sparesecs;
87176718Smarcel	uint16_t	spare1[2];
88176718Smarcel	uint16_t	interleave;
89176718Smarcel	uint16_t	ncyls;
90176718Smarcel	uint16_t	altcyls;
91176718Smarcel	uint16_t	nheads;
92176718Smarcel	uint16_t	nsecs;
93176718Smarcel	uint16_t	spare2[2];
94176718Smarcel	struct {
95176718Smarcel		uint32_t	cyl;
96176718Smarcel		uint32_t	nblks;
97176718Smarcel	} map[VTOC8_NPARTS];
98176718Smarcel	uint16_t	magic;
99176718Smarcel	uint16_t	cksum;
100176718Smarcel};
101176718Smarcel
102176718Smarcel#ifdef CTASSERT
103176718SmarcelCTASSERT(sizeof(struct vtoc8) == 512);
104176718Smarcel#endif
105176718Smarcel
106176718Smarcel#endif /* _SYS_VTOC_H_ */
107