jcs's openbsd hax
openbsd
1/* $OpenBSD: disklabel.h,v 1.9 2025/11/18 15:24:09 krw Exp $ */
2/* $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $ */
3
4/*
5 * Copyright (c) 1992, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * This software was developed by the Computer Systems Engineering group
9 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10 * contributed to Berkeley.
11 *
12 * All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement:
14 * This product includes software developed by the University of
15 * California, Lawrence Berkeley Laboratory.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions
19 * are met:
20 * 1. Redistributions of source code must retain the above copyright
21 * notice, this list of conditions and the following disclaimer.
22 * 2. Redistributions in binary form must reproduce the above copyright
23 * notice, this list of conditions and the following disclaimer in the
24 * documentation and/or other materials provided with the distribution.
25 * 3. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 * @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93
42 */
43
44/*
45 * SunOS disk label layout (only relevant portions discovered here).
46 * This describes the format typically found on SPARC systems, but not
47 * that usually seen on SunOS/x86 and SunOS/amd64 systems.
48 */
49
50#define SUN_DKMAGIC 55998
51
52/* partition info */
53struct sun_dkpart {
54 u_int sdkp_cyloffset; /* starting cylinder */
55 u_int sdkp_nsectors; /* number of sectors */
56};
57
58/* partition types */
59struct sun_partinfo {
60 u_short spi_tag; /* filesystem type */
61 u_short spi_flag; /* flags */
62};
63
64/* some spi_tag values */
65#define SPTAG_EMPTY 0x00
66#define SPTAG_BOOT 0x01
67#define SPTAG_SUNOS_ROOT 0x02
68#define SPTAG_SUNOS_SWAP 0x03
69#define SPTAG_SUNOS_USR 0x04
70#define SPTAG_WHOLE_DISK 0x05
71#define SPTAG_SUNOS_STAND 0x06
72#define SPTAG_SUNOS_VAR 0x07
73#define SPTAG_SUNOS_HOME 0x08
74#define SPTAG_LINUX_SWAP 0x82
75#define SPTAG_LINUX_EXT2 0x83
76
77#define SUNXPART 8
78#define SL_XPMAG (0x199d1fe2+SUNXPART)
79#define SL_XPMAGTYP (0x199d1fe2+SUNXPART+1) /* contains types */
80
81struct sun_disklabel { /* total size = 512 bytes */
82 char sl_text[128];
83 u_int sl_xpsum; /* additive cksum, [xl_xpmag,sl_xx1) */
84 u_int sl_xpmag; /* "extended" magic number */
85 struct sun_dkpart sl_xpart[SUNXPART]; /* "extended" partitions i..p */
86 u_char sl_types[MAXPARTITIONS16];
87 u_int8_t sl_fragblock[MAXPARTITIONS16];
88 u_int16_t sl_cpg[MAXPARTITIONS16];
89 u_char sl_uid[8]; /* extension: unique disk label */
90 char sl_xxx1[292 - sizeof(u_int) - sizeof(u_int) -
91 (sizeof(struct sun_dkpart) * SUNXPART) -
92 sizeof(u_char) * MAXPARTITIONS16 -
93 sizeof(u_int8_t) * MAXPARTITIONS16 -
94 sizeof(u_int16_t) * MAXPARTITIONS16 -
95 sizeof(u_int64_t)];
96 u_short sl_rpm; /* rotational speed */
97 u_short sl_pcylinders; /* number of physical cyls */
98#define sl_pcyl sl_pcylinders /* XXX: old sun3 */
99 u_short sl_sparespercyl; /* spare sectors per cylinder */
100 char sl_xxx3[4];
101 u_short sl_interleave; /* interleave factor */
102 u_short sl_ncylinders; /* data cylinders */
103 u_short sl_acylinders; /* alternate cylinders */
104 u_short sl_ntracks; /* tracks per cylinder */
105 u_short sl_nsectors; /* sectors per track */
106 char sl_xxx4[4];
107 struct sun_dkpart sl_part[8]; /* partition layout */
108 u_short sl_magic; /* == SUN_DKMAGIC */
109 u_short sl_cksum; /* xor checksum of all shorts */
110};
111
112/* Sun standard fields, also used on Linux. */
113struct sun_preamble {
114 char sl_text[128];
115 u_int sl_version; /* label version */
116 char sl_volume[8]; /* short volume name */
117 u_short sl_nparts; /* partition count */
118
119 struct sun_partinfo sl_part[8];
120};