1 /* $NetBSD: vtoc.h,v 1.2 2007/02/21 22:59:41 thorpej Exp $ */
4 * Copyright (c) 2004 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
32 #ifndef _EWS4800MIPS_VTOC_H_
33 #define _EWS4800MIPS_VTOC_H_
35 /* Volume Table Of Contents */
37 #define VTOC_MAXPARTITIONS 16
38 #define VTOC_SECTOR 1 /* sector */
39 #define VTOC_MINSIZE 16 /* sector */
41 #define VTOC_MAGIC 0x600ddeee
42 #define VTOC_VERSION 1
44 #define VTOC_TAG_NONAME 0x00
45 #define VTOC_TAG_BOOT 0x01
46 #define VTOC_TAG_ROOT 0x02
47 #define VTOC_TAG_SWAP 0x03
48 #define VTOC_TAG_USR 0x04
49 #define VTOC_TAG_RAWDISK 0x05
50 #define VTOC_TAG_STAND 0x06 /* bfs */
51 #define VTOC_TAG_VAR 0x07
52 #define VTOC_TAG_HOME 0x08
53 #define __VTOC_TAG_BSDFFS 0xff /* ews4800mips port original define */
55 #define VTOC_FLAG_UNMOUNT 0x01
56 #define VTOC_FLAG_RDONLY 0x10
60 uint16_t flags
; /* 2 */
61 uint32_t start_sector
; /* 4 */
62 int32_t nsectors
; /* 8 */
63 } __attribute__((__packed__
));
67 uint32_t bootinfo
[3]; /* 0 */
68 uint32_t magic
; /* 12 */
69 uint32_t version
; /* 16 */
70 int8_t volume
[8]; /* 20 */
71 uint16_t sector_size_byte
; /* 28 */
72 uint16_t npartitions
; /* 30 */
73 uint32_t reserved
[10]; /* 32 */
74 struct ux_partition partition
[VTOC_MAXPARTITIONS
]; /* 72 */
75 uint32_t timestamp
[VTOC_MAXPARTITIONS
]; /* 264 */
76 int32_t padding
[46]; /* 328 */
77 } __attribute__((__packed__
)); /* 512 byte */
81 #if defined(_KERNEL) || defined(_STANDALONE)
82 bool vtoc_sector(void *, struct vtoc_sector
*, int);
83 bool vtoc_valid(const struct vtoc_sector
*);
84 bool vtoc_sanity(const struct vtoc_sector
*);
85 const struct ux_partition
*vtoc_find_bfs(const struct vtoc_sector
*);
86 bool vtoc_write(struct vtoc_sector
*, struct pdinfo_sector
*);
89 #endif /* _EWS4800MIPS_VTOC_H_ */