dkio(7)
NAME
dkio − disk control operations
SYNOPSIS
#include <sys/dkio.h>
#include <sys/vtoc.h>
DESCRIPTION
All Sun disk drivers support a set of ioctl(2) requests for disk controller, geometry, and partition information. Basic to these ioctl() requests are the definitions in <sys/dkio.h>.
IOCTLS
The following ioctl() requests set and/or retrieve the current disk controller, partitions, or geometry information:
DKIOCINFO The argument is a pointer to a dk_cinfo structure (described below). This structure tells the type of the controller and attributes about how bad-block processing is done on the controller.
/∗
∗ Structures and definitions for disk I/O control commands
∗/
#defineDK_DEVLEN16/∗ device name max length, including ∗/
/∗
∗ Used for controller info
∗/
struct dk_cinfo {
chardki_cname[DK_DEVLEN];/∗ controller name (no unit #) ∗/
u_shortdki_ctype;/∗ controller type ∗/
u_shortdki_flags;/∗ flags ∗/
u_shortdki_cnum;/∗ controller number ∗/
u_intdki_addr;/∗ controller address ∗/
u_intdki_space;/∗ controller bus type ∗/
u_intdki_prio;/∗ interrupt priority ∗/
u_intdki_vec;/∗ interrupt vector ∗/
chardki_dname[DK_DEVLEN];/∗ drive name (no unit #) ∗/
u_intdki_unit;/∗ unit number ∗/
u_intdki_slave;/∗ slave number ∗/
u_shortdki_partition;/∗ partition number ∗/
u_shortdki_maxtransfer;/∗ max. transfer size in DEV_BSIZE ∗/
};
/∗
∗ Controller types
∗/
#defineDKC_UNKNOWN0
#defineDKC_CDROM1/∗ CD-ROM, SCSI or otherwise ∗/
#defineDKC_WDC28802
#defineDKC_XXX_03/∗ unassigned ∗/
#defineDKC_XXX_14/∗ unassigned ∗/
#defineDKC_DSD52155
#defineDKC_XY4506
#defineDKC_ACB40007
#defineDKC_MD218
#defineDKC_XXX_29/∗ unassigned ∗/
#defineDKC_NCRFLOPPY10
#defineDKC_XD705311
#defineDKC_SMSFLOPPY12
#defineDKC_SCSI_CCS13/∗ SCSI CCS compatible ∗/
#defineDKC_INTEL8207214/∗ native floppy chip ∗/
#defineDKC_PANTHER15
#defineDKC_SUN_IPI1DKC_PANTHER/∗ Sun Panther VME/IPI controller ∗/
#defineDKC_MD16/∗ meta-disk (virtual-disk) driver ∗/
#defineDKC_CDC_905717/∗ CDC 9057-321 (CM-3) IPI String Controller ∗/
#defineDKC_FJ_M106018/∗ Fujitsu/Intellistor M1060 IPI-3 SC ∗/
/∗
∗ Sun reserves up through 1023
∗/
#defineDKC_CUSTOMER_BASE1024
/∗
∗ Flags
∗/
#defineDKI_1440x01/∗ use DEC std 144 bad sector fwding ∗/
#defineDKI_MAPTRK0x02/∗ controller does track mapping ∗/
#defineDKI_FMTTRK0x04/∗ formats only full track at a time ∗/
#defineDKI_FMTVOL0x08/∗ formats only full volume at a time ∗/
#defineDKI_FMTCYL0x10/∗ formats only full cylinders at a time ∗/
#defineDKI_HEXUNIT0x20/∗ unit number is printed as 3 hex digits ∗/
DKIOCGAPART
The argument is a pointer to a dk_allmap structure (described below). This ioctl() gets the controller’s notion of the current partition table for disk drive.
DKIOCSAPART
The argument is a pointer to a dk_allmap structure (described below). This ioctl() sets the controller’s notion of the partition table without changing the disk itself.
/∗
∗ Partition map (part of dk_label)
∗/
struct dk_map {
daddr_tdkl_cylno;/∗ starting cylinder ∗/
daddr_tdkl_nblk;/∗ number of blocks ∗/
};
/∗
∗ Used for all partitions
∗/
struct dk_allmap {
struct dk_mapdka_map[NDKMAP];
};
DKIOCPARTINFO
The argument is a pointer to a part_info structure (described below). This ioctl( ) gets the driver’s notion of the size and extent of the partition or slice indicated by the file descriptor argument.
/∗
∗ Used by applications to get partition or slice information
∗/
struct part_info {
daddr_tp_start;
intp_length;
};
DKIOCGGEOM
The argument is a pointer to a dk_geom structure (described below). This ioctl() gets the controller’s notion of the current geometry of the disk drive.
DKIOCSGEOM
The argument is a pointer to a dk_geom structure (described below). This ioctl() sets the controller’s notion of the geometry without changing the disk itself.
DKIOCG_PHYGEOM
The argument is a pointer to a dk_geom structure (described below). This ioctl( ) gets the driver’s notion of the physical geometry of the disk drive. It is functionally identical to the DKIOCGGEOM ioctl().
DKIOCG_VIRTGEOM
The argument is a pointer to a dk_geom structure (described below). This ioctl( ) gets the controller’s (and hence the driver’s) notion of the virtual geometry of the disk drive. Virtual geometry is a view of the disk geometry maintained by a host bus adapter.
/∗
∗ Definition of a disk’s geometry
∗/
struct dk_geom {
unsigned longdkg_pcyl;/∗ # of physical cylinders ∗/
unsigned longdkg_ncyl;/∗ # of data cylinders ∗/
unsigned shortdkg_acyl;/∗ # of alternate cylinders ∗/
unsigned shortdkg_bcyl;/∗ cyl offset (for fixed head area) ∗/
unsigned longdkg_nhead;/∗ # of heads ∗/
unsigned longdkg_nsect;/∗ # of data sectors per track ∗/
unsigned shortdkg_intrlv;/∗ interleave factor ∗/
unsigned shortdkg_shew;/∗ shew factor ∗/
unsigned shortdkg_apc;/∗ alternates per cyl (SCSI only) ∗/
unsigned shortdkg_rpm;/∗ revolutions per minute ∗/
unsigned shortdkg_write_reinstruct; /∗ # sectors to skip, writes ∗/
unsigned shortdkg_read_reinstruct; /∗ # sectors to skip, reads ∗/
unsigned shortdkg_extra[4];/∗ for compatible expansion ∗/
};
#definedkg_gap1dkg_extra[0]/∗ for application compatibility ∗/
#definedkg_gap2dkg_extra[1]/∗ for application compatibility ∗/
DKIOCGVTOC
The argument is a pointer to a vtoc structure (described below). This ioctl() returns the device’s current VTOC (volume table of contents).
DKIOCSVTOC
The argument is a pointer to a vtoc structure (described below). This ioctl() changes the VTOC associated with the device.
struct partition{
ushortp_tag;/∗ ID tag of partition ∗/
ushortp_flag;/∗ permission flags ∗/
daddr_t p_start;/∗ start sector no of partition ∗/
longp_size;/∗ # of blocks in partition ∗/
};
struct vtoc {
unsigned longv_bootinfo[3];/∗ info needed by mboot
(unsupported) ∗/
unsigned longv_sanity;/∗ to verify vtoc sanity ∗/
unsigned longv_version;/∗ layout version ∗/
charv_volume[LEN_DKL_VVOL];/∗ volume name ∗/
ushortv_sectorsz;/∗ sector size in bytes ∗/
ushortv_nparts;/∗ number of partitions ∗/
unsigned longv_reserved[10];/∗ free space ∗/
struct partitionv_part[V_NUMPAR];/∗ partition headers ∗/
time_ttimestamp[V_NUMPAR];/∗ partition timestamp
(unsupported) ∗/
charv_asciilabel[LEN_DKL_ASCII];/∗ for compatibility ∗/
};
/∗
∗ Partition permission flags
∗/
#defineV_UNMNT0x01/∗ Unmountable partition ∗/
#defineV_RONLY0x10/∗ Read only ∗/
/∗
∗ Partition identification tags
∗/
#defineV_UNASSIGNED0x00/∗ unassigned partition ∗/
#defineV_BOOT0x01/∗ Boot partition ∗/
#defineV_ROOT0x02/∗ Root filesystem ∗/
#defineV_SWAP0x03/∗ Swap filesystem ∗/
#defineV_USR0x04/∗ Usr filesystem ∗/
#defineV_BACKUP0x05/∗ full disk ∗/
#defineV_STAND0x06/∗ Stand partition ∗/
#defineV_VAR0x07/∗ Var partition ∗/
#defineV_HOME0x08/∗ Home partition ∗/
#defineV_ALTSCTR0x09/∗ Alternate sector partition ∗/
DKIOCADDBAD
This ioctl( ) forces the driver to re-examine the alternates slice and rebuild the internal bad block map accordingly. It should be used whenever the alternates slice is changed by any method other than the addbadsec(1M) utility.
SEE ALSO
SunOS 5.1 — Last change: 22 January 1993