sun_disklabel.h revision 129963
196267Sobrien/* 296267Sobrien * Copyright (c) 1992, 1993 396267Sobrien * The Regents of the University of California. All rights reserved. 4129963Sjoerg * Copyright (c) 2004, Joerg Wunsch 596267Sobrien * 696267Sobrien * This software was developed by the Computer Systems Engineering group 796267Sobrien * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 896267Sobrien * contributed to Berkeley. 996267Sobrien * 1096267Sobrien * Redistribution and use in source and binary forms, with or without 1196267Sobrien * modification, are permitted provided that the following conditions 1296267Sobrien * are met: 1396267Sobrien * 1. Redistributions of source code must retain the above copyright 1496267Sobrien * notice, this list of conditions and the following disclaimer. 1596267Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1696267Sobrien * notice, this list of conditions and the following disclaimer in the 1796267Sobrien * documentation and/or other materials provided with the distribution. 1896267Sobrien * 4. Neither the name of the University nor the names of its contributors 1996267Sobrien * may be used to endorse or promote products derived from this software 2096267Sobrien * without specific prior written permission. 2196267Sobrien * 2296267Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2396267Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2496267Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2596267Sobrien * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2696267Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2796267Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2896267Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2996267Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 3096267Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3196267Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3296267Sobrien * SUCH DAMAGE. 3396267Sobrien * 3496267Sobrien * @(#)sun_disklabel.h 8.1 (Berkeley) 6/11/93 3596267Sobrien * $NetBSD: disklabel.h,v 1.2 1998/08/22 14:55:28 mrg Exp $ 3696267Sobrien * 3796267Sobrien * $FreeBSD: head/sys/sys/sun_disklabel.h 129963 2004-06-01 20:18:25Z joerg $ 3896267Sobrien */ 3996267Sobrien 40113825Sphk#ifndef _SYS_SUN_DISKLABEL_H_ 41113825Sphk#define _SYS_SUN_DISKLABEL_H_ 42113825Sphk 4396267Sobrien/* 44113825Sphk * SunOS/Solaris disk label layout (partial). 45113825Sphk * 46113825Sphk * Suns disk label format contains a lot of historical baggage which we 47113825Sphk * ignore entirely. The structure below contains the relevant bits and the 48113825Sphk * _enc/_dec functions encode/decode only these fields. 4996267Sobrien */ 5096267Sobrien 5196267Sobrien#define SUN_DKMAGIC 55998 52113817Sphk#define SUN_NPART 8 53113817Sphk#define SUN_RAWPART 2 54113817Sphk#define SUN_SIZE 512 55129963Sjoerg#define SUN_VTOC_VERSION 1 56129963Sjoerg#define SUN_VTOC_SANE 0x600DDEEE /* SVR4-compatible VTOC is "sane". */ 57113894Sphk/* 58113894Sphk * XXX: I am actually not sure if this should be "16 sectors" or "8192 bytes". 59113894Sphk * XXX: Considering that Sun went to the effort of getting 512 byte compatible 60113894Sphk * XXX: CDROM drives produced my guess is that Sun computers stand little or 61113894Sphk * XXX: even no chance of running, much less booting on !=512 byte media. 62113894Sphk * XXX: Define this is in terms of bytes since that is easier for us. 63113894Sphk */ 64113894Sphk#define SUN_BOOTSIZE 8192 6596267Sobrien 6696267Sobrien/* partition info */ 6796267Sobrienstruct sun_dkpart { 6896267Sobrien u_int32_t sdkp_cyloffset; /* starting cylinder */ 6996267Sobrien u_int32_t sdkp_nsectors; /* number of sectors */ 7096267Sobrien}; 7196267Sobrien 72129963Sjoergstruct sun_vtoc_info { 73129963Sjoerg u_int16_t svtoc_tag; /* partition tag */ 74129963Sjoerg u_int16_t svtoc_flag; /* partition flags */ 75129963Sjoerg}; 76129963Sjoerg 77129963Sjoerg/* known partition tag values */ 78129963Sjoerg#define VTOC_UNASSIGNED 0x00 79129963Sjoerg#define VTOC_BOOT 0x01 80129963Sjoerg#define VTOC_ROOT 0x02 81129963Sjoerg#define VTOC_SWAP 0x03 82129963Sjoerg#define VTOC_USR 0x04 83129963Sjoerg#define VTOC_BACKUP 0x05 /* "c" partition, covers entire disk */ 84129963Sjoerg#define VTOC_STAND 0x06 85129963Sjoerg#define VTOC_VAR 0x07 86129963Sjoerg#define VTOC_HOME 0x08 87129963Sjoerg#define VTOC_ALTSCTR 0x09 /* alternate sector partition */ 88129963Sjoerg#define VTOC_CACHE 0x0a /* Solaris cachefs partition */ 89129963Sjoerg#define VTOC_VXVM_PUB 0x0e /* VxVM public region */ 90129963Sjoerg#define VTOC_VXVM_PRIV 0x0f /* VxVM private region */ 91129963Sjoerg 92129963Sjoerg/* VTOC partition flags */ 93129963Sjoerg#define VTOC_UNMNT 0x01 /* unmountable partition */ 94129963Sjoerg#define VTOC_RONLY 0x10 /* partition is read/only */ 95129963Sjoerg 96113825Sphkstruct sun_disklabel { 9796267Sobrien char sl_text[128]; 98129963Sjoerg 99129963Sjoerg /* SVR4 VTOC information */ 100129963Sjoerg u_int32_t sl_vtoc_vers; /* == SUN_VTOC_VERSION */ 101129963Sjoerg u_int16_t sl_vtoc_nparts; /* == SUN_NPART */ 102129963Sjoerg struct sun_vtoc_info sl_vtoc_map[SUN_NPART]; /* partition tag/flag */ 103129963Sjoerg u_int32_t sl_vtoc_sane; /* == SUN_VTOC_SANE */ 104129963Sjoerg 105129963Sjoerg /* Sun label information */ 106113825Sphk u_int16_t sl_rpm; /* rotational speed */ 10796267Sobrien u_int16_t sl_pcylinders; /* number of physical cyls */ 10896267Sobrien u_int16_t sl_sparespercyl; /* spare sectors per cylinder */ 10996267Sobrien u_int16_t sl_interleave; /* interleave factor */ 11096267Sobrien u_int16_t sl_ncylinders; /* data cylinders */ 11196267Sobrien u_int16_t sl_acylinders; /* alternate cylinders */ 11296267Sobrien u_int16_t sl_ntracks; /* tracks per cylinder */ 11396267Sobrien u_int16_t sl_nsectors; /* sectors per track */ 114113817Sphk struct sun_dkpart sl_part[SUN_NPART]; /* partition layout */ 11596267Sobrien u_int16_t sl_magic; /* == SUN_DKMAGIC */ 11696267Sobrien}; 117106105Sphk 118113816Sphkint sunlabel_dec(void const *pp, struct sun_disklabel *sl); 119113816Sphkvoid sunlabel_enc(void *pp, struct sun_disklabel *sl); 120113825Sphk 121113825Sphk#endif /* _SYS_SUN_DISKLABEL_H_ */ 122