fd
Purpose
Supports the diskette device driver.
Synopsis
#include <sys/devinfo.h>
Description
The diskette special file provides block and character
(raw) access to diskettes in the diskette drives,
allowing only one process to have a diskette drive open
for writing at a time. The config device driver associ-
ates the minor device number with a particular diskette
drive. Normally, the special file /dev/fdn is given the
minor device number n. Removing the diskette from the
drive with diskette files still open may cause various
I/O system calls to return errors.
The minor device number specifies both the drive number
and the format of the diskette to be read or written.
Assume that /dev/fdn corresponds to a diskette drive with
minor device number n. In this case, fd0, fd1, fd2, and
fd3 specify diskette drives 0 through 3, respectively,
without specifying their format.
Using fs0, . . . , fs3, which correspond to minor device
numbers 4 through 7, forces a diskette to be treated as a
single-sided diskette. Similarly, fd0.8, . . . , fd3.8,
which correspond to minor device numbers 8 through 11,
force the diskette to be treated as an 8-sectored
diskette. fs0.8, . . . , fs3.8, which correspond to
minor device numbers 12 through 15, force the diskette to
be treated as single-sided and 8-sectored.
Configuration Data
The config device driver is called during system initial-
ization to customize diskettes. This is accomplished by
calling the device driver at its initialization entry.
For diskettes, no device-dependent information is
required, so the customize information is the following
structure:
struct {
dev_t devno; /* major/minor device number */
unsigned short iodn; /* IODN to set */
unsigned short ddilen; /* device dependent info length */
unsigned short lev; /* ignored */
union { /* optional device dependent info */
char ddi_fd[];
. . . /* ddi for other devices */
} ddi;
};
ioctl Operations
The IOCTYPE type ioctl system call returns the device
type DD_DISK, defined in the sys/devinfo.h header file.
The IOCINFO type ioctl system call returns the following
structure, defined in the sys/devinfo.h header file:
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; /* number of blocks on diskette */
} 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/fd0, /dev/fd1, . . .
/dev/rfd0, /dev/rfd1, . . .
Related Information
In this book: "config," "fs," and "ioctl."