disklabel.h revision 1.1
11.1Sws/* $NetBSD: disklabel.h,v 1.1 1996/09/30 16:34:22 ws Exp $ */ 21.1Sws 31.1Sws/*- 41.1Sws * Copyright (C) 1995, 1996 Wolfgang Solfrank. 51.1Sws * Copyright (C) 1995, 1996 TooLs GmbH. 61.1Sws * All rights reserved. 71.1Sws * 81.1Sws * Redistribution and use in source and binary forms, with or without 91.1Sws * modification, are permitted provided that the following conditions 101.1Sws * are met: 111.1Sws * 1. Redistributions of source code must retain the above copyright 121.1Sws * notice, this list of conditions and the following disclaimer. 131.1Sws * 2. Redistributions in binary form must reproduce the above copyright 141.1Sws * notice, this list of conditions and the following disclaimer in the 151.1Sws * documentation and/or other materials provided with the distribution. 161.1Sws * 3. All advertising materials mentioning features or use of this software 171.1Sws * must display the following acknowledgement: 181.1Sws * This product includes software developed by TooLs GmbH. 191.1Sws * 4. The name of TooLs GmbH may not be used to endorse or promote products 201.1Sws * derived from this software without specific prior written permission. 211.1Sws * 221.1Sws * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR 231.1Sws * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 241.1Sws * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 251.1Sws * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 261.1Sws * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 271.1Sws * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 281.1Sws * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 291.1Sws * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 301.1Sws * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 311.1Sws * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 321.1Sws */ 331.1Sws 341.1Sws#ifndef _MACHINE_DISKLABEL_H_ 351.1Sws#define _MACHINE_DISKLABEL_H_ 361.1Sws 371.1Sws#define LABELSECTOR 1 /* sector containing label */ 381.1Sws#define LABELOFFSET 0 /* offset of label in sector */ 391.1Sws#define MAXPARTITIONS 16 /* number of partitions */ 401.1Sws#define RAW_PART 2 /* raw partition: XX?c */ 411.1Sws 421.1Sws/* MBR partition table */ 431.1Sws#define MBRSECTOR 0 /* MBR sector number */ 441.1Sws#define MBRPARTOFF 446 /* Offset of MBR partition table */ 451.1Sws#define NMBRPART 4 /* # of partitions in MBR */ 461.1Sws#define MBRMAGICOFF 510 /* Offset of magic number */ 471.1Sws#define MBRMAGIC 0xaa55 /* Actual magic number */ 481.1Sws 491.1Swsstruct mbr_partition { 501.1Sws unsigned char mbr_flag; /* default boot flag */ 511.1Sws unsigned char mbr_shd; /* start head, IsN't Always Meaningful */ 521.1Sws unsigned char mbr_ssect; /* start sector, INAM */ 531.1Sws unsigned char mbr_scyl; /* start cylinder, INAM */ 541.1Sws unsigned char mbr_type; /* partition type */ 551.1Sws unsigned char mbr_ehd; /* end head, INAM */ 561.1Sws unsigned char mbr_esect; /* end sector, INAM */ 571.1Sws unsigned char mbr_ecyl; /* end cylinder, INAM */ 581.1Sws unsigned long mbr_start; /* absolute start sector number */ 591.1Sws unsigned long mbr_size; /* partition size in sectors */ 601.1Sws}; 611.1Sws 621.1Sws/* Known partition types: */ 631.1Sws#define MBR_EXTENDED 0x05 /* Extended partition */ 641.1Sws#define MBR_NETBSD_LE 0xa5 /* NetBSD little endian partition */ 651.1Sws#define MBR_NETBSD_BE 0xa6 /* NetBSD big endian partition */ 661.1Sws#define MBR_NETBSD MBR_NETBSD_BE /* on this machine, we default to BE */ 671.1Sws 681.1Sws/* For compatibility reasons (mainly for fdisk): */ 691.1Sws#define dos_partition mbr_partition 701.1Sws#define dp_flag mbr_flag 711.1Sws#define dp_shd mbr_shd 721.1Sws#define dp_ssect mbr_ssect 731.1Sws#define dp_scyl mbr_scyl 741.1Sws#define dp_typ mbr_type 751.1Sws#define dp_ehd mbr_ehd 761.1Sws#define dp_esect mbr_esect 771.1Sws#define dp_ecyl mbr_ecyl 781.1Sws#define dp_start mbr_start 791.1Sws#define dp_size mbr_size 801.1Sws 811.1Sws#define DOSPARTOFF MBRPARTOFF 821.1Sws#define NDOSPART NMBRPART 831.1Sws 841.1Sws#define DOSPTYP_386BSD MBR_NETBSD 851.1Sws 861.1Swsstruct cpu_disklabel { 871.1Sws int cd_start; /* Offset to NetBSD partition in blocks */ 881.1Sws}; 891.1Sws 901.1Sws/* Isolate the relevant bits to get sector and cylinder. */ 911.1Sws#define DPSECT(s) ((s) & 0x3f) 921.1Sws#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) 931.1Sws 941.1Sws#ifdef _KERNEL 951.1Swsstruct disklabel; 961.1Swsint bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, int wlabel)); 971.1Sws#endif /* _KERNEL */ 981.1Sws 991.1Sws#endif /* _MACHINE_DISKLABEL_H_ */ 100