]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/sys/sun_disklabel.h
sys/{x86,amd64}: remove one of doubled ;s
[FreeBSD/FreeBSD.git] / sys / sys / sun_disklabel.h
1 /*-
2  * SPDX-License-Identifier: BSD-3-Clause
3  *
4  * Copyright (c) 1992, 1993
5  *      The Regents of the University of California.  All rights reserved.
6  * Copyright (c) 2004,2005 Joerg Wunsch
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  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. Neither the name of the University nor the names of its contributors
21  *    may be used to endorse or promote products derived from this software
22  *    without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34  * SUCH DAMAGE.
35  *
36  *      @(#)sun_disklabel.h     8.1 (Berkeley) 6/11/93
37  *      $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $
38  *
39  * $FreeBSD$ 
40  */
41
42 #ifndef _SYS_SUN_DISKLABEL_H_
43 #define _SYS_SUN_DISKLABEL_H_
44
45 /*
46  * SunOS/Solaris disk label layout (partial).
47  * 
48  * Suns disk label format contains a lot of historical baggage which we 
49  * ignore entirely.  The structure below contains the relevant bits and the
50  * _enc/_dec functions encode/decode only these fields.
51  */
52
53 #define SUN_DKMAGIC     55998
54 #define SUN_NPART       8
55 #define SUN_RAWPART     2
56 #define SUN_SIZE        512
57 #define SUN_VTOC_VERSION 1
58 #define SUN_VTOC_SANE   0x600DDEEE /* SVR4-compatible VTOC is "sane". */
59 #define SUN_VOLNAME_LEN 8
60 /*
61  * XXX: I am actually not sure if this should be "16 sectors" or "8192 bytes".
62  * XXX: Considering that Sun went to the effort of getting 512 byte compatible
63  * XXX: CDROM drives produced my guess is that Sun computers stand little or
64  * XXX: even no chance of running, much less booting on !=512 byte media.
65  * XXX: Define this is in terms of bytes since that is easier for us.
66  */
67 #define SUN_BOOTSIZE    8192
68
69 /* partition info */
70 struct sun_dkpart {
71         u_int32_t       sdkp_cyloffset;         /* starting cylinder */
72         u_int32_t       sdkp_nsectors;          /* number of sectors */
73 };
74
75 struct sun_vtoc_info {
76         u_int16_t       svtoc_tag;              /* partition tag */
77         u_int16_t       svtoc_flag;             /* partition flags */
78 };
79
80 /* known partition tag values */
81 #define VTOC_UNASSIGNED 0x00
82 #define VTOC_BOOT       0x01
83 #define VTOC_ROOT       0x02
84 #define VTOC_SWAP       0x03
85 #define VTOC_USR        0x04
86 #define VTOC_BACKUP     0x05    /* "c" partition, covers entire disk */
87 #define VTOC_STAND      0x06
88 #define VTOC_VAR        0x07
89 #define VTOC_HOME       0x08
90 #define VTOC_ALTSCTR    0x09    /* alternate sector partition */
91 #define VTOC_CACHE      0x0a    /* Solaris cachefs partition */
92 #define VTOC_VXVM_PUB   0x0e    /* VxVM public region */
93 #define VTOC_VXVM_PRIV  0x0f    /* VxVM private region */
94
95 /* VTOC partition flags */
96 #define VTOC_UNMNT      0x01    /* unmountable partition */
97 #define VTOC_RONLY      0x10    /* partition is read/only */
98
99 struct sun_disklabel {
100         char            sl_text[128];
101
102         /* SVR4 VTOC information */
103         u_int32_t       sl_vtoc_vers;           /* == SUN_VTOC_VERSION */
104         char            sl_vtoc_volname[SUN_VOLNAME_LEN];
105         u_int16_t       sl_vtoc_nparts;         /* == SUN_NPART */
106         struct sun_vtoc_info sl_vtoc_map[SUN_NPART]; /* partition tag/flag */
107         u_int32_t       sl_vtoc_sane;           /* == SUN_VTOC_SANE */
108
109         /* Sun label information */
110         u_int16_t       sl_rpm;                 /* rotational speed */
111         u_int16_t       sl_pcylinders;          /* number of physical cyls */
112         u_int16_t       sl_sparespercyl;        /* spare sectors per cylinder */
113         u_int16_t       sl_interleave;          /* interleave factor */
114         u_int16_t       sl_ncylinders;          /* data cylinders */
115         u_int16_t       sl_acylinders;          /* alternate cylinders */
116         u_int16_t       sl_ntracks;             /* tracks per cylinder */
117         u_int16_t       sl_nsectors;            /* sectors per track */
118         struct sun_dkpart sl_part[SUN_NPART];   /* partition layout */
119         u_int16_t       sl_magic;               /* == SUN_DKMAGIC */
120 };
121
122 int sunlabel_dec(void const *pp, struct sun_disklabel *sl);
123 void sunlabel_enc(void *pp, struct sun_disklabel *sl);
124
125 #endif /* _SYS_SUN_DISKLABEL_H_ */