Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rz(4)

disktab(5)

fstab(5)

chpt(8)

diskpart(8)

fsck(8)

MAKEDEV(8)

mkfs(8)

tunefs(8)

dkio(4)  —  RISC

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> structdevget. 

DKIOCACCThis code is defined in <sys/bbr.h>. It is currently unused.

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. 

Examples

This example shows how to use the DIOGETPT ioctl code to print the length and offset of the a partition of an RZ23 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/rz0a",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}rz???

See Also

rz(4), disktab(5), fstab(5), chpt(8), diskpart(8), fsck(8), MAKEDEV(8), mkfs(8), tunefs(8)
 

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