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.
Types of Diskettes Supported
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:
Item | Description |
---|---|
Prefix | Special file type. Possible values are fd and rfd, where the r indicates raw access to the special file. |
X | Drive number indicator. Possible values of 0 and 1 indicate drives 0 and 1, respectively. |
Y | Diskette format indicator. Possible values depend on the
type of diskette being used. Either a single character or a decimal
point followed by numeric characters is allowed. Possible values
are:
|
1.44MB, 3.5-inch Diskette Special Files
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.
2.88MB, 3.5-inch Diskette Special Files
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.
1.2MB, 5.25-inch Diskette Special Files
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.
Usage Considerations
When using subroutines with the fd special file, consider the following items:
Item | Description |
---|---|
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. |