Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dkio(7) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ioctl(2)

cdio(7)

fdio(7)

hdio(7)

ipi(7)

sd(7)

xd(7)

xy(7)

dkio(7)

NAME

dkio − disk control operations

SYNOPSIS

#include <sys/dkio.h>
#include <sys/vtoc.h>

DESCRIPTION

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 unit # and NULL∗/
/∗
 ∗ 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 ∗/
#defineDKC_INTEL8207719/∗ 82077 floppy disk controller ∗/
/∗
 ∗ Sun reserves up through 1023
 ∗/
#defineDKC_CUSTOMER_BASE1024
/∗
 ∗ Flags
 ∗/
#defineDKI_BAD1440x01/∗ 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];
};

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. 

/∗
 ∗ 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_obs1;/∗ obsolete ∗/
unsigned shortdkg_nsect;/∗ # of sectors per track ∗/
unsigned shortdkg_intrlv;/∗ interleave factor ∗/
unsigned shortdkg_obs2;/∗ obsolete ∗/
unsigned shortdkg_obs3;/∗ obsolete ∗/
unsigned shortdkg_apc;/∗ alternates per cyl (SCSI only) ∗/
unsigned shortdkg_rpm;/∗ revolutions per minute ∗/
unsigned shortdkg_pcyl;/∗ # of physical cylinders ∗/
unsigned shortdkg_write_reinstruct;/∗ # sectors to skip, writes ∗/
unsigned shortdkg_read_reinstruct;/∗ # sectors to skip, reads ∗/
unsigned shortdkg_extra[7];/∗ for compatible expansion ∗/
};

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 # ∗/
/∗ 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 partition v_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 ∗/

DKIOCEJECT This ioctl() requests the disk drive to eject it’s disk, if that drive supports removable media. 
 

DKIOCLOCK This ioctl() requests the disk drive to lock the door, for those devices with removable media. 
 

DKIOCUNLOCK
This ioctl() requests the disk drive to unlock the door, for those devices with removable media. 
 

DKIOCSTATE This ioctl() blocks until the state of the drive, inserted or ejected, is changed.  The argument is a pointer to a dkio_state, enum, whose possible enumerations are listed below.  The initial value should be either the last reported state of the drive, or DKIO_NONE .  Upon return, the enum pointed to by the argument is updated with the current state of the drive. 

enum dkio_state{
DKIO_NONE,/∗ Return disk’s current state ∗/
DKIO_EJECTED,/∗ Disk state is ’ejected’ ∗/
DKIO_INSERTED/∗ Disk state is ’inserted’ ∗/
};

 

SEE ALSO

ioctl(2), cdio(7), fdio(7), hdio(7), ipi(7), sd(7), xd(7), xy(7)

SunOS 5.2  —  Last change: 18 Feb 1993

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