1*a47e2eb7Sbouyer /* $NetBSD: disklabel.h,v 1.16 2011/08/30 12:39:55 bouyer Exp $ */ 249c34d33Scgd 349c34d33Scgd /* 449c34d33Scgd * Copyright (c) 1994 Christopher G. Demetriou 549c34d33Scgd * All rights reserved. 649c34d33Scgd * 749c34d33Scgd * Redistribution and use in source and binary forms, with or without 849c34d33Scgd * modification, are permitted provided that the following conditions 949c34d33Scgd * are met: 1049c34d33Scgd * 1. Redistributions of source code must retain the above copyright 1149c34d33Scgd * notice, this list of conditions and the following disclaimer. 1249c34d33Scgd * 2. Redistributions in binary form must reproduce the above copyright 1349c34d33Scgd * notice, this list of conditions and the following disclaimer in the 1449c34d33Scgd * documentation and/or other materials provided with the distribution. 1549c34d33Scgd * 3. All advertising materials mentioning features or use of this software 1649c34d33Scgd * must display the following acknowledgement: 1749c34d33Scgd * This product includes software developed by Christopher G. Demetriou. 1849c34d33Scgd * 4. The name of the author may not be used to endorse or promote products 1949c34d33Scgd * derived from this software without specific prior written permission 2049c34d33Scgd * 2149c34d33Scgd * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2249c34d33Scgd * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 2349c34d33Scgd * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2449c34d33Scgd * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2549c34d33Scgd * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2649c34d33Scgd * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2749c34d33Scgd * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2849c34d33Scgd * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2949c34d33Scgd * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 3049c34d33Scgd * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3149c34d33Scgd */ 3249c34d33Scgd 33c0a0f446Smrg #ifndef _I386_DISKLABEL_H_ 34c0a0f446Smrg #define _I386_DISKLABEL_H_ 3549c34d33Scgd 36*a47e2eb7Sbouyer #define LABELUSESMBR 1 /* use MBR partitionning */ 3749c34d33Scgd #define LABELSECTOR 1 /* sector containing label */ 3849c34d33Scgd #define LABELOFFSET 0 /* offset of label in sector */ 390ce4a9a0Stron #define MAXPARTITIONS 16 /* number of partitions */ 400ce4a9a0Stron #define OLDMAXPARTITIONS 8 /* number of partitions before 1.6 */ 4149c34d33Scgd #define RAW_PART 3 /* raw partition: XX?d (XXX) */ 4249c34d33Scgd 430ce4a9a0Stron /* 440ce4a9a0Stron * We use the highest bit of the minor number for the partition number. 450ce4a9a0Stron * This maintains backward compatibility with device nodes created before 460ce4a9a0Stron * MAXPARTITIONS was increased. 470ce4a9a0Stron */ 480ce4a9a0Stron #define __I386_MAXDISKS ((1 << 20) / MAXPARTITIONS) 490ce4a9a0Stron #define DISKUNIT(dev) ((minor(dev) / OLDMAXPARTITIONS) % __I386_MAXDISKS) 500ce4a9a0Stron #define DISKPART(dev) ((minor(dev) % OLDMAXPARTITIONS) + \ 510ce4a9a0Stron ((minor(dev) / (__I386_MAXDISKS * OLDMAXPARTITIONS)) * OLDMAXPARTITIONS)) 520ce4a9a0Stron #define DISKMINOR(unit, part) \ 530ce4a9a0Stron (((unit) * OLDMAXPARTITIONS) + ((part) % OLDMAXPARTITIONS) + \ 540ce4a9a0Stron ((part) / OLDMAXPARTITIONS) * (__I386_MAXDISKS * OLDMAXPARTITIONS)) 550ce4a9a0Stron 56f077362cSthorpej /* Pull in MBR partition definitions. */ 57a37289dbSdyoung #if HAVE_NBTOOL_CONFIG_H 58a37289dbSdyoung #include <nbinclude/sys/bootblock.h> 59a37289dbSdyoung #else 601c33b4e6Slukem #include <sys/bootblock.h> 61a37289dbSdyoung #endif /* HAVE_NBTOOL_CONFIG_H */ 6249c34d33Scgd 637d1b6dbcSdrochner #ifndef __ASSEMBLER__ 64a37289dbSdyoung #if HAVE_NBTOOL_CONFIG_H 65a37289dbSdyoung #include <nbinclude/sys/dkbad.h> 66a37289dbSdyoung #else 6749c34d33Scgd #include <sys/dkbad.h> 68a37289dbSdyoung #endif /* HAVE_NBTOOL_CONFIG_H */ 6949c34d33Scgd struct cpu_disklabel { 7009dbb89bSpooka #define __HAVE_DISKLABEL_DKBAD 7149c34d33Scgd struct dkbad bad; 7249c34d33Scgd }; 737d1b6dbcSdrochner #endif 7449c34d33Scgd 75c0a0f446Smrg #endif /* _I386_DISKLABEL_H_ */ 76