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