hd
Purpose
Supports the fixed-disk device driver.
Synopsis
#include <sys/devinfo.h>
Description
The fixed-disk device driver provides block and character
(raw) access to minidisks on the fixed-disk drives. The
config device driver associates the minor device number
to the minidisk. Normally, the special files /dev/hdn
and /dev/rhdn is given the minor device number n.
The minidisk with minor device number 0 is always the
minidisk used to initially load the system program.
In raw I/O , the buffer must always begin on a full word
boundary, and counts should be a multiple of 512 bytes (a
disk block). Likewise lseek system calls should specify
a multiple of 512 bytes.
Configuration Data
The config device driver is called at its initialization
entry point during system initialization to customize
minidisks. The following shows the structure of the cus-
tomize information:
struct {
dev_t devno; /* major/minor device number */
unsigned short iodn; /* IODN set */
unsigned short ddilen; /* device dependent info length */
short lev; /* ignored */
union { /* optional device dependent info */
struct { /* for Send Command SVC */
int rv2,
rv3,
rv4,
rv5,
rv6;
} ddi_sc;
. . . /* ddi for other devices */
} ddi;
};
If the iodn field is 0, the manager receives a
Send_Command supervisor call (SVC) with values rv2, rv3,
rv4, rv5 and rv6 in registers 2, 3, 4, 5, and 6. The
driver waits for the manager to return a completion or
error interrupt. The return value is the status code
returned at the interrupt, which can be obtained using an
ioctl system call to the config device driver.
ioctl Operations
The VQUERY type ioctl call queries the disk write-verify
status for the minidisk. It uses the form:
ioctl (fildes, command, arg)
struct wverify *arg
where arg is a pointer to the one-word structure wverify
that contains the write verify status to be returned. A
value of 1 returned indicates enabled and 0 if disabled.
The VCNTRL type ioctl call enables or disables write
verify for the minidisk. It uses the form:
ioctl (fildes, command, arg)
int arg;
where an arg value of 0 is used to disable disk write-
verify and a value of 1 is used to enable disk write-
verify.
See "mdverify" for another way to set and query the
write-verify status of a minidisk.
The IOCTYPE type ioctl call returns the value DD_DISK,
defined in <sys/devinfo.h>.
The IOCINFO type ioctl call returns the following struc-
ture, defined in <sys/devinfo.h>:
struct devinfo {
char devtype;
char flags;
union {
struct { /* for disks */
short bytpsec; /* bytes per sector */
short secptrk; /* sectors per track */
short trkpcyl; /* tracks per cylinder */
long numblks; /* blocks this mini-disk */
} dk;
. . . /* for other devices */
} un;
};
/*flags */
#define DF_FIXED 01 /* non-removable */
#define DF_RAND 02 /* random access possible */
#define DF_FAST 04 /* a relative term */
Files
/dev/hd0, /dev/hd1, . . .
/dev/rhd0, /dev/rhd1, . . .
Related Information
In this book: "config," "fs," "ioctl," and "lseek."