Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ disk(4) — Ultrix-32 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

disktab(5)

fs(5)

chpt(8)

diskpart(8)

fsck(8)

mkfs(8)

tunefs(8)

DISK(4)

NAME

disk − general disk interface

SYNTAX

#include </sys/fs.h>

DESCRIPTION

This section describes the ioctl (input/output controller) codes for the disk driver. 

Basic Ioctls

The basic ioctl (input/output controller) format is: #include </sys/fs.h>
ioctl(fildes, code, arg)
struct pt *arg; The applicable codes are:

DIOCGETPT This code indicates 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.

DIOCSETPT This code indicates 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, you should use the chpt(8) command. 

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(1);
}
 /* 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

/etc/disktabfor disk geometry and file system partition information
/etc/mkfsto actually build the file system

RESTRICTIONS

These restrictions apply when using the DIOSETPT ioctl code:

•You must have superuser privileges. 

•You can not 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 can not change the offset of the a partition. 

SEE ALSO

disktab(5), fs(5), chpt(8), diskpart(8), fsck(8), mkfs(8), tunefs(8)
 
 

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