fd(7) —
NAME
fd − floppy disk (diskette) driver
DESCRIPTION
The diskette driver provides access to diskettes as both block and character devices. Diskettes must be formatted before they can be used (see format(1)). Both 512-byte and 1024-byte sectors with MFM encoding are supported. The driver controls up to two disk drives. The minor device number specifies both the drive number and the format of the diskette.
Diskette device file names (which correspond to a specific major and minor device) are in the following format:
/dev/{r}dsk/f#{dq}#{d}{t}
where r indicates a raw (character) interface to the disk, f# is the drive number, d or q indicates double or quad density (512 or 1024 byte sectors), # indicates the number of sectors per track, d indicates double-sided, and t indicates the entire disk (absence of this letter indicates that the first track of the diskette cannot be accessed). See the System Administration for New Users document in the INTERACTIVE UNIX System Guide for New Users for a discussion of XENIX diskette device files.
In order to minimize errors when using diskettes, the driver attempts to assure that the diskette is installed when needed, and that the operations requested have been completed before the device close is completed. In particular, the drive is checked for the presence of a diskette each time a read/write request is made to the drive. If this is not true (either because the diskette is not physically present or the door is open), the driver retries the request continually, at 5-second intervals. The message:
FD(n): diskette not present − please insert
appears after each attempt (the n represents the drive number). The INTR and QUIT signals are honored in this case, so that the process accessing the diskette drive in question will receive these signals (unless, of course, the process itself is ignoring them). In particular, if the diskette is removed prematurely or is not inserted soon enough, no data is lost, provided the correct diskette is inserted in the drive when the message to do so is displayed.
Ioctl Calls
V_GETPARMS
This call is used to get information about the current drive configuration. The argument to the ioctl is the address of one of the following structures, defined in <sys/vtoc.h>, which will be filled in by the ioctl:
struct disk_parms {
chardp_type;/∗ Disk type (see below) ∗/
unchardp_heads;/∗ Number of heads ∗/
ushortdp_cyls;/∗ Number of cylinders ∗/
unchardp_sectors;/∗ Number of sectors/track ∗/
ushortdp_secsiz;/∗ Number of bytes/sector ∗/
/∗ for this partition: ∗/
ushortdp_ptag;/∗ Partition tag (not used) ∗/
ushortdp_pflag;/∗ Partition flag (not used) ∗/
ushortdp_pstartsec;/∗ Starting sector number ∗/
ushortdp_pnumsec;/∗ Number of sectors ∗/
}
/∗ Disk types ∗/
#defineDPT_WINI1/∗ Winchester disk ∗/
#defineDPT_FLOPPY2/∗ Floppy ∗/
#defineDPT_OTHER3/∗ Other type of disk ∗/
#defineDPT_NOTDISK0/∗ Not a disk device ∗/
For the floppy driver, the disk type will always be DPT_FLOPPY. The unused fields in the disk_parms structure are only applicable to fixed disks; however, returning the same structure from both the fixed disk driver and the diskette driver allows programs to be written that can understand either one.
V_FORMAT
This call is used to format tracks on a diskette. The argument passed to the ioctl is the address of one of the following structures, defined in <sys/vtoc.h>, containing the starting track, number of tracks, and interleave factor:
union io_arg {
struct {
ushortstart_trk;/∗ first track ∗/
ushortnum_trks; /∗ number of tracks to format ∗/
ushortintlv;/∗ interleave factor ∗/
} ia_fmt;
}
Formatting will start at the given track and will continue so that the given number of tracks are formatted, using the given interleave factor.
Note that the file descriptor must refer to the character (raw) special device for the desired drive, and the file must have been opened in exclusive mode (i.e., O_EXCL).
FILES
/dev/dsk/f0d9d, /dev/rdsk/f0d9d, ...
/dev/dsk/f0d9dt, /dev/rdsk/f0d9dt, ...
/dev/dsk/f0q15d, /dev/rdsk/f0q15d, ...
/dev/dsk/f0q15dt, /dev/rdsk/f0q15dt, ...
/dev/dsk/f0q9d, /dev/rdsk/f0q9d, ...
/dev/dsk/f0q9dt, /dev/rdsk/f0q9dt, ...
/dev/dsk/f0q18d, /dev/rdsk/f0q18d, ...
/dev/dsk/f0q18dt, /dev/rdsk/f0q18dt, ...
SEE ALSO
format(1M), mkpart(1M).
ioctl(2) in the INTERACTIVE SDS Guide and Programmer’s Reference Manual.
INTERACTIVE UNIX System Guide for New Users.
DIAGNOSTICS
The driver will retry failed transfers up to ten times. If the request still has not succeeded, the driver will display an appropriate message. Errors from the diskette controller, other than the above, are displayed as follows:
FD drv n, blk b: drive error message
FD controller controller error message
The first message occurs on an error after a transfer has begun, where n is the drive the error occurred on, and b is the block number that is being read or written. The drive error message is one of the messages appearing in the following list:
"Missing data address mark"
The diskette may not be formatted properly.
"Cylinder marked bad"
The accessed cylinder has been marked bad by the formatter.
"Seek error (wrong cylinder)"
The drive positioned itself at the wrong cylinder when attempting to set up for the requested transfer.
"Uncorrectable data read error"
A CRC error was detected when attempting to read the requested block from the drive.
"Sector marked bad"
The accessed sector has been marked bad by the formatter.
"Missing header address mark"
The diskette may not be formatted properly.
"Write protected"
A write was attempted to a diskette that is currently write protected.
"Sector not found"
The diskette may not be formatted properly.
"Data overrun"
The system could not keep up with the requested transfer of data. (Should not occur.)
"Header read error"
The diskette may not be formatted properly.
"Illegal sector specified"
The driver is confused about the format of the diskette that has been inserted. (Should not occur.)
The second message occurs when there is a controller error during the setup for, or actual transfer of a block. The controller error message is one of the messages appearing in the following list:
"command timeout"
The controller failed to complete the requested command in a reasonable length of time.
"status timeout"
The controller failed to return its status after a command was completed.
"busy"
During an attempt to access the controller, a timeout occurred.
ADDED VALUE
This entry, supplied by INTERACTIVE Systems Corporation, contains enhancements to UNIX System V.
\*U — Version 1.0