fd(7) UNIX System V fd(7)
NAME
fd - diskette (floppy disk)
DESCRIPTION
The diskette driver provides access to diskettes as both block and
character devices. Diskettes must be formatted before their use [see
format(1)]. Both 5.25" and 3.50" diskette formats are supported. The
driver controls up to two diskette drives. The minor device number
specifies the drive number, the format of the diskette and the partition
number.
Diskette device file names (which correspond to a specific major and
minor device) use the following format:
/dev/{r}dsk/{0,1}{5h,5d9,5d8,5d4,5d16,5q,3h,3d}{t,u}
where r indicates a raw (character) interface to the diskette, rdsk
selects the raw device interface and dsk selects the block device
interface. 0 or 1 selects the drive to be accessed: f0 selects floppy
drive 0, while f1 selects drive 1. The following list describes the
format to be interacted with:
5h 5.25" high density diskette (1.2MB).
5d9 5.25" double density diskette, 9 sectors per track (360KB).
5d8 5.25" double density diskette, 8 sectors per track (320KB).
5d4 5.25" double density diskette, 4 sectors per track (320KB).
5d16 5.25" double density diskette, 16 sectors per track
(320KB).
5q 5.25" quad density diskette (720KB).
3h 3.50" high density diskette (1.44MB).
3d 3.50" double density diskette (720KB).
Format specification is mandatory when opening the device for formatting.
However, when accessing a floppy disk for other operations (read and
write), the format specification field can be omitted. In this case, the
floppy disk driver will automatically determine the format previously
established on the diskette and then perform the requested operation (for
example, cpio -itv</dev/rsdk/f1).
The last parameter, t or u, selects the partition to be accessed. t
represents the whole diskette. Without t or u specified, the whole
diskette except cylinder 0 will be selected. u represents the whole
diskette except track 0 of cylinder 0 and applies only to the 568 type of
floppy (floppies created on AT&T UNIX computer).
Besides the device file naming convention described above, some of the
formats have alias names that correlate to previous releases. The
following list describes the formats that have an alias:
10/89 Page 1
fd(7) UNIX System V fd(7)
format alias
5h q15d
5d8 d8d
5d9 d9d
For example, the device file /dev/rdsk/f0q15dt is equivalent to
/dev/rdsk/f05ht.
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 the diskette is not physically present or the door is
open), the driver retries the request continually, at five-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 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
VGETPARMS
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 diskparms {
char dptype; /* Disk type (see below) */
unchar dpheads; /* Number of heads */
ushort dpcyls; /* Number of cylinders */
unchar dpsectors; /* Number of sectors/track */
ushort dpsecsiz; /* Number of bytes/sector */
/* for this partition: */
ushort dpptag; /* Partition tag (not used) */
ushort dppflag; /* Partition flag (not used) */
ushort dppstartsec; /* Starting sector number */
ushort dppnumsec; /* Number of sectors */
}
/* Disk types */
#define DPTWINI 1 /* Winchester disk */
#define DPTFLOPPY 2 /* Floppy */
#define DPTOTHER 3 /* Other type of disk */
Page 2 10/89
fd(7) UNIX System V fd(7)
#define DPTNOTDISK 0 /* 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 hard disks; however, returning the same structure from both the
hard disk driver and the diskette driver allows programs to be
written that can understand either one.
VFORMAT
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 ioarg {
struct {
ushort starttrk; /* first track */
ushort numtrks; /* number of tracks
to format */
ushort intlv; /* interleave factor */
} iafmt;
}
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/f0, /dev/rdsk/f0, ...
/dev/dsk/f0t, /dev/rdsk/f0t, ...
/dev/dsk/f05h, /dev/rdsk/f05h, ...
/dev/dsk/f05ht, /dev/rdsk/f05ht, ...
/dev/dsk/f05d9, /dev/rdsk/f05d9, ...
/dev/dsk/f05d9t, /dev/rdsk/f05d9t, ...
/dev/dsk/f0fd8, /dev/rdsk/f05d8, ...
/dev/dsk/f05d8t, /dev/rdsk/f05d8t, ...
/dev/dsk/f05d4, /dev/rdsk/f05d4, ...
/dev/dsk/f05d4t, /dev/rdsk/f05d4t, ...
/dev/dsk/f05d16, /dev/rdsk/f05d16, ...
/dev/dsk/f05d16t, /dev/rdsk/f05d16t, ...
/dev/dsk/f05q, /dev/rdsk/f05q, ...
/dev/dsk/f05qt, /dev/rdsk/f05qt, ...
/dev/dsk/f03h, /dev/rdsk/f03h, ...
/dev/dsk/f03ht, /dev/rdsk/f03ht, ...
/dev/dsk/f03d, /dev/rdsk/f03d, ...
/dev/dsk/f03dt, /dev/rdsk/f03dt, ...
10/89 Page 3
fd(7) UNIX System V fd(7)
SEE ALSO
format(1), ioctl(2), hd(7).
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 where the error occurred, 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.
Page 4 10/89
fd(7) UNIX System V fd(7)
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.
10/89 Page 5