Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ip(4S)

xy(4S)

DKIO(4S)  —  System Manager’s Manual — Special Files

NAME

dkio − generic disk control operations

DESCRIPTION

All Sun disk drivers support a set of ioctl’s for disk formattting and labelling operations.  Basic to these ioctl’s are the definitions in <sun/dkio.h>:

/∗
 ∗ Structures and definitions for disk io control commands
 ∗/
 /∗ Disk identification ∗/
struct dk_info {
intdki_ctlr;/∗ controller address ∗/
shortdki_unit;/∗ unit (slave) address ∗/
shortdki_ctype;/∗ controller type ∗/
shortdki_flags;/∗ flags ∗/
};
/∗ controller types ∗/
#defineDKC_UNKNOWN0
#defineDKC_SMD21801
#defineDKC_WDC28802
#defineDKC_SMD21813
#defineDKC_XY4404
#defineDKC_DSD52155
#defineDKC_XY4506
#defineDKC_SCSI7
 /∗ flags ∗/
#defineDKI_BAD14401/∗ use DEC std 144 bad sector fwding ∗/
#defineDKI_MAPTRK02/∗ controller does track mapping ∗/
#defineDKI_FMTTRK04/∗ formats only full track at a time ∗/
#defineDKI_FMTVOL0x08/∗ formats only full volume at a time ∗/
 /∗ Definition of a disk’s geometry ∗/
struct dk_geom {
unsigned shortdkg_ncyl;/∗ # of data cylinders ∗/
unsigned shortdkg_acyl;/∗ # of alternate cylinders ∗/
unsigned shortdkg_bcyl;/∗ cyl offset (for fixed head area) ∗/
unsigned shortdkg_nhead;/∗ # of heads ∗/
unsigned shortdkg_bhead;/∗ head offset (for Larks, etc.) ∗/
unsigned shortdkg_nsect;/∗ # of sectors per track ∗/
unsigned shortdkg_intrlv;/∗ interleave factor ∗/
unsigned shortdkg_gap1;/∗ gap 1 size ∗/
unsigned shortdkg_gap2;/∗ gap 2 size ∗/
unsigned shortdkg_extra[10];/∗ for compatible expansion ∗/
};
 /∗ Disk format request ∗/
struct dk_fmt {
daddr_tdkf_blkno;/∗ starting block ∗/
daddr_tdkf_nblk;/∗ # of blocks ∗/
u_chardkf_fill;/∗ fill data ∗/
};
 /∗ Disk re-map request ∗/
struct dk_mapr {
daddr_tdkm_fblk;/∗ from block ∗/
daddr_tdkm_tblk;/∗ to block ∗/
daddr_tdkm_nblk;/∗ # blocks ∗/
u_chardkm_fill;/∗ fill data ∗/
};
 /∗ disk io control commands ∗/
#defineDKIOCHDR_IO(d, 1)/∗ next I/O will read/write header ∗/
#defineDKIOCGGEOM_IOR(d, 2, struct dk_geom)/∗ Get geometry ∗/
#defineDKIOCSGEOM_IOW(d, 3, struct dk_geom)/∗ Set geometry ∗/
#defineDKIOCGPART_IOR(d, 4, struct dk_map)/∗ Get partition info ∗/
#defineDKIOCSPART_IOW(d, 5, struct dk_map)/∗ Set partition info ∗/
#defineDKIOCFMT_IOW(d, 6, struct dk_fmt)/∗ Format ∗/
#defineDKIOCMAP_IOW(d, 7, struct dk_mapr)/∗ Map ∗/
#defineDKIOCINFO_IOR(d, 8, struct dk_info)/∗ Get info ∗/

The DKIOCGINFO ioctl returns a dk_info structure which tells the kind of the controller and attributes about how bad-block processing is done on the controller.  Bad sectors can then be processed using either the DKIOCMAP request, which causes a sector to be re-mapped on the disk, or the DKIOCFMT request which causes a sector to be re-formatted.  To read or write the header on a disk the DKIOCHDR ioctl can be used, and causes the next read or write request to return the (drive-type-specific) header data. 

The DKIOCGPART and DKIOCSPART get and set the controllers current notion of the partition table for the disk (without changing the partition table on the disk itself), while the DKIOCGGEOM and DKIOCSGEOM ioctl’s do similar things for the per-drive geometry information.  These can be used to format a drive, where the label does not exist before the drive is formatted. 

SEE ALSO

ip(4S), xy(4S)

BUGS

The DKIOCMAP and DKIOCFMT request are incompletely implemented. 

Sun System Release 1.0  —  15 August 1983

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026