DISKPART(5) COMMAND REFERENCE DISKPART(5)
NAME
diskpart - results of IDSKIOCIDDRV rigid disk ioctl
SYNOPSIS
#include <sys/ioctl.h>
#include <machine/idiskioctl.h>
ioctl(fd, IDSKIOCIDDRV, argp)
int fd;
struct id_drvstat *argp;
DESCRIPTION
The IDDRV command is used to obtain information about a
rigid disk partition (this does not apply to floppy disks).
The file descripter must be opened on any raw device
associated with the disk of interest. For example,
information about partition 2 (normally swap space) on the
internal disk of a 4310 would be obtained by opening
/dev/rdw00[a-p] and calling ioctl with the IDSKIOCIDDRV
command.
The structure id_drvstat can be found in the include file
<machine/idiskioctl.h> and is shown below:
/*
* Copyright (C) 1983, Tektronix Inc. - All rights Reserved
*
*/
/*
* struct id_drvstat - status of a drive -- the result of an
* IDDRV command. These structures should match those defined
* in the maintenance block structure.
*/
#define IDPARTCNT 16 /* partitions/drive */
struct id_volume_id {
char idvi_disk_id[8]; /* 8 bytes of ID */
char idvi_diskname[8]; /* disk type name */
};
struct id_phys_desc {
unsigned short idpy_ncyl; /* nbr of cylinders */
unsigned char idpy_nhead; /* number of heads */
unsigned char idpy_nsect; /* USED sectors/track */
unsigned char idpy_nspare; /* SPARE sectors/track */
unsigned char idpy_bps; /* coded data sector size */
unsigned short idpy_rpm; /* rotational speed */
};
struct id_partinfo {
unsigned short idpi_ncyls; /* size (in cylinders) */
unsigned short idpi_cylofst; /* starting cylinder number */
char idpi_type[2]; /* 2 char type (e.g. "US") */
Printed 3/13/89 1
DISKPART(5) COMMAND REFERENCE DISKPART(5)
char idpi_val[2]; /* 2 byte type-specific data */
};
#define idpi_blksiz idpi_val[0] /* coded fs blksize for "UF" */
#define idpi_frgsiz idpi_val[1] /* coded fs fragsize for "UF" */
struct id_drvstat {
struct id_volume_id idds_vid;
struct id_phys_desc idds_phys;
struct id_partinfo idds_part[IDPARTCNT];
};
/*
* values for id_phys_desc.idpy_bps
*/
#define IDMB_BPS_128 0
#define IDMB_BPS_256 1
#define IDMB_BPS_512 2
#define IDMB_BPS_1024 3
/*
* values for id_partinfo.idpi_blksiz and id_partinfo.idpi_frgsiz
* powers of 2, representing upper and lower limits
*/
#define IDMB_BLKL ((char)12)
#define IDMB_BLKH ((char)13)
#define IDMB_FRGL ((char)9)
#define IDMB_FRGH ((char)12)
/*
* convert encoded value of id_partinfo.idpi_blksiz to integer
*/
#define idmb_blktosiz(code) (1 << (int)(code))
/*
* convert encoded value of id_partinfo.idpi_frgsiz to integer
*/
#define idmb_frgtosiz(code) (1 << (int)(code))
The following is a summary of the possible values of
idpi_type:
UF UTek file system partition.
US UTek paging space.
XX Unused partition.
RW Read/Write, a misnomer, used exclusively for the data space partition.
Printed 3/13/89 2
DISKPART(5) COMMAND REFERENCE DISKPART(5)
DG Diagnostic partition.
MP Maintenance partition.
WD Whole disk partition.
EXAMPLES
This example program estimates how many page pairs can be
held by the standard swap space on a 4310.
#define stratos
#include <stdio.h>
#include <sys/ioctl.h>
#include <machine/idiskioctl.h>
#define PAIRSIZE 1024
static struct id_drvstat info_buffer;
main()
{
register int fd;
register struct id_drvstat *argp;
register int bytes;
argp = &info_buffer;
fd = open("/dev/rdw00b", 0);
ioctl(fd, IDSKIOCIDDRV, argp);
if (strncmp(argp->idds_part[1].idpi_type, "US", 2)
!= 0) {
fprintf(stderr, "failed consistency test.");
exit(1);
}
switch (argp->idds_phys.idpy_bps) {
case IDMB_BPS_128: bytes = 128; break;
case IDMB_BPS_256: bytes = 256; break;
case IDMB_BPS_512: bytes = 512; break;
case IDMB_BPS_1024: bytes = 1024; break;
}
bytes *= argp->idds_phys.idpy_nsect;
bytes *= argp->idds_phys.idpy_nhead;
bytes *= argp->idds_part[1].idpi_ncyls;
printf("swap space will hold %d page pairs\n",
bytes / PAIRSIZE);
}
SEE ALSO
ioctl(2), dh(4), and dw(4).
Printed 3/13/89 3
%%index%%
na:336,103;
sy:439,1295;
de:1734,2628;4770,1709;6887,109;
ex:6996,1565;
se:8561,140;
%%index%%000000000118