Registers an I/O statistics structure used for updating I/O statistics reported by the iostat subroutine.
#include <sys/types.h> #include <sys/errno.h> #include <sys/iostat.h> #include <sys/devinfo.h>
int iostadd ( devtype, devstatp)
int devtype;
union {
struct ttystat *ttystp;
struct dkstat *dkstp;
} devstatp;
The iostadd kernel service is used to register the I/O statistics structure required to maintain statistics on a device. The iostadd service is typically called by a tty, disk, or CD-ROM device driver to provide the statistical information used by the iostat subroutine. The iostat subroutine displays statistic information for tty and disk devices on the system. The iostadd service should be used once for each configured device.
In AIX 5.2, support for Multi-Path I/O (MPIO) was added to the iostadd kernel service and the dkstat structure. The dkstat structure was expanded to accomodate the MPIO data. The iostadd kernel service was modified to handle the new version of the dkstat structure as well as older, legacy versions. For an MPIO device, the anchor is the disk's dkstat structure. This must be the first dkstat structure registered using the iostadd kernel service. Any path dkstat structures that are registered subsequently must reference the address of the anchor dkstat (disk) structure in the dkstat.dk_mpio_anchor field.
For tty devices, the devtype parameter has a value of DD_tty. In this case, the iostadd service uses the devstatp parameter to return a pointer to a ttystat structure.
For disk or CD-ROM devices with a devtype value of DD_DISK or DD_CD-ROM, the caller must provide a pinned and initialized dkstat structure as an input parameter. This structure is pointed to by the devstatp parameter on entry to the iostadd kernel service.
If the device driver support for a device is terminated, the dkstat or ttystat structure registered with the iostadd kernel service should be deregistered by calling the iostdel kernel service.
The iostadd kernel service uses two structures that are found in the usr/include/sys/iostat.h file: the ttystat structure and the dkstat structure.
The ttystat structure contains the following tty-related fields:
The second structure used by the iostadd kernel service is the dkstat structure, which contains information about disk devices. This structure contains the following fields:
The rawinch field in the ttystat structure should be incremented by the number of characters received by the tty device. The caninch field in the ttystat structure should be incremented by the number of input characters generated from canonical processing. The outch field is increased by the number of characters output to tty devices. These fields should be incremented by the device driver, but never be cleared.
A disk device driver must perform these four tasks:
If a disk device driver supports MPIO, it must perform the following tasks:
If the device supports discrete seek commands, the dkstat.dk_xrate field in the structure should be set to the transfer rate capability of the device (KB/sec). The device's dkstat structure should then be registered using the iostadd kernel service.
During drive operation update, the dkstat.dk_status field should show the busy/nonbusy state of the device. This can be done by setting and resetting the IOST_DK_BUSY flag. The dkstat.dk_xfers field should be incremented for each transfer initiated to or from the device. The dkstat.dk_rblks and dkstat.dk_wblks fields should be incremented by the number of blocks read or written.
If the device supports discrete seek commands, the dkstat.dk_seek field should be incremented by the number of seek commands sent to the device. If the device does not support discrete seek commands, both the dkstat.dk_seek and dkstat.dk_xrate fields should be left with a value of 0.
The base kernel updates the dkstat.dk_nextp and dkstat.dk_time fields. They should not be modified by the device driver after initialization. For MPIO devices, the base kernel also updates the dkstat.dk_mpio_next_path field.
The iostadd kernel service can be called from the process environment only.
The iostat command.
The iostdel kernel service.
Kernel Extension and Device Driver Management Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.