1139825Simp/*- 296267Sobrien * Copyright (c) 1992, 1993 396267Sobrien * The Regents of the University of California. All rights reserved. 4144328Sjoerg * Copyright (c) 2004,2005 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$ 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". */ 57144328Sjoerg#define SUN_VOLNAME_LEN 8 58113894Sphk/* 59113894Sphk * XXX: I am actually not sure if this should be "16 sectors" or "8192 bytes". 60113894Sphk * XXX: Considering that Sun went to the effort of getting 512 byte compatible 61113894Sphk * XXX: CDROM drives produced my guess is that Sun computers stand little or 62113894Sphk * XXX: even no chance of running, much less booting on !=512 byte media. 63113894Sphk * XXX: Define this is in terms of bytes since that is easier for us. 64113894Sphk */ 65113894Sphk#define SUN_BOOTSIZE 8192 6696267Sobrien 6796267Sobrien/* partition info */ 6896267Sobrienstruct sun_dkpart { 6996267Sobrien u_int32_t sdkp_cyloffset; /* starting cylinder */ 7096267Sobrien u_int32_t sdkp_nsectors; /* number of sectors */ 7196267Sobrien}; 7296267Sobrien 73129963Sjoergstruct sun_vtoc_info { 74129963Sjoerg u_int16_t svtoc_tag; /* partition tag */ 75129963Sjoerg u_int16_t svtoc_flag; /* partition flags */ 76129963Sjoerg}; 77129963Sjoerg 78129963Sjoerg/* known partition tag values */ 79129963Sjoerg#define VTOC_UNASSIGNED 0x00 80129963Sjoerg#define VTOC_BOOT 0x01 81129963Sjoerg#define VTOC_ROOT 0x02 82129963Sjoerg#define VTOC_SWAP 0x03 83129963Sjoerg#define VTOC_USR 0x04 84129963Sjoerg#define VTOC_BACKUP 0x05 /* "c" partition, covers entire disk */ 85129963Sjoerg#define VTOC_STAND 0x06 86129963Sjoerg#define VTOC_VAR 0x07 87129963Sjoerg#define VTOC_HOME 0x08 88129963Sjoerg#define VTOC_ALTSCTR 0x09 /* alternate sector partition */ 89129963Sjoerg#define VTOC_CACHE 0x0a /* Solaris cachefs partition */ 90129963Sjoerg#define VTOC_VXVM_PUB 0x0e /* VxVM public region */ 91129963Sjoerg#define VTOC_VXVM_PRIV 0x0f /* VxVM private region */ 92129963Sjoerg 93129963Sjoerg/* VTOC partition flags */ 94129963Sjoerg#define VTOC_UNMNT 0x01 /* unmountable partition */ 95129963Sjoerg#define VTOC_RONLY 0x10 /* partition is read/only */ 96129963Sjoerg 97113825Sphkstruct sun_disklabel { 9896267Sobrien char sl_text[128]; 99129963Sjoerg 100129963Sjoerg /* SVR4 VTOC information */ 101129963Sjoerg u_int32_t sl_vtoc_vers; /* == SUN_VTOC_VERSION */ 102144328Sjoerg char sl_vtoc_volname[SUN_VOLNAME_LEN]; 103129963Sjoerg u_int16_t sl_vtoc_nparts; /* == SUN_NPART */ 104129963Sjoerg struct sun_vtoc_info sl_vtoc_map[SUN_NPART]; /* partition tag/flag */ 105129963Sjoerg u_int32_t sl_vtoc_sane; /* == SUN_VTOC_SANE */ 106129963Sjoerg 107129963Sjoerg /* Sun label information */ 108113825Sphk u_int16_t sl_rpm; /* rotational speed */ 10996267Sobrien u_int16_t sl_pcylinders; /* number of physical cyls */ 11096267Sobrien u_int16_t sl_sparespercyl; /* spare sectors per cylinder */ 11196267Sobrien u_int16_t sl_interleave; /* interleave factor */ 11296267Sobrien u_int16_t sl_ncylinders; /* data cylinders */ 11396267Sobrien u_int16_t sl_acylinders; /* alternate cylinders */ 11496267Sobrien u_int16_t sl_ntracks; /* tracks per cylinder */ 11596267Sobrien u_int16_t sl_nsectors; /* sectors per track */ 116113817Sphk struct sun_dkpart sl_part[SUN_NPART]; /* partition layout */ 11796267Sobrien u_int16_t sl_magic; /* == SUN_DKMAGIC */ 11896267Sobrien}; 119106105Sphk 120113816Sphkint sunlabel_dec(void const *pp, struct sun_disklabel *sl); 121113816Sphkvoid sunlabel_enc(void *pp, struct sun_disklabel *sl); 122113825Sphk 123113825Sphk#endif /* _SYS_SUN_DISKLABEL_H_ */ 124