sun_disklabel.h revision 144328
1/*- 2 * Copyright (c) 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * Copyright (c) 2004,2005 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 144328 2005-03-30 09:33:10Z 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#define SUN_VOLNAME_LEN 8 58/* 59 * XXX: I am actually not sure if this should be "16 sectors" or "8192 bytes". 60 * XXX: Considering that Sun went to the effort of getting 512 byte compatible 61 * XXX: CDROM drives produced my guess is that Sun computers stand little or 62 * XXX: even no chance of running, much less booting on !=512 byte media. 63 * XXX: Define this is in terms of bytes since that is easier for us. 64 */ 65#define SUN_BOOTSIZE 8192 66 67/* partition info */ 68struct sun_dkpart { 69 u_int32_t sdkp_cyloffset; /* starting cylinder */ 70 u_int32_t sdkp_nsectors; /* number of sectors */ 71}; 72 73struct sun_vtoc_info { 74 u_int16_t svtoc_tag; /* partition tag */ 75 u_int16_t svtoc_flag; /* partition flags */ 76}; 77 78/* known partition tag values */ 79#define VTOC_UNASSIGNED 0x00 80#define VTOC_BOOT 0x01 81#define VTOC_ROOT 0x02 82#define VTOC_SWAP 0x03 83#define VTOC_USR 0x04 84#define VTOC_BACKUP 0x05 /* "c" partition, covers entire disk */ 85#define VTOC_STAND 0x06 86#define VTOC_VAR 0x07 87#define VTOC_HOME 0x08 88#define VTOC_ALTSCTR 0x09 /* alternate sector partition */ 89#define VTOC_CACHE 0x0a /* Solaris cachefs partition */ 90#define VTOC_VXVM_PUB 0x0e /* VxVM public region */ 91#define VTOC_VXVM_PRIV 0x0f /* VxVM private region */ 92 93/* VTOC partition flags */ 94#define VTOC_UNMNT 0x01 /* unmountable partition */ 95#define VTOC_RONLY 0x10 /* partition is read/only */ 96 97struct sun_disklabel { 98 char sl_text[128]; 99 100 /* SVR4 VTOC information */ 101 u_int32_t sl_vtoc_vers; /* == SUN_VTOC_VERSION */ 102 char sl_vtoc_volname[SUN_VOLNAME_LEN]; 103 u_int16_t sl_vtoc_nparts; /* == SUN_NPART */ 104 struct sun_vtoc_info sl_vtoc_map[SUN_NPART]; /* partition tag/flag */ 105 u_int32_t sl_vtoc_sane; /* == SUN_VTOC_SANE */ 106 107 /* Sun label information */ 108 u_int16_t sl_rpm; /* rotational speed */ 109 u_int16_t sl_pcylinders; /* number of physical cyls */ 110 u_int16_t sl_sparespercyl; /* spare sectors per cylinder */ 111 u_int16_t sl_interleave; /* interleave factor */ 112 u_int16_t sl_ncylinders; /* data cylinders */ 113 u_int16_t sl_acylinders; /* alternate cylinders */ 114 u_int16_t sl_ntracks; /* tracks per cylinder */ 115 u_int16_t sl_nsectors; /* sectors per track */ 116 struct sun_dkpart sl_part[SUN_NPART]; /* partition layout */ 117 u_int16_t sl_magic; /* == SUN_DKMAGIC */ 118}; 119 120int sunlabel_dec(void const *pp, struct sun_disklabel *sl); 121void sunlabel_enc(void *pp, struct sun_disklabel *sl); 122 123#endif /* _SYS_SUN_DISKLABEL_H_ */ 124