DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fd(7)


fd -- floppy disk driver

Description

The floppy disk driver provides access to floppy disk drives as both block and character devices. Floppy disks must be formatted before their use (see format(1M)). Both 5.25- and 3.5-inch floppy disk formats are supported. The driver controls up to two floppy disk drives. The minor device number specifies the drive number, the format of the floppy disk, and the partition number.

Usage

Floppy disk device filenames (which correspond to a specific major and minor device) use the following format:

/dev/{r}dsk/f{0,1}{5h,5d16,5d9,5d8,5d4,3e,3h,3m,3n,3d}{t,u}

r indicates a raw (character) interface to the floppy disk, 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, f1 selects drive 1. The following list describes the format to be interacted with:


5h
5.25" high density floppy disk (1.2MB)

5d16
5.25" double density floppy disk, 16 sectors per track (320KB)

5d9
5.25" double density floppy disk, 9 sectors per track (360KB)

5d8
5.25" double density floppy disk, 8 sectors per track (320KB)

5d4
5.25" double density floppy disk, 4 sectors per track (320KB)

3e
3.5" extra high density floppy disk (2.88MB)

3h
3.5" high density floppy disk (1.44MB)

3d
3.5" double density floppy disk (720KB)

3m
3.5" medium density floppy disk (1.2MB)

3n
3.5" double density floppy disk (720KB)

3c
3.5" high density floppy disk (1.72MB)

The 3m disk is also known as the Japanese medium density. It is double sided. The 3c disk is used for Microsoft DMF reading under Merge installations. Not all of the floppy drivers will work in all machines.

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 automatically determines the format previously established on the floppy disk and then performs 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 floppy disk, and u represents the whole floppy disk except track 0 of cylinder 0 and applies only to the 5d8 type of floppy. Without t or u specified, the whole floppy disk except cylinder 0 will be selected.

Besides the device file naming convention described above, some of the formats have alias names that correlate to previous releases. The following table describes the formats that have an alias:

Format Alias
5h q15d
5d8 d8d
5d9 d9d

 Format   Alias
 5h       q15d
 5d8      d8d
 5d9      d9d

For example, the device file /dev/rdsk/f0q15dt is equivalent to /dev/rdsk/f05ht.

ioctl calls

The following are the ioctl(2) calls specific to fd:

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 {
	char	dp_type;	/* Disk type (see below) */
	unchar	dp_heads;	/* Number of heads */
	ulong	dp_cyls;	/* Number of cylinders */
	unchar	dp_sectors;	/* Number of sectors/track */
	ushort	dp_secsiz;	/* Number of bytes/sector */
				/* for this partition: */
	ushort	dp_ptag;	/* Partition tag (not used) */
	ushort	dp_pflag;	/* Partition flag (not used) */
	ushort	dp_pstartsec;	/* Starting sector number */
	ushort	dp_pnumsec;	/* Number of sectors */
}

/* Disk types */ #define DPT_WINI 1 /* Winchester disk */ #define DPT_FLOPPY 2 /* Floppy */ #define DPT_OTHER 3 /* Other type of disk */ #define DPT_NOTDISK 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 floppy disk driver allows programs to be written that can understand either one.


NOTE: To support disks with more than 65535 cylinders, the definition of the dp_cyls member has been changed from a ushort to a ulong in UnixWare® 7. Consequently, legacy applications that use the V_GETPARMS ioctl or the disk_parms structure will need to be recompiled to run on UnixWare 7 and later releases.


V_FORMAT
This call is used to format tracks on a floppy disk. 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 {
		ushort	start_trk;	/* first track */
		ushort	num_trks;	/* number of tracks to format */
		ushort	intlv;		/* interleave factor */
	} ia_fmt;
}
Formatting starts at the given track and continues so that the given number of tracks are formatted, using the given interleave factor.


NOTE: 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 (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/f05q, /dev/rdsk/f05q...

/dev/dsk/f05qt, /dev/rdsk/f05qt...

/dev/dsk/f05d16, /dev/rdsk/f05d16...

/dev/dsk/f05d16t, /dev/rdsk/f05d16t...

/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/f03e, /dev/rdsk/f03e...

/dev/dsk/f03et, /dev/rdsk/f03et...

/dev/dsk/f03h, /dev/rdsk/f03h...

/dev/dsk/f03ht, /dev/rdsk/f03ht...

/dev/dsk/f03m, /dev/rdsk/f03m...

/dev/dsk/f03mt, /dev/rdsk/f03mt...

/dev/dsk/f03n, /dev/rdsk/f03n...

/dev/dsk/f03nt, /dev/rdsk/f03nt...

/dev/dsk/f03d, /dev/rdsk/f03d...

/dev/dsk/f03dt, /dev/rdsk/f03dt...

Diagnostics

To minimize errors when using floppy disks, the driver attempts to assure that the floppy disk 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 floppy disk each time a read or write request is made to the drive. If this is not true (either the floppy disk is not physically present or the door is open), the driver retries the request continually, at five-second intervals. The following message appears after each attempt, where n is the drive number:
   FD(n): floppy disk not present - please insert
The INTR and QUIT signals are honored in this case, so that the process accessing the floppy disk drive in question receives these signals (unless, of course, the process itself is ignoring them). In particular, if the floppy disk is removed prematurely, or not inserted soon enough, no data is lost, provided the correct floppy disk is inserted in the drive when the message to do so is displayed.

If the above message appears, do the following:

  1. Use idtune(1M) to set FD_DOOR_SENSE to 0.

  2. Unload the floppy driver by entering modadmin -U fd (see modadmin(1M)).

  3. Rebuild the floppy driver by entering idbuild -M fd (see idbuild(1M)).

  4. Reload the floppy driver by entering modadmin -l fd.

  5. Retry the floppy access.

The driver retries failed transfers up to ten times. If the request still has not succeeded, the driver displays an appropriate message. Errors from the floppy disk 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. n is the drive where the error occurred, and b is the block number that is being read or written. drive_error_message is one of the following:

Missing data address mark
The floppy disk might 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 floppy disk might not be formatted properly.

Write protected
A write was attempted to a floppy disk that is currently write-protected.

Sector not found
The floppy disk might not be formatted properly.

Data overrun
The system could not keep up with the requested transfer of data. (This error should not occur.)

Header read error
The floppy disk might not be formatted properly.

Illegal sector specified
The driver is confused about the format of the floppy disk that has been inserted. (This error should not occur.)

The second message occurs when there is a controller error during the setup for, or actual transfer of, a block. controller_error_message is one of the following:


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.

References

format(1M), ioctl(2)
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004