Provides access to the diskette device driver.
The fd special file provides block and character (raw) access to diskettes in the diskette drives. The special file name usually specifies both the drive number and the format of the diskette. The exceptions are /dev/fd0 and /dev/fd1, which specify diskette drives 0 and 1, respectively, without specifying their formats.
The generic special files /dev/fd0 and /dev/fd1 determine the diskette type automatically for both drive 0 and drive 1. First, the device-driver attempts to read the diskette using the characteristics of the default diskette for the drive type. If this fails, the device-driver changes its characteristics and attempts to read until it has read the diskette successfully or until it has tried all the possibilities supported for the drive type by the device driver.
An r prefix on a special file name means that the drive is accessed as a raw device rather than a block device. Performing raw I/O with a diskette requires that all data transfers be in multiples of the diskette sector length. Also, all lseek subroutine calls made to the raw diskette device driver must result in a file offset value that is a multiple of the sector size. For the diskette types supported, the sector length is always 512 bytes.
Note: The diskette device driver does not perform read verification of data that is written to a diskette.
The fd special file
supports three diskette drives: the 1.2MB, 5.25-inch
diskette drive, and the 1.44MB and 2.88MB, 3.5-inch
diskette drives. All fd special file names (except the
generic special files /dev/fd0, /dev/fd1,
/dev/rfd0, and /dev/rfd1) contain suffixes that dictate
how a diskette is to be treated. These special file names have a format
of PrefixXY, where the Prefix, X, and Y
variables have the following meanings:
Ten different special files are available for use with the 1.44MB, 3.5-inch diskette drive. The default diskette type assumed for this drive type is a double-sided, 80-cylinder, 18 sectors-per-track diskette.
An h or .18 as the suffix of the special file name (for example, /dev/rfd0h or /dev/fd0.18) forces a diskette to be treated as a double-sided, 80-cylinder, 18 sectors-per-track diskette. An l or .9 as the suffix of the special file name (for example, /dev/fd1l or /dev/rfd0.9) forces a diskette to be treated as a double-sided, 80-cylinder, 9 sectors-per-track diskette.
Twelve different special files are available for use with the 2.88MB, 3.5-inch diskette drive. The default diskette type assumed for this drive type is a double-sided, 80-cylinder, 36 sectors-per-track diskette.
An h or .36 as the suffix of the special file name (for example, /dev/fd1h or /dev/fd0.36) forces a diskette to be treated as a double-sided, 80-cylinder, 36 sectors-per-track diskette. An l or .9 as the suffix of the special file name (for example, /dev/rfd0l or /dev/fd1.9) forces a diskette to be treated as a double-sided, 80-cylinder, 9 sectors-per-track diskette. A suffix of .18 (for example, /dev/fd1.18) forces a diskette to be treated as a double-sided, 80-cylinder, 18-sectors-per-track diskette.
Ten different special files are available for use with the 1.2MB, 5.25-inch diskette drive. The default diskette type assumed for this drive type is a double-sided, 80-cylinder, 15 sectors-per-track diskette.
An h or .15 as the suffix of the special file name (for example, /dev/rfd1h or /dev/fd0.15) forces a diskette to be treated as a double-sided, 80-cylinder, 15 sectors-per-track diskette. An l or .9 as the suffix of the special file name (for example, /dev/fd0l or /dev/rfd1.9) forces a diskette to be treated as a double-sided, 80-cylinder, 9 sectors-per-track diskette.
Note: Regardless of the diskette drive type, an h as the suffix of the special file name forces a diskette to be treated as the highest capacity diskette supported by the drive type. When an l is used as the suffix of the special file name, the diskette is treated as the lowest capacity diskette supported by the drive type.
When using subroutines with the
fd special file, consider the following items:
open and close subroutines | Only one process at a time can issue an open subroutine to gain access to a particular drive. However, all child processes created by a parent process that successfully opens a diskette drive inherit the open diskette drive. |
read and write subroutines | No special considerations. |
ioctl subroutines | The possible ioctl operations and their
descriptions are:
The diskette characteristics used during formatting are whatever values are in the device driver when it receives the format command. These characteristics need to be set to the desired values prior to issuing the format command. There are three ways to do this:
For formatting, the diskette driver should be opened only when the O_NDELAY flag is set. Otherwise, the driver will attempt to determine the type of diskette in the drive, causing the open to fail. |
The fd special file is part of Base Operating System (BOS) Runtime.
The close subroutine, ioctl subroutine, lseek subroutine, open subroutine, read subroutine, write subroutine.