1 /* $OpenBSD: disklabel.h,v 1.24 2015/09/30 15:13:54 krw Exp $ */ 2 3 /* 4 * Copyright (c) 1994 Christopher G. Demetriou 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 3. All advertising materials mentioning features or use of this software 16 * must display the following acknowledgement: 17 * This product includes software developed by Christopher G. Demetriou. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #ifndef _MACHINE_DISKLABEL_H_ 34 #define _MACHINE_DISKLABEL_H_ 35 36 #define LABELSECTOR 1 /* sector containing label */ 37 #define LABELOFFSET 0 /* offset of label in sector */ 38 #define MAXPARTITIONS 16 /* number of partitions */ 39 40 /* 41 * volume header for "LIF" format volumes 42 */ 43 struct lifvol { 44 short vol_id; 45 char vol_label[6]; 46 u_int vol_addr; 47 short vol_oct; 48 short vol_dummy; 49 u_int vol_dirsize; 50 short vol_version; 51 short vol_zero; 52 u_int vol_number; 53 u_int vol_lastvol; 54 u_int vol_length; 55 char vol_toc[6]; 56 char vol_dummy1[198]; 57 58 u_int ipl_addr; 59 u_int ipl_size; 60 u_int ipl_entry; 61 62 u_int vol_dummy2; 63 }; 64 65 struct lifdir { 66 char dir_name[10]; 67 u_short dir_type; 68 u_int dir_addr; 69 u_int dir_length; 70 char dir_toc[6]; 71 short dir_flag; 72 u_int dir_implement; 73 }; 74 75 struct lif_load { 76 int address; 77 int count; 78 }; 79 80 #define HPUX_MAGIC 0x8b7f6a3c 81 #define HPUX_MAXPART 16 82 struct hpux_label { 83 int32_t hl_magic1; 84 u_int32_t hl_magic; 85 int32_t hl_version; 86 struct { 87 int32_t hlp_blah[2]; 88 int32_t hlp_start; 89 int32_t hlp_length; 90 } hl_parts[HPUX_MAXPART]; 91 u_int8_t hl_flags[HPUX_MAXPART]; 92 #define HPUX_PART_ROOT 0x10 93 #define HPUX_PART_SWAP 0x14 94 #define HPUX_PART_BOOT 0x32 95 int32_t hl_blah[3*16]; 96 u_int16_t hl_boot; 97 u_int16_t hl_reserved; 98 int32_t hl_magic2; 99 }; 100 101 #define LIF_VOL_ID -32768 102 #define LIF_VOL_OCT 4096 103 #define LIF_DIR_SWAP 0x5243 104 #define LIF_DIR_HPLBL 0xa271 105 #define LIF_DIR_FS 0xcd38 106 #define LIF_DIR_IOMAP 0xcd60 107 #define LIF_DIR_HPUX 0xcd80 108 #define LIF_DIR_ISL 0xce00 109 #define LIF_DIR_PAD 0xcffe 110 #define LIF_DIR_AUTO 0xcfff 111 #define LIF_DIR_EST 0xd001 112 #define LIF_DIR_TYPE 0xe942 113 114 #define LIF_DIR_FLAG 0x8001 /* dont ask me! */ 115 #define LIF_SECTSIZE 256 116 117 #define LIF_NUMDIR 16 118 119 #define LIF_VOLSTART 0 120 #define LIF_VOLSIZE sizeof(struct lifvol) 121 #define LIF_DIRSTART 2048 122 #define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) 123 #define LIF_FILESTART 8192 124 125 #define btolifs(b) (((b) + (LIF_SECTSIZE - 1)) / LIF_SECTSIZE) 126 #define lifstob(s) ((s) * LIF_SECTSIZE) 127 #define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE) 128 129 #define MAXLIFSPACE 256 /* 512 byte blocks */ 130 131 #endif /* _MACHINE_DISKLABEL_H_ */ 132