dkio(4) — VAX
Name
dkio − disk interface
Syntax
#include <sys/fs.h>
#include <sys/ioctl.h>
Description
This section describes the ioctl (input/output controller) codes for all disk drivers. The basic ioctl (input/output controller) format is: #include <sys/fs.h>
#include <sys/ioctl.h>
ioctl(fildes, code, arg)
struct pt *arg; The applicable codes are:
DIOCGETPTIndicates to the driver to store the information in the current partition table in the address pointed to by arg. The file descriptor must be opened on the raw partitions, a or c.
DIOCGETPT does not change the partition table, but it does provide access to the partition table information.
DIOCSETPTIndicates to the driver to modify the current partition table with the information pointed to by arg.
The file descriptor must be opened on the raw partitions, a or c.
If the a or c partition is not mounted, only the partition table in the driver is modified. This temporarily modifies the partition table of the disk. The modifications are overwritten with the default table when the disk is turned off and on.
If the a or c partition is mounted, both the partition table in the driver and the partition table in the primary superblock are modified. This permanently modifies the partition table of the disk. This is not recommended. To change a partition table permanently, use the chpt() command.
DIOCDGTPTIndicates to the driver to store the default information of the current partition table in the address pointed to by arg. The file descriptor must be opened on the raw partitions, a or c.
DIOCGETPT does not change the partition table, but it does provide access to the partition table information.
DKIOCGETAllows the user to receive generic disk information as defined in <sys/devio.h> struct devget.
DKIOCACCThis code is defined in <sys/bbr.h>. For an MSCP class disk, the driver performs one of the following functions:
ACC_REVEC
Forces revector of a specified disk block.
ACC_SCAN
Scans an area of the disk reporting any forced errors found and revectoring any bad blocks found.
DKIOCEXCLThis command is used to set and clear the exclusive access attribute on controllers that provide multihost support. In this case arg is an integer pointer. If the value of arg is 0 the exclusive access attribute will be cleared. If the value of arg is nonzero the exclusive access attribute will be set. The exclusive access attribute is set on a per-drive basis and can not be used selectively on individual partitions.
Attempts to clear the exclusive attribute will fail if the drive is not currently set exclusive access to the issuing host or the underlying controller or driver does not support multihost exclusive access. Attempts to set the exclusive attribute will fail if the drive is already exclusively associated with another host or the underlying controller or driver does not support multihost exclusive access.
Examples
This example shows how to use the DIOGETPT ioctl code to print the length and offset of the a partition of an RA81 disk:
#include <sys/types.h>
#include <sys/param.h>
#include <sys/fs.h>
#include <sys/ioctl.h>
main()
{
struct pt arg;
int fd, i;
/* Open the "a" partition of the disk you want to see */
if ( (fd = open("/dev/rra0a",0)) < 0 ) {
printf("Unable to open device\n");
exit(2);
}
/* Get the partition information */
if ( ioctl(fd,DIOCGETPT,&arg) < 0 )
printf("Error in ioctl\n");
printf("Length\t\tOffset\n");
for ( i = 0; i <= 7; i++ ) {
printf("%d\t\t%d\n",arg.pt_part[i].pi_nblocks,
arg.pt_part[i].pi_blkoff );
}
}
Restrictions
These restrictions apply when using the DIOCSETPT ioctl code:
•You must have superuser privileges.
•You cannot shrink or change the offset of a partition with a file system mounted on it or with an open file descriptor on the entire partition.
•You cannot change the offset of the a partition.
•The exclusive access ioctl DKIOCEXCL is only supported on HSC version V5.00 or later.
Files
/dev/{r}ra???
/dev/{r}hp???
/dev/{r}rb???
/dev/{r}rd???
/dev/{r}rk???
/dev/{r}rl???
/dev/{r}rx???
See Also
hp(4), ra(4), rb(4), rd(4), rk(4), rl(4), rx(4), disktab(5), fstab(5), chpt(8), diskpart(8), fsck(8), MAKEDEV(8), mkfs(8), tunefs(8)