diskmbr.h revision 42264
159612Sjasone/* 259612Sjasone * Copyright (c) 1987, 1988, 1993 359612Sjasone * The Regents of the University of California. All rights reserved. 459612Sjasone * 559612Sjasone * Redistribution and use in source and binary forms, with or without 659612Sjasone * modification, are permitted provided that the following conditions 759612Sjasone * are met: 859612Sjasone * 1. Redistributions of source code must retain the above copyright 959612Sjasone * notice, this list of conditions and the following disclaimer. 1059612Sjasone * 2. Redistributions in binary form must reproduce the above copyright 1159612Sjasone * notice, this list of conditions and the following disclaimer in the 1259612Sjasone * documentation and/or other materials provided with the distribution. 1359612Sjasone * 3. All advertising materials mentioning features or use of this software 1459612Sjasone * must display the following acknowledgement: 1559612Sjasone * This product includes software developed by the University of 1659612Sjasone * California, Berkeley and its contributors. 1759612Sjasone * 4. Neither the name of the University nor the names of its contributors 1859612Sjasone * may be used to endorse or promote products derived from this software 1959612Sjasone * without specific prior written permission. 2059612Sjasone * 2159612Sjasone * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2259612Sjasone * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2359612Sjasone * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2459612Sjasone * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2559612Sjasone * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2659612Sjasone * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2759612Sjasone * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2859612Sjasone * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2959612Sjasone * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3059612Sjasone * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3159612Sjasone * SUCH DAMAGE. 3259612Sjasone * 3359612Sjasone * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 3459612Sjasone * $Id: disklabel.h,v 1.35 1998/08/24 08:45:37 dfr Exp $ 3559612Sjasone */ 3659612Sjasone 3759612Sjasone#ifndef _SYS_DISKLABEL_H_ 3859612Sjasone#define _SYS_DISKLABEL_H_ 3959612Sjasone 4059612Sjasone#ifndef KERNEL 4159612Sjasone#include <sys/types.h> 4259612Sjasone#endif 4359612Sjasone#include <sys/ioccom.h> 4459612Sjasone 4559612Sjasone/* 4659612Sjasone * Disk description table, see disktab(5) 4759612Sjasone */ 4859612Sjasone#define _PATH_DISKTAB "/etc/disktab" 4959612Sjasone#define DISKTAB "/etc/disktab" /* deprecated */ 5059612Sjasone 5159612Sjasone/* 5259612Sjasone * Each disk has a label which includes information about the hardware 5359612Sjasone * disk geometry, filesystem partitions, and drive specific information. 5459612Sjasone * The label is in block 0 or 1, possibly offset from the beginning 5559612Sjasone * to leave room for a bootstrap, etc. 5659612Sjasone */ 5759612Sjasone 5859612Sjasone/* XXX these should be defined per controller (or drive) elsewhere, not here! */ 5959612Sjasone#ifdef __i386__ 6059612Sjasone#define LABELSECTOR 1 /* sector containing label */ 6159612Sjasone#define LABELOFFSET 0 /* offset of label in sector */ 6281975Skris#endif 6381975Skris 6481975Skris#ifdef __alpha__ 6559612Sjasone#define LABELSECTOR 0 6659612Sjasone#define LABELOFFSET 64 6759612Sjasone#endif 6859612Sjasone 6959612Sjasone#ifndef LABELSECTOR 7059612Sjasone#define LABELSECTOR 0 /* sector containing label */ 7159612Sjasone#endif 7259612Sjasone 7359612Sjasone#ifndef LABELOFFSET 7459612Sjasone#define LABELOFFSET 64 /* offset of label in sector */ 7559612Sjasone#endif 7659612Sjasone 7759612Sjasone#define DISKMAGIC ((u_int32_t)0x82564557) /* The disk magic number */ 7859612Sjasone#ifndef MAXPARTITIONS 7959612Sjasone#define MAXPARTITIONS 8 8059612Sjasone#endif 8159612Sjasone 8259612Sjasone#define LABEL_PART 2 /* partition containing label */ 8359612Sjasone#define RAW_PART 2 /* partition containing whole disk */ 8459612Sjasone#define SWAP_PART 1 /* partition normally containing swap */ 8559612Sjasone 8659612Sjasone#ifndef LOCORE 8759612Sjasonestruct disklabel { 8859612Sjasone u_int32_t d_magic; /* the magic number */ 8959612Sjasone u_int16_t d_type; /* drive type */ 9059612Sjasone u_int16_t d_subtype; /* controller/d_type specific */ 9159612Sjasone char d_typename[16]; /* type name, e.g. "eagle" */ 9259612Sjasone 9359612Sjasone /* 9459612Sjasone * d_packname contains the pack identifier and is returned when 9559612Sjasone * the disklabel is read off the disk or in-core copy. 9659612Sjasone * d_boot0 and d_boot1 are the (optional) names of the 9759612Sjasone * primary (block 0) and secondary (block 1-15) bootstraps 9859612Sjasone * as found in /boot. These are returned when using 9959612Sjasone * getdiskbyname(3) to retrieve the values from /etc/disktab. 10059612Sjasone */ 10159612Sjasone union { 10259612Sjasone char un_d_packname[16]; /* pack identifier */ 10359612Sjasone struct { 10459612Sjasone char *un_d_boot0; /* primary bootstrap name */ 10559612Sjasone char *un_d_boot1; /* secondary bootstrap name */ 10659612Sjasone } un_b; 10759612Sjasone } d_un; 10859612Sjasone#define d_packname d_un.un_d_packname 10959612Sjasone#define d_boot0 d_un.un_b.un_d_boot0 11059612Sjasone#define d_boot1 d_un.un_b.un_d_boot1 11159612Sjasone 11259612Sjasone /* disk geometry: */ 11359612Sjasone u_int32_t d_secsize; /* # of bytes per sector */ 11459612Sjasone u_int32_t d_nsectors; /* # of data sectors per track */ 11559612Sjasone u_int32_t d_ntracks; /* # of tracks per cylinder */ 11659612Sjasone u_int32_t d_ncylinders; /* # of data cylinders per unit */ 11759612Sjasone u_int32_t d_secpercyl; /* # of data sectors per cylinder */ 11859612Sjasone u_int32_t d_secperunit; /* # of data sectors per unit */ 11959612Sjasone 12059612Sjasone /* 12159612Sjasone * Spares (bad sector replacements) below are not counted in 12259612Sjasone * d_nsectors or d_secpercyl. Spare sectors are assumed to 12359612Sjasone * be physical sectors which occupy space at the end of each 12459612Sjasone * track and/or cylinder. 12559612Sjasone */ 12659612Sjasone u_int16_t d_sparespertrack; /* # of spare sectors per track */ 12759612Sjasone u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ 12859612Sjasone /* 12959612Sjasone * Alternate cylinders include maintenance, replacement, configuration 13059612Sjasone * description areas, etc. 13159612Sjasone */ 13259612Sjasone u_int32_t d_acylinders; /* # of alt. cylinders per unit */ 13359612Sjasone 13459612Sjasone /* hardware characteristics: */ 13559612Sjasone /* 13659612Sjasone * d_interleave, d_trackskew and d_cylskew describe perturbations 13759612Sjasone * in the media format used to compensate for a slow controller. 13859612Sjasone * Interleave is physical sector interleave, set up by the 13959612Sjasone * formatter or controller when formatting. When interleaving is 14059612Sjasone * in use, logically adjacent sectors are not physically 14159612Sjasone * contiguous, but instead are separated by some number of 14259612Sjasone * sectors. It is specified as the ratio of physical sectors 14359612Sjasone * traversed per logical sector. Thus an interleave of 1:1 14459612Sjasone * implies contiguous layout, while 2:1 implies that logical 14559612Sjasone * sector 0 is separated by one sector from logical sector 1. 14659612Sjasone * d_trackskew is the offset of sector 0 on track N relative to 14759612Sjasone * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew 14859612Sjasone * is the offset of sector 0 on cylinder N relative to sector 0 14959612Sjasone * on cylinder N-1. 15059612Sjasone */ 15159612Sjasone u_int16_t d_rpm; /* rotational speed */ 15259612Sjasone u_int16_t d_interleave; /* hardware sector interleave */ 15359612Sjasone u_int16_t d_trackskew; /* sector 0 skew, per track */ 15459612Sjasone u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ 15559612Sjasone u_int32_t d_headswitch; /* head switch time, usec */ 15659612Sjasone u_int32_t d_trkseek; /* track-to-track seek, usec */ 15759612Sjasone u_int32_t d_flags; /* generic flags */ 15859612Sjasone#define NDDATA 5 15959612Sjasone u_int32_t d_drivedata[NDDATA]; /* drive-type specific information */ 16059612Sjasone#define NSPARE 5 16159612Sjasone u_int32_t d_spare[NSPARE]; /* reserved for future use */ 16259612Sjasone u_int32_t d_magic2; /* the magic number (again) */ 16359612Sjasone u_int16_t d_checksum; /* xor of data incl. partitions */ 16459612Sjasone 16559612Sjasone /* filesystem and partition information: */ 16659612Sjasone u_int16_t d_npartitions; /* number of partitions in following */ 16759612Sjasone u_int32_t d_bbsize; /* size of boot area at sn0, bytes */ 16859612Sjasone u_int32_t d_sbsize; /* max size of fs superblock, bytes */ 16959612Sjasone struct partition { /* the partition table */ 17059612Sjasone u_int32_t p_size; /* number of sectors in partition */ 17159612Sjasone u_int32_t p_offset; /* starting sector */ 17259612Sjasone u_int32_t p_fsize; /* filesystem basic fragment size */ 17359612Sjasone u_int8_t p_fstype; /* filesystem type, see below */ 17459612Sjasone u_int8_t p_frag; /* filesystem fragments per block */ 17559612Sjasone union { 17659612Sjasone u_int16_t cpg; /* UFS: FS cylinders per group */ 17759612Sjasone u_int16_t sgs; /* LFS: FS segment shift */ 17859612Sjasone } __partition_u1; 17959612Sjasone#define p_cpg __partition_u1.cpg 18059612Sjasone#define p_sgs __partition_u1.sgs 18159612Sjasone } d_partitions[MAXPARTITIONS]; /* actually may be more */ 18259612Sjasone}; 18359612Sjasone#else /* LOCORE */ 18459612Sjasone /* 18559612Sjasone * offsets for asm boot files. 18659612Sjasone */ 18759612Sjasone .set d_secsize,40 18859612Sjasone .set d_nsectors,44 18959612Sjasone .set d_ntracks,48 19059612Sjasone .set d_ncylinders,52 19159612Sjasone .set d_secpercyl,56 19259612Sjasone .set d_secperunit,60 19359612Sjasone .set d_end_,276 /* size of disk label */ 19459612Sjasone#endif /* LOCORE */ 19559612Sjasone 19659612Sjasone/* d_type values: */ 19759612Sjasone#define DTYPE_SMD 1 /* SMD, XSMD; VAX hp/up */ 19859612Sjasone#define DTYPE_MSCP 2 /* MSCP */ 19959612Sjasone#define DTYPE_DEC 3 /* other DEC (rk, rl) */ 20059612Sjasone#define DTYPE_SCSI 4 /* SCSI */ 20159612Sjasone#define DTYPE_ESDI 5 /* ESDI interface */ 20259612Sjasone#define DTYPE_ST506 6 /* ST506 etc. */ 20359612Sjasone#define DTYPE_HPIB 7 /* CS/80 on HP-IB */ 20459612Sjasone#define DTYPE_HPFL 8 /* HP Fiber-link */ 20559612Sjasone#define DTYPE_FLOPPY 10 /* floppy */ 20659612Sjasone#define DTYPE_CCD 11 /* concatenated disk */ 20759612Sjasone#define DTYPE_VINUM 12 /* vinum volume */ 20859612Sjasone 20959612Sjasone#ifdef PC98 21059612Sjasone#define DSTYPE_SEC256 0x80 /* physical sector size=256*/ 21159612Sjasone#endif 21259612Sjasone 21359612Sjasone#ifdef DKTYPENAMES 21459612Sjasonestatic char *dktypenames[] = { 21559612Sjasone "unknown", 21659612Sjasone "SMD", 21759612Sjasone "MSCP", 21859612Sjasone "old DEC", 21959612Sjasone "SCSI", 22059612Sjasone "ESDI", 22159612Sjasone "ST506", 22259612Sjasone "HP-IB", 22359612Sjasone "HP-FL", 22459612Sjasone "type 9", 22559612Sjasone "floppy", 22659612Sjasone "CCD", 22759612Sjasone "Vinum", 22859612Sjasone NULL 22959612Sjasone}; 23059612Sjasone#define DKMAXTYPES (sizeof(dktypenames) / sizeof(dktypenames[0]) - 1) 23159612Sjasone#endif 23259612Sjasone 23359612Sjasone/* 23459612Sjasone * Filesystem type and version. 23559612Sjasone * Used to interpret other filesystem-specific 23659612Sjasone * per-partition information. 23759612Sjasone */ 23859612Sjasone#define FS_UNUSED 0 /* unused */ 23959612Sjasone#define FS_SWAP 1 /* swap */ 24059612Sjasone#define FS_V6 2 /* Sixth Edition */ 24159612Sjasone#define FS_V7 3 /* Seventh Edition */ 24259612Sjasone#define FS_SYSV 4 /* System V */ 24359612Sjasone#define FS_V71K 5 /* V7 with 1K blocks (4.1, 2.9) */ 24459612Sjasone#define FS_V8 6 /* Eighth Edition, 4K blocks */ 24559612Sjasone#define FS_BSDFFS 7 /* 4.2BSD fast file system */ 24659612Sjasone#define FS_MSDOS 8 /* MSDOS file system */ 24759612Sjasone#define FS_BSDLFS 9 /* 4.4BSD log-structured file system */ 24859612Sjasone#define FS_OTHER 10 /* in use, but unknown/unsupported */ 24959612Sjasone#define FS_HPFS 11 /* OS/2 high-performance file system */ 25059612Sjasone#define FS_ISO9660 12 /* ISO 9660, normally CD-ROM */ 25159612Sjasone#define FS_BOOT 13 /* partition contains bootstrap */ 25259612Sjasone 25359612Sjasone#ifdef DKTYPENAMES 25459612Sjasonestatic char *fstypenames[] = { 25559612Sjasone "unused", 25659612Sjasone "swap", 25759612Sjasone "Version 6", 25859612Sjasone "Version 7", 25959612Sjasone "System V", 26059612Sjasone "4.1BSD", 26159612Sjasone "Eighth Edition", 26259612Sjasone "4.2BSD", 26359612Sjasone "MSDOS", 26459612Sjasone "4.4LFS", 26559612Sjasone "unknown", 26659612Sjasone "HPFS", 26759612Sjasone "ISO9660", 26859612Sjasone "boot", 26959612Sjasone NULL 27059612Sjasone}; 27159612Sjasone#define FSMAXTYPES (sizeof(fstypenames) / sizeof(fstypenames[0]) - 1) 27259612Sjasone#endif 27359612Sjasone 27459612Sjasone/* 27559612Sjasone * flags shared by various drives: 27659612Sjasone */ 27759612Sjasone#define D_REMOVABLE 0x01 /* removable media */ 27859612Sjasone#define D_ECC 0x02 /* supports ECC */ 27959612Sjasone#define D_BADSECT 0x04 /* supports bad sector forw. */ 28059612Sjasone#define D_RAMDISK 0x08 /* disk emulator */ 28159612Sjasone#define D_CHAIN 0x10 /* can do back-back transfers */ 28259612Sjasone 28359612Sjasone/* 28459612Sjasone * Drive data for SMD. 28559612Sjasone */ 28659612Sjasone#define d_smdflags d_drivedata[0] 28759612Sjasone#define D_SSE 0x1 /* supports skip sectoring */ 28859612Sjasone#define d_mindist d_drivedata[1] 28959612Sjasone#define d_maxdist d_drivedata[2] 29059612Sjasone#define d_sdist d_drivedata[3] 29159612Sjasone 29259612Sjasone/* 29359612Sjasone * Drive data for ST506. 29459612Sjasone */ 29559612Sjasone#define d_precompcyl d_drivedata[0] 29659612Sjasone#define d_gap3 d_drivedata[1] /* used only when formatting */ 29759612Sjasone 29859612Sjasone/* 29959612Sjasone * Drive data for SCSI. 30059612Sjasone */ 30159612Sjasone#define d_blind d_drivedata[0] 30259612Sjasone 30359612Sjasone#ifndef LOCORE 30459612Sjasone/* 30559612Sjasone * Structure used to perform a format or other raw operation, returning 30659612Sjasone * data and/or register values. Register identification and format 30759612Sjasone * are device- and driver-dependent. 30859612Sjasone */ 30959612Sjasonestruct format_op { 31059612Sjasone char *df_buf; 31159612Sjasone int df_count; /* value-result */ 31259612Sjasone daddr_t df_startblk; 31359612Sjasone int df_reg[8]; /* result */ 31459612Sjasone}; 31559612Sjasone 31659612Sjasone/* 31759612Sjasone * Structure used internally to retrieve information about a partition 31859612Sjasone * on a disk. 31959612Sjasone */ 32059612Sjasonestruct partinfo { 32159612Sjasone struct disklabel *disklab; 32259612Sjasone struct partition *part; 32359612Sjasone}; 32459612Sjasone 32559612Sjasone/* DOS partition table -- located in boot block */ 32659612Sjasone 32759612Sjasone#ifdef PC98 32859612Sjasone#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ 32959612Sjasone#define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ 33059612Sjasone#define DOSPARTOFF 0 33159612Sjasone#define NDOSPART 16 33259612Sjasone#define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ 33359612Sjasone#define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ 33459612Sjasone 33559612Sjasonestruct dos_partition { 33659612Sjasone unsigned char dp_mid; 33759612Sjasone#define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ 33859612Sjasone unsigned char dp_sid; 33959612Sjasone#define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ 34059612Sjasone unsigned char dp_dum1; 34159612Sjasone unsigned char dp_dum2; 34259612Sjasone unsigned char dp_ipl_sct; 34359612Sjasone unsigned char dp_ipl_head; 34459612Sjasone unsigned short dp_ipl_cyl; 34559612Sjasone unsigned char dp_ssect; /* starting sector */ 34659612Sjasone unsigned char dp_shd; /* starting head */ 34759612Sjasone unsigned short dp_scyl; /* starting cylinder */ 34859612Sjasone unsigned char dp_esect; /* end sector */ 34959612Sjasone unsigned char dp_ehd; /* end head */ 35059612Sjasone unsigned short dp_ecyl; /* end cylinder */ 35159612Sjasone unsigned char dp_name[16]; 35259612Sjasone}; 35359612Sjasone 35459612Sjasone#else /* IBMPC */ 35559612Sjasone#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ 35659612Sjasone#define DOSPARTOFF 446 35759612Sjasone#define NDOSPART 4 35859612Sjasone#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ 35959612Sjasone 36059612Sjasonestruct dos_partition { 36159612Sjasone unsigned char dp_flag; /* bootstrap flags */ 36259612Sjasone unsigned char dp_shd; /* starting head */ 36359612Sjasone unsigned char dp_ssect; /* starting sector */ 36459612Sjasone unsigned char dp_scyl; /* starting cylinder */ 36559612Sjasone unsigned char dp_typ; /* partition type */ 36659612Sjasone unsigned char dp_ehd; /* end head */ 36759612Sjasone unsigned char dp_esect; /* end sector */ 36859612Sjasone unsigned char dp_ecyl; /* end cylinder */ 36959612Sjasone u_int32_t dp_start; /* absolute starting sector number */ 37059612Sjasone u_int32_t dp_size; /* partition size in sectors */ 37159612Sjasone}; 37259612Sjasone#endif 37359612Sjasone 37459612Sjasone#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ 37559612Sjasone#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ 37659612Sjasone 37759612Sjasone/* 37859612Sjasone * Disk-specific ioctls. 37959612Sjasone */ 38059612Sjasone /* get and set disklabel; DIOCGPART used internally */ 38159612Sjasone#define DIOCGDINFO _IOR('d', 101, struct disklabel)/* get */ 38259612Sjasone#define DIOCSDINFO _IOW('d', 102, struct disklabel)/* set */ 38359612Sjasone#define DIOCWDINFO _IOW('d', 103, struct disklabel)/* set, update disk */ 38459612Sjasone#define DIOCGPART _IOW('d', 104, struct partinfo) /* get partition */ 38559612Sjasone 38659612Sjasone/* do format operation, read or write */ 38759612Sjasone#define DIOCRFORMAT _IOWR('d', 105, struct format_op) 38859612Sjasone#define DIOCWFORMAT _IOWR('d', 106, struct format_op) 38959612Sjasone 39059612Sjasone#define DIOCSSTEP _IOW('d', 107, int) /* set step rate */ 39159612Sjasone#define DIOCSRETRIES _IOW('d', 108, int) /* set # of retries */ 39259612Sjasone#define DIOCWLABEL _IOW('d', 109, int) /* write en/disable label */ 39359612Sjasone 39459612Sjasone#define DIOCSBAD _IOW('d', 110, struct dkbad) /* set kernel dkbad */ 39559612Sjasone#define DIOCSBADSCAN _IOW('d', 111, int) /* set badscan mode */ 39659612Sjasone 39759612Sjasone/* 39859612Sjasone * XXX encoding of disk minor numbers, should be elsewhere. 39959612Sjasone * 40059612Sjasone * See <sys/reboot.h> for a possibly better encoding. 40159612Sjasone * 40259612Sjasone * "cpio -H newc" can be used to back up device files with large minor 40359612Sjasone * numbers (but not ones >= 2^31). Old cpio formats and all tar formats 40459612Sjasone * don't have enough bits, and cpio and tar don't notice the lossage. 40559612Sjasone * There are also some sign extension bugs. 40659612Sjasone */ 40759612Sjasone 40859612Sjasone/* 40959612Sjasone 3 2 1 0 41059612Sjasone 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 41159612Sjasone _________________________________________________________________ 41259612Sjasone | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 41359612Sjasone ----------------------------------------------------------------- 41459612Sjasone | TYPE |UNIT_2 | SLICE | MAJOR? | UNIT |PART | 41559612Sjasone ----------------------------------------------------------------- 41659612Sjasone*/ 41759612Sjasone#define dkmakeminor(unit, slice, part) \ 41859612Sjasone (((slice) << 16) | (((unit) & 0x1e0) << 16) | \ 41959612Sjasone (((unit) & 0x1f) << 3) | (part)) 42059612Sjasone#define dkmodpart(dev, part) (((dev) & ~(dev_t)7) | (part)) 42159612Sjasone#define dkmodslice(dev, slice) (((dev) & ~(dev_t)0x1f0000) | ((slice) << 16)) 42259612Sjasone#define dkpart(dev) (minor(dev) & 7) 42359612Sjasone#define dkslice(dev) ((minor(dev) >> 16) & 0x1f) 42459612Sjasone#define dktype(dev) ((minor(dev) >> 25) & 0x7f) 42559612Sjasone#define dkunit(dev) ((((dev) >> 16) & 0x1e0) | (((dev) >> 3) & 0x1f)) 42659612Sjasone 42759612Sjasone#ifdef KERNEL 42859612Sjasone 42959612Sjasonestruct buf; 43059612Sjasonestruct buf_queue_head; 43159612Sjasone 43259612Sjasoneint bounds_check_with_label __P((struct buf *bp, struct disklabel *lp, 43359612Sjasone int wlabel)); 43459612Sjasonevoid diskerr __P((struct buf *bp, char *dname, char *what, int pri, 43559612Sjasone int blkdone, struct disklabel *lp)); 43659612Sjasonevoid disksort __P((struct buf *ap, struct buf *bp)); 43759612Sjasoneu_int dkcksum __P((struct disklabel *lp)); 43859612Sjasonechar *readdisklabel __P((dev_t dev, void (*strat)(struct buf *bp), 43959612Sjasone struct disklabel *lp)); 44059612Sjasonevoid bufqdisksort __P((struct buf_queue_head *ap, struct buf *bp)); 44159612Sjasoneint setdisklabel __P((struct disklabel *olp, struct disklabel *nlp, 44259612Sjasone u_long openmask)); 44359612Sjasoneint writedisklabel __P((dev_t dev, void (*strat)(struct buf *bp), 44459612Sjasone struct disklabel *lp)); 44559612Sjasone 44659612Sjasone#endif /* KERNEL */ 44759612Sjasone 44859612Sjasone#endif /* LOCORE */ 44959612Sjasone 45059612Sjasone#ifndef KERNEL 45159612Sjasone__BEGIN_DECLS 45259612Sjasonestruct disklabel *getdiskbyname __P((const char *)); 45359612Sjasone__END_DECLS 45459612Sjasone#endif 45559612Sjasone 45659612Sjasone#endif /* !_SYS_DISKLABEL_H_ */ 45759612Sjasone