Subject: Disklabels arrive for 2.11BSD (#265 part 16 of 18)
Index:	sys,bin,usr.lib,(many more)/<many> 2.11BSD

Description:
	The moving the partitions tables out of the disk drivers and to
	a disklabel residing on the media has been on the wish list for
	many many years.

	Disklabels have finally arrived for 2.11BSD!

Repeat-By:
	Observation.  Also a reading of the setup and installation
	documentation for previous 2BSD releases (2.9, 2.10, 2.11)
	all have a paragraph similar to this present:

"It is possible to change the partitions by changing the code for the
table in the disk driver.  Since it's desirable to do this, these tables
really should be read off each pack...."

Fix:
	This is part 16 of 18.  Gather all parts before doing anything
	except reading the instructions which are in #250 (part 1).

	Updated by this part are:

/usr/src/sys/h/disklabel.h
/usr/src/sys/h/disk.h
/usr/src/sys/h/buf.h
/usr/src/sys/h/ioctl.h

	disklabel.h and disk.h are new files added to the system by
	unpacking the shar file included below.  The disklabel structure
	is defined in disklabel.h.  The second file, disk.h, contains
	structures and defines common to all device drivers which 
	implement label support.

	buf.h had a few minor changes - a couple unused or conflicting macros
	were removed.

	ioctl.h needed to have the maximum amount of data which is copied in
	and out raised.  Disklabels are ~216 bytes each, the old limit of 128
	bytes which could be passed using an ioctl was too low.

	Cut where indicated and save to a file (/tmp/265).  Then:

		cd /tmp
		sh 265
		sh sys_h.shar
		patch -p0 < sys_h.patch
		rm 265 sys_h.shar sys_h.patch

--------------------------cut here---------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create:
#	sys_h.patch
#	sys_h.shar
# This archive created: Tue Jun 27 22:32:53 1995
export PATH; PATH=/bin:/usr/bin:$PATH
if test -f 'sys_h.patch'
then
	echo shar: "will not over-write existing file 'sys_h.patch'"
else
sed 's/^Y//' << \SHAR_EOF > 'sys_h.patch'
Y*** /usr/src/sys/h/buf.h.old	Sun May 26 23:02:08 1991
Y--- /usr/src/sys/h/buf.h	Thu Apr 13 21:17:37 1995
Y***************
Y*** 3,9 ****
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)buf.h	1.1 (2.10BSD Berkeley) 12/1/86
Y   */
Y  
Y  /*
Y--- 3,9 ----
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)buf.h	1.2 (2.11BSD GTE) 1995/04/13
Y   */
Y  
Y  /*
Y***************
Y*** 71,78 ****
Y  #define	bawrite(bp)	{(bp)->b_flags |= B_ASYNC; bwrite(bp);}
Y  #define	bfree(bp)	(bp)->b_bcount = 0
Y  #define	bftopaddr(bp)	((u_int)(bp)->b_un.b_addr >> 6 | (bp)->b_xmem << 10)
Y- #define	dkblock(bp)	((bp)->b_blkno)
Y- #define	dkunit(bp)	(minor((bp)->b_dev) >> 3)
Y  
Y  #if defined(KERNEL) && !defined(SUPERVISOR)
Y  #define	BUFHSZ	16	/* must be power of 2 */
Y--- 71,76 ----
Y*** /usr/src/sys/h/ioctl.h.old	Thu Dec 15 20:15:56 1994
Y--- /usr/src/sys/h/ioctl.h	Sun May 21 13:38:53 1995
Y***************
Y*** 3,9 ****
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)ioctl.h	1.2 (2.11BSD GTE) 12/9/94
Y   */
Y  
Y  /*
Y--- 3,9 ----
Y   * All rights reserved.  The Berkeley software License Agreement
Y   * specifies the terms and conditions for redistribution.
Y   *
Y!  *	@(#)ioctl.h	1.3 (2.11BSD GTE) 1995/05/21
Y   */
Y  
Y  /*
Y***************
Y*** 84,92 ****
Y   * and the size of any in or out parameters in the upper
Y   * word.  The high 2 bits of the upper word are used
Y   * to encode the in/out status of the parameter; for now
Y!  * we restrict parameters to at most 128 bytes.
Y   */
Y! #define	IOCPARM_MASK	0x7f		/* parameters must be < 128 bytes */
Y  #define	IOC_VOID	0x20000000	/* no parameters */
Y  #define	IOC_OUT		0x40000000	/* copy out parameters */
Y  #define	IOC_IN		0x80000000	/* copy in parameters */
Y--- 84,92 ----
Y   * and the size of any in or out parameters in the upper
Y   * word.  The high 2 bits of the upper word are used
Y   * to encode the in/out status of the parameter; for now
Y!  * we restrict parameters to at most 256 bytes (disklabels are 216 bytes).
Y   */
Y! #define	IOCPARM_MASK	0xff		/* parameters must be < 256 bytes */
Y  #define	IOC_VOID	0x20000000	/* no parameters */
Y  #define	IOC_OUT		0x40000000	/* copy out parameters */
Y  #define	IOC_IN		0x80000000	/* copy in parameters */
SHAR_EOF
fi
if test -f 'sys_h.shar'
then
	echo shar: "will not over-write existing file 'sys_h.shar'"
else
sed 's/^Y//' << \SHAR_EOF > 'sys_h.shar'
Y#! /bin/sh
Y# This is a shell archive, meaning:
Y# 1. Remove everything above the #! /bin/sh line.
Y# 2. Save the resulting text in a file.
Y# 3. Execute the file with /bin/sh (not csh) to create:
Y#	/usr/src/sys/h/disk.h
Y#	/usr/src/sys/h/disklabel.h
Y# This archive created: Mon Jun 19 20:18:19 1995
Yexport PATH; PATH=/bin:/usr/bin:$PATH
Yif test -f '/usr/src/sys/h/disk.h'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/sys/h/disk.h'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/sys/h/disk.h'
YX/*
YX * Copyright (c) 1992, 1993
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * This software was developed by the Computer Systems Engineering group
YX * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
YX * contributed to Berkeley.
YX *
YX * All advertising materials mentioning features or use of this software
YX * must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Lawrence Berkeley Laboratory.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX *
YX *	@(#)disk.h	8.1.2 (2.11BSD GTE) 1995/05/21
YX *
YX * from: $Header: disk.h,v 1.5 92/11/19 04:33:03 torek Exp $ (LBL)
YX */
YX
YX#ifndef	_SYS_DISK_H_
YX#define	_SYS_DISK_H_
YX#include <sys/disklabel.h>
YX
YX/*
YX * Disk device structures.
YX *
YX * Note that this is only a preliminary outline.  The final disk structures
YX * may be somewhat different.
YX *
YX * Note:  the 2.11BSD version is very different.  The 4.4 version served
YX *        as the inspiration. I needed something similar but for slightly 
YX *	  different purposes.
YX */
YX
YX/*
YX * Disk device structures.  Rather than replicate driver specific variations
YX * of the following in each driver it was made common here.
YX *
YX * Some of the flags are specific to various drivers. For example ALIVE and 
YX * ONLINE apply to MSCP devices more than to SMD devices while the SEEK flag
YX * applies to the SMD (xp) driver but not to the MSCP driver.  The rest
YX * of the flags as well as the open partition bitmaps are usable by any disk
YX * driver.  One 'dkdevice' structure is needed for each disk drive supported
YX * by a driver.
YX *
YX * The entire disklabel is not resident in the kernel address space.  Only
YX * the partition table is directly accessible by the kernel.  The MSCP driver
YX * does not care (or know) about the geometry of the disk.  Not holding
YX * the entire label in the kernel saved quite a bit of D space.  Other drivers
YX * which need geometry information from the label will have to map in the
YX * label and copy out the geometry data they require.  This is unlikely to
YX * cause much overhead since labels are read and written infrequently - when
YX * mounting a drive, assigning a label, running newfs, etc.
YX */
YX
YXstruct dkdevice {
YX	int	dk_bopenmask;		/* block devices open */
YX	int	dk_copenmask;		/* character devices open */
YX	int	dk_openmask;		/* composite (bopen|copen) */
YX	int	dk_flags;		/* label state   see below */
YX	memaddr	dk_label;		/* sector containing label */
YX	struct	partition dk_parts[MAXPARTITIONS];	/* inkernel portion */
YX};
YX
YX#define	DKF_OPENING	0x0001		/* drive is being opened */
YX#define	DKF_CLOSING	0x0002		/* drive is being closed */
YX#define	DKF_WANTED	0x0004		/* drive is being waited for */
YX#define	DKF_ALIVE	0x0008		/* drive is alive */
YX#define	DKF_ONLINE	0x0010		/* drive is online */
YX#define	DKF_WLABEL	0x0020		/* label area is being written */
YX#define	DKF_SEEK	0x0040		/* drive is seeking */
YX#define	DKF_SWAIT	0x0080		/* waiting for seek to complete */
YX
YX/* encoding of disk minor numbers, should be elsewhere... but better
YX * here than in ufs_disksubr.c
YX *
YX * Note: the controller number in bits 6 and 7 of the minor device are NOT
YX *	 removed.  It is the responsibility of the driver to extract or mask
YX *	 these bits.
YX*/
YX
YX#define dkunit(dev)		(minor(dev) >> 3)
YX#define dkpart(dev)		(minor(dev) & 07)
YX#define dkminor(unit, part)	(((unit) << 3) | (part))
YX
YX#ifdef KERNEL
YXchar	*readdisklabel();
YXint	setdisklabel();
YXint	writedisklabel();
YX#endif
YX#endif /* _SYS_DISK_H_ */
YSHAR_EOF
Yfi
Yif test -f '/usr/src/sys/h/disklabel.h'
Ythen
Y	echo shar: "will not over-write existing file '/usr/src/sys/h/disklabel.h'"
Yelse
Ysed 's/^X//' << \SHAR_EOF > '/usr/src/sys/h/disklabel.h'
YX/*
YX * Copyright (c) 1987, 1988, 1993
YX *	The Regents of the University of California.  All rights reserved.
YX *
YX * Redistribution and use in source and binary forms, with or without
YX * modification, are permitted provided that the following conditions
YX * are met:
YX * 1. Redistributions of source code must retain the above copyright
YX *    notice, this list of conditions and the following disclaimer.
YX * 2. Redistributions in binary form must reproduce the above copyright
YX *    notice, this list of conditions and the following disclaimer in the
YX *    documentation and/or other materials provided with the distribution.
YX * 3. All advertising materials mentioning features or use of this software
YX *    must display the following acknowledgement:
YX *	This product includes software developed by the University of
YX *	California, Berkeley and its contributors.
YX * 4. Neither the name of the University nor the names of its contributors
YX *    may be used to endorse or promote products derived from this software
YX *    without specific prior written permission.
YX *
YX * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
YX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
YX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
YX * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
YX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
YX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
YX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
YX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
YX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
YX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
YX * SUCH DAMAGE.
YX *
YX *	@(#)disklabel.h	8.1.1 (2.11BSD) 1995/04/13
YX */
YX
YX#ifndef	_SYS_DISKLABEL_H_
YX#define	_SYS_DISKLABEL_H_
YX
YX/*
YX * Disk description table, see disktab(5)
YX */
YX#define	_PATH_DISKTAB	"/etc/disktab"
YX#define	DISKTAB		"/etc/disktab"		/* deprecated */
YX
YX/*
YX * Each disk has a label which includes information about the hardware
YX * disk geometry, filesystem partitions, and drive specific information.
YX * The label is in block 0 or 1, possibly offset from the beginning
YX * to leave room for a bootstrap, etc.
YX */
YX
YX/* XXX these should be defined per controller (or drive) elsewhere, not here! */
YX#define LABELSECTOR	1			/* sector containing label */
YX#define LABELOFFSET	0			/* offset of label in sector */
YX
YX#define DISKMAGIC	((u_long) 0x82564557)	/* The disk magic number */
YX#define	MAXPARTITIONS	8
YX
YX/*
YX * 2.11BSD's disklabels are different than 4.4BSD for a couple reasons:
YX *
YX *	1) D space is precious in the 2.11 kernel.  Many of the fields do
YX *	   not need to be a 'long' (or even a 'short'), a 'short' (or 'char')
YX *	   is more than adequate.  If anyone ever ports the FFS to a PDP11 
YX *	   changing the label format will be the least of the problems.
YX *
YX *	2) There is no need to support a bootblock more than 512 bytes long.
YX *	   The hardware (disk bootroms) only read the first sector, thus the
YX *	   label is always at sector 1 (the second half of the first filesystem
YX *	   block).
YX *
YX * Almost all of the fields have been retained but with reduced sizes.  This
YX * is for future expansion and to ease the porting of the various utilities
YX * which use the disklabel structure.  The 2.11 kernel uses very little other
YX * than the partition tables.  Indeed only the partition tables are resident
YX * in the kernel address space, the actual label block is allocated external to
YX * the kernel and mapped in as needed.
YX*/
YX
YXstruct disklabel {
YX	u_long	d_magic;		/* the magic number */
YX	u_char	d_type;			/* drive type */
YX	u_char	d_subtype;		/* controller/d_type specific */
YX	char	d_typename[16];		/* type name, e.g. "eagle" */
YX	/* 
YX	 * d_packname contains the pack identifier and is returned when
YX	 * the disklabel is read off the disk or in-core copy.
YX	 * d_boot0 is the (optional) name of the primary (block 0) bootstrap
YX	 * as found in /mdec.  This is returned when using
YX	 * getdiskbyname(3) to retrieve the values from /etc/disktab.
YX	 */
YX#if defined(KERNEL) || defined(STANDALONE)
YX	char	d_packname[16];			/* pack identifier */ 
YX#else
YX	union {
YX		char	un_d_packname[16];	/* pack identifier */ 
YX		char	*un_d_boot0;		/* primary bootstrap name */
YX	} d_un; 
YX#define d_packname	d_un.un_d_packname
YX#define d_boot0		d_un.un_d_boot0
YX#endif	/* ! KERNEL or STANDALONE */
YX			/* disk geometry: */
YX	u_short	d_secsize;		/* # of bytes per sector */
YX	u_short	d_nsectors;		/* # of data sectors per track */
YX	u_short	d_ntracks;		/* # of tracks per cylinder */
YX	u_short	d_ncylinders;		/* # of data cylinders per unit */
YX	u_short	d_secpercyl;		/* # of data sectors per cylinder */
YX	u_long	d_secperunit;		/* # of data sectors per unit */
YX	/*
YX	 * Spares (bad sector replacements) below
YX	 * are not counted in d_nsectors or d_secpercyl.
YX	 * Spare sectors are assumed to be physical sectors
YX	 * which occupy space at the end of each track and/or cylinder.
YX	 */
YX	u_short	d_sparespertrack;	/* # of spare sectors per track */
YX	u_short	d_sparespercyl;		/* # of spare sectors per cylinder */
YX	/*
YX	 * Alternate cylinders include maintenance, replacement,
YX	 * configuration description areas, etc.
YX	 */
YX	u_short	d_acylinders;		/* # of alt. cylinders per unit */
YX
YX			/* hardware characteristics: */
YX	/*
YX	 * d_interleave, d_trackskew and d_cylskew describe perturbations
YX	 * in the media format used to compensate for a slow controller.
YX	 * Interleave is physical sector interleave, set up by the formatter
YX	 * or controller when formatting.  When interleaving is in use,
YX	 * logically adjacent sectors are not physically contiguous,
YX	 * but instead are separated by some number of sectors.
YX	 * It is specified as the ratio of physical sectors traversed
YX	 * per logical sector.  Thus an interleave of 1:1 implies contiguous
YX	 * layout, while 2:1 implies that logical sector 0 is separated
YX	 * by one sector from logical sector 1.
YX	 * d_trackskew is the offset of sector 0 on track N
YX	 * relative to sector 0 on track N-1 on the same cylinder.
YX	 * Finally, d_cylskew is the offset of sector 0 on cylinder N
YX	 * relative to sector 0 on cylinder N-1.
YX	 */
YX	u_short	d_rpm;			/* rotational speed */
YX	u_char	d_interleave;		/* hardware sector interleave */
YX	u_char	d_trackskew;		/* sector 0 skew, per track */
YX	u_char	d_cylskew;		/* sector 0 skew, per cylinder */
YX	u_char	d_headswitch;		/* head swith time, usec */
YX	u_short	d_trkseek;		/* track-to-track seek, msec */
YX	u_short	d_flags;		/* generic flags */
YX#define NDDATA 5
YX	u_long	d_drivedata[NDDATA];	/* drive-type specific information */
YX#define NSPARE 5
YX	u_long	d_spare[NSPARE];	/* reserved for future use */
YX	u_long	d_magic2;		/* the magic number (again) */
YX	u_short	d_checksum;		/* xor of data incl. partitions */
YX
YX			/* filesystem and partition information: */
YX	u_short	d_npartitions;		/* number of partitions in following */
YX	u_short	d_bbsize;		/* size of boot area at sn0, bytes */
YX	u_short	d_sbsize;		/* max size of fs superblock, bytes */
YX	struct	partition {		/* the partition table */
YX		u_long	p_size;		/* number of sectors in partition */
YX		u_long	p_offset;	/* starting sector */
YX		u_short	p_fsize;	/* filesystem basic fragment size */
YX		u_char	p_fstype;	/* filesystem type, see below */
YX		u_char	p_frag;		/* filesystem fragments per block */
YX	} d_partitions[MAXPARTITIONS];	/* actually may be more */
YX};
YX
YX/* d_type values: */
YX#define	DTYPE_SMD		1		/* SMD, XSMD; VAX hp/up */
YX#define	DTYPE_MSCP		2		/* MSCP */
YX#define	DTYPE_DEC		3		/* other DEC (rk, rl) */
YX#define	DTYPE_SCSI		4		/* SCSI */
YX#define	DTYPE_ESDI		5		/* ESDI interface */
YX#define	DTYPE_ST506		6		/* ST506 etc. */
YX#define	DTYPE_FLOPPY		7		/* floppy */
YX
YX#ifdef DKTYPENAMES
YXstatic char *dktypenames[] = {
YX	"unknown",
YX	"SMD",
YX	"MSCP",
YX	"old DEC",
YX	"SCSI",
YX	"ESDI",
YX	"ST506",
YX	"floppy",
YX	0
YX};
YX#define DKMAXTYPES	(sizeof(dktypenames) / sizeof(dktypenames[0]) - 1)
YX#endif
YX
YX/*
YX * Filesystem type and version.
YX * Used to interpret other filesystem-specific
YX * per-partition information.
YX */
YX#define	FS_UNUSED	0		/* unused */
YX#define	FS_SWAP		1		/* swap */
YX#define	FS_V6		2		/* Sixth Edition */
YX#define	FS_V7		3		/* Seventh Edition */
YX#define	FS_SYSV		4		/* System V */
YX/*
YX * 2.11BSD uses type 5 filesystems even though block numbers are 4 bytes
YX * (rather than the packed 3 byte format) and the directory structure is
YX * that of 4.3BSD (long filenames).
YX*/
YX#define	FS_V71K		5		/* V7 with 1K blocks (4.1, 2.9, 2.11) */
YX#define	FS_V8		6		/* Eighth Edition, 4K blocks */
YX#define	FS_BSDFFS	7		/* 4.2BSD fast file system */
YX#define	FS_MSDOS	8		/* MSDOS file system */
YX#define	FS_BSDLFS	9		/* 4.4BSD log-structured file system */
YX#define	FS_OTHER	10		/* in use, but unknown/unsupported */
YX#define	FS_HPFS		11		/* OS/2 high-performance file system */
YX#define	FS_ISO9660	12		/* ISO 9660, normally CD-ROM */
YX
YX#ifdef	DKTYPENAMES
YXstatic char *fstypenames[] = {
YX	"unused",
YX	"swap",
YX	"Version 6",
YX	"Version 7",
YX	"System V",
YX	"2.11BSD",
YX	"Eighth Edition",
YX	"4.2BSD",
YX	"MSDOS",
YX	"4.4LFS",
YX	"unknown",
YX	"HPFS",
YX	"ISO9660",
YX	0
YX};
YX#define FSMAXTYPES	(sizeof(fstypenames) / sizeof(fstypenames[0]) - 1)
YX#endif
YX
YX/*
YX * flags shared by various drives:
YX */
YX#define		D_REMOVABLE	0x01		/* removable media */
YX#define		D_ECC		0x02		/* supports ECC */
YX#define		D_BADSECT	0x04		/* supports bad sector forw. */
YX#define		D_RAMDISK	0x08		/* disk emulator */
YX
YX/*
YX * Structure used to perform a format
YX * or other raw operation, returning data
YX * and/or register values.
YX * Register identification and format
YX * are device- and driver-dependent.
YX */
YXstruct format_op {
YX	char	*df_buf;
YX	int	df_count;		/* value-result */
YX	daddr_t	df_startblk;
YX	int	df_reg[8];		/* result */
YX};
YX
YX/*
YX * Structure used internally to retrieve
YX * information about a partition on a disk.
YX */
YXstruct partinfo {
YX	struct disklabel *disklab;
YX	struct partition *part;
YX};
YX
YX/*
YX * Disk-specific ioctls.
YX */
YX		/* get and set disklabel; DIOCGPART used internally */
YX#define DIOCGDINFO	_IOR(d, 101, struct disklabel)	/* get */
YX#define DIOCSDINFO	_IOW(d, 102, struct disklabel)	/* set */
YX#define DIOCWDINFO	_IOW(d, 103, struct disklabel)	/* set, update disk */
YX#define DIOCGPART	_IOW(d, 104, struct partinfo)	/* get partition */
YX
YX/* do format operation, read or write */
YX#define DIOCRFORMAT	_IOWR(d, 105, struct format_op)
YX#define DIOCWFORMAT	_IOWR(d, 106, struct format_op)
YX
YX#define DIOCSSTEP	_IOW(d, 107, int)	/* set step rate */
YX#define DIOCSRETRIES	_IOW(d, 108, int)	/* set # of retries */
YX#define DIOCWLABEL	_IOW(d, 109, int)	/* write en/disable label */
YX
YX#define DIOCSBAD	_IOW(d, 110, struct dkbad)	/* set kernel dkbad */
YX
YX#ifndef	KERNEL
YXstruct disklabel *getdiskbyname();
YX#endif
YX
YX#if	defined(KERNEL) && !defined(SUPERVISOR)
YXmemaddr	disklabelalloc();
YX#define	LABELDESC	(((btoc(sizeof (struct disklabel)) - 1) << 8) | RW)
YX#endif
YX
YX#endif	/* !_SYS_DISKLABEL_H_ */
YSHAR_EOF
Yfi
Yexit 0
Y#	End of shell archive
SHAR_EOF
fi
exit 0
#	End of shell archive
