dkio(4)
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, then 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, then 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 a specified disk block.
ACC_SCAN
Scans an area of the disk reporting any forced errors found and revectoring any bad blocks found.
EXAMPLE
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 );
}
}
FILES
/dev/{r}ra???
/dev/{r}hp???
/dev/{r}rb???
/dev/{r}rd???
/dev/{r}rk???
/dev/{r}rl???
/dev/{r}rx???
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.
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)
Special Files