DKIO(4S)

NAME
dkio - generic disk control operations

DESCRIPTION

All Sun disk drivers support a set of ioctl(2) requests for disk formatting and labeling operations. Basic to these ioctl() requests are the definitions in /usr/include/sun/dkio.h:

/*
* Structures and definitions for disk I/O control commands
*/
/* Controller and disk identification */
struct dk_info {
	int	dki_ctlr;		/* controller address */
	short	dki_unit;		/* unit (slave) address */
	short	dki_ctype;		/* controller type */
	short	dki_flags;		/* flags */
};
/* controller types */
#define DKC_UNKNOWN		0
#define DKC_DSD5215		5
#define DKC_XY450		6
#define DKC_ACB4000		7
#define DKC_MD21		8
#define DKC_XD7053		11
#define DKC_CSS		12
#define DKC_NEC765		13	/* floppy on Sun386i */
#define DKC_INTEL82072	14
/* flags */
#define	DKI_BAD144	0x01	/* use DEC std 144 bad sector fwding */
#define	DKI_MAPTRK	0x02	/* controller does track mapping */
#define	DKI_FMTTRK	0x04	/* formats only full track at a time */
#define	DKI_FMTVOL	0x08	/* formats only full volume at a time */
/* Definition of a disk's geometry */
struct dk_geom {
	unsigned short	dkg_ncyl;	/* # of data cylinders */
	unsigned short	dkg_acyl;	/* # of alternate cylinders */
	unsigned short	dkg_bcyl;	/* cyl offset (for fixed head area) */
	unsigned short	dkg_nhead;	/* # of heads */
	unsigned short	dkg_bhead;	/* head offset (for Larks, etc.) */
	unsigned short	dkg_nsect;	/* # of sectors per track */
	unsigned short	dkg_intrlv;	/* interleave factor */
	unsigned short	dkg_gap1;	/* gap 1 size */
	unsigned short	dkg_gap2;	/* gap 2 size */
	unsigned short	dkg_apc;	/* alternates per cyl (SCSI only) */
	unsigned short	dkg_extra[9];	/* for compatible expansion */
};
/* Partition map (part of dk_label) */
struct dk_map {
	long	dkl_cylno;	/* starting cylinder */
	long	dkl_nblk;	/* number of blocks */
};
/* Floppy characteristics */
struct fdk_char {
	u_char	medium;	/* medium type (scsi floppy only) */
	int	transfer_rate;	/* transfer rate */
	int	ncyl;		/* number of cylinders */
	int	nhead;		/* number of heads */
	int	sec_size;	/* sector size */
	int	secptrack;	/* sectors per track */
	int	steps;		/* number of steps per */
};
/* Used by FDKGETCHANGE, returned state of the sense disk change bit. */
#define FDKGC_HISTORY	0x01	/* disk has changed since last call */
#define FDKGC_CURRENT	0x02	/* current state of disk change */
/* disk I/O control commands */
#define	DKIOCINFO		_IOR(d, 8, struct dk_info)	/* Get info */
#define	DKIOCGGEOM		_IOR(d, 2, struct dk_geom)	/* Get geometry */
#define	DKIOCSGEOM		_IOW(d, 3, struct dk_geom)	/* Set geometry */
#define	DKIOCGPART		_IOR(d, 4, struct dk_map)	/* Get partition info */
#define	DKIOCSPART		_IOW(d, 5, struct dk_map)	/* Set partition info */
#define	DKIOCWCHK		_IOWR(d, 115, int)		/* Toggle write check */
/* floppy I/O control commands */
#define	FDKIOGCHAR		_IOR(d, 114, struct fdk_char)	/* Get floppy characteristics */
#define	FDKEJECT		_IO(d, 112)			/* Eject floppy */
#define	FDKGETCHANGE	_IOR(d, 111, int)			/* Get disk change status */

The DKIOCINFO ioctl returns a dk_info structure which tells the type of the controller and attributes about how bad-block processing is done on the controller. The DKIOCGPART and DKIOCSPART get and set the controller's current notion of the partition table for the disk (without changing the partition table on the disk itself), while the DKIOCGGEOM and DKIOCSGEOM ioctls do similar things for the per-drive geometry information. The DKIOCWCHK enables or disables a disk's write check capabilities. The FDKIOGCHAR ioctl returns an fdk_char structure which gives the characteristics of the floppy diskette. The FDKEJECT ioctl ejects the floppy diskette. The FDKGETCHANGE returns the status of the diskette changed signal from the floppy interface.

FILES
/usr/include/sun/dkio.h

SEE ALSO
fd(4S), ip(4P), sd(4S), xd(4S), xy(4S), dkctl(8)