fdsk(7) DEVICES AND MODULES fdsk(7)
NAME
fd - NEWS floppy disk interface
DESCRIPTION
The fd interface provides accesses to an internal 3.5"
microfloppy disk unit and/or an external floppy disk unit
(available only for provided workstations). Internal disk
unit has the capability of both accessing a 2DD type
(double-tracked, double-sided and double-density) and 2HD
type (double-tracked, double-sided and a High-density)
soft-sectored floppy disk. Device whose filename starting
with "r" indicates a raw device (major number 5), and others
are block device (major number 1).
Multiple Format Function
NWS-1200/1400/1700/3200/3400/3700,PWS-1500/1600 Series
models supports multiple format functions which allow to
access different fomats of the media. Each disk unit has
eight device names with different minor numbers. The pro-
vided device driver enables the user to select a desired
disk format from multiple formats. That is, each unit is
assigned 8 minor device numbers, which allows the user to
select a desired disk format from eight formats by changing
device names. This function is not supported in NWS-
800/900/1800/1900/3800 Series models.
External Floppy Disk Unit
In addition to the internal disk unit, the NWS-
1400/1700/3400/3700, PWS-1500/1600 series models provide an
interface for the external 3.5"/ 5.25"/ 8" floppy disk unit
of the NEC PC-9800 series personal computers.
Auto Eject Function
NWS-1200/3200/3400/3700/3800 Series models controlls an
eject operarion of the media with software to avoid removing
the media out from the disk drive unit while the device is
open. Use ioctl to eject the media when the last open pro-
cess closes the device. This function is called as eject on
close.
Multiple Format non-supported Workstations
By changing special device minor numbers, the following two
differnt formats are available for the NEWS workstations
which do not support multiple format functions
devices minor# type bytes s# h# c# format capacity record
rfh0a,fh0 0 FD2HD 512 18 2 80 E/I 1440KB MFM
rfd0a,fd0 8 FD2DD 512 9 2 80 E/I 720KB MFM
bytes: sector size, s#: number of sectors, h#: number of heads(sides)
c#: number of cylinders, E/I: ECMA/ISO
1
fdsk(7) DEVICES AND MODULES fdsk(7)
Multiple Fomat Provided Workstations
The provided device driver enables the user to select a
desired disk format from the defined multiple format types.
In addition, the user can use the ioctl to change various
FDC parameters for the format control. That is, each unit
is assigned 8 minor device numbers. These 8 devices with
different minor numbers are set as one of the following for-
mat types as defaults.
Format Type
The following 13 format types are defined in the system.
type# type bytes s# h# c# format capacity record rpm SW
0 FD2DD 512 9 2 80 E/I 720KB MFM - 640KB
1 FD2HD 512 18 2 80 E/I 1440KB MFM 300
2 FD2HD1024 1024 8 2 77 IBM 1232KB MFM 360 1MB
3 FD2DDMS9 512 9 2 80 IBM 720KB MFM - 640KB
4 FD2DDMS8 512 8 2 80 IBM 640KB MFM - 640KB
5 FD2DMS9 512 9 2 40 IBM 360KB MFM - 640KB
6 FD2DMS8 512 8 2 40 IBM 320KB MFM - 640KB
7 FD2HDPS 512 18 2 80 IBM 1440KB MFM 300
8 FD2HCAT 512 15 2 80 IBM 1200KB MFM 360 1MB
9 FD2DDOA 1024 5 2 77 IBM 770KB MFM - 640KB
10 FD2DDOA0 256 16 2 77 IBM 616KB MFM - 640KB
11 FD1S128 128 26 1 77 IBM 250KB FM 360 1MB
12 FD2D256 256 26 2 77 IBM 1001KB MFM 360 1MB
rpm: Spindle motor rotation speed of 3.5inch drive using 2HD
media
SW: Position of density selection switch on the back panel
NOTES
A 3.5" disk drive for 2 HD media supports the two types of
rotational speeds: 300 rpm (revolutions per minutes) and
360 rpm. An internal disk drive unit uses 300 rpm and an
external NEC disk drive unit uses 360 rpm. You cannot use
360 rpm format disk on 300 rpm type disk drive, and vice
versa. The user need to select a suitable fomat type from
the disk fomat types shown above.
If you are to employ an NEC disk drive unit, set the drive
unit selection SW to 3/4.
The hardware function of the internal 3.5" microfloppy disk
unit supports the read operation to a 2D floppy disk. How-
ever, it does not support the write access to that type of
floppy disk.
A request on a block device unit does not succeed if the
sector size is set to bigger than 512 bytes. The user need
to request the sector boundary at lseek time for raw dev-
ices. When the size of the sector is less than 512 bytes,
2
fdsk(7) DEVICES AND MODULES fdsk(7)
the user need to request lseek at 512 byte boundary.
Special Devices and its initial format
The following format types are set as defaults for each dev-
ice.
special devices minor# type type# Remarks
[inner drive]
rfd00a/fd00a 0 FD2HD 1 same as rfh0a/fh0
rfd01a/fd01a 8 FD2DD 0 same as rfd0a/fd0
rfd02a/fd02a 16 FD2DDMS9 3
rfd03a/fd03a 24 FD2DDMS8 4
rfd04a/fd04a 32 FD2DMS9 5
rfd05a/fd05a 40 FD2DMS8 6
rfd06a/fd06a 48 FD2HDPS 7
rfd07a/fd07a 56 FD2DDOA 9
[external drive #3]
rfd20a/fd20a 128 FD2HD1024 2
rfd21a/fd21a 136 FD2DDOA 9
rfd22a/fd22a 144 FD2DDMS9 3
rfd23a/fd23a 152 FD2DDMS8 4
rfd24a/fd24a 160 FD2DMS9 5
rfd25a/fd25a 168 FD2DMS8 6
rfd26a/fd26a 176 FD1S128 11
rfd27a/fd27a 184 FD2D256 12
[external drive #4]
rfd30a/fd30a 192 FD2HD1024 2
rfd31a/fd31a 200 FD2DDOA 9
rfd32a/fd32a 208 FD2DDMS9 3
rfd33a/fd33a 216 FD2DDMS8 4
rfd34a/fd34a 224 FD2DMS9 5
rfd35a/fd35a 232 FD2DMS8 6
rfd36a/fd36a 240 FD1S128 11
rfd37a/fd37a 248 FD2D256 12
Disk with Special Formats
Specify the disk drive unit as a raw device when using dif-
ferent format types for each track. Unexpected errors may
happen when a user specifies this as a block device because
accesses between buffer cache in a block device do not act
in the same way as the system call request.
First, set parameters for the FDC in accordance with the
format of a disk block to be accessed. The lseek operation
can be then started on the assumption that the format of
that disk block can apply to the whole disk space. During
the lseek operation, the skipped blocks (to be accessed) are
not actually accessed.
Here is an example of how to access 8" disk drive unit with
IBM format.
3
fdsk(7) DEVICES AND MODULES fdsk(7)
cyl# track# sec# type Access
0 0 1-26 FD1S128 lseek(0byte),read(128 * 26 bytes)
0 1 1-26 FD2D256 lseek(256 * 26 byte),read(256 * 26 bytes)
Write Protect Check of Media
User can't write-open write-protected media, because
device-driver checks media's write-protect notch while open-
ing the device.
IOCTL
In this section, the ioctl command is detailed. The follow-
ing header files should be included in the application pro-
gram:
#include <news800iop/fdreg.h> NWS-800/900 series
#include <news1800iop/fdreg.h> NWS-1800/1900 series
#include <newsiop/fdreg.h> NWS-3800 series
#include <newshbdev/fdc.h> NWS-1200/1400/1700/3400,PWS-1500/1600
series
IOCTL common to all NEWS
The following ioctl can be used for all NEWS workstations.
FDIOCFORMAT
The FDIOCFORMAT is used to format a specified track of
the floppy disk to be accessed.
int track;
ioctl(fd, FDIOCFORMAT, &track);
IOCTL for supporting multiple format function
The following ioctl can be used only for those NEWS worksta-
tions which support multiple fomat functions.
FDIOCSET
FDIOCGET
These functions are used to set and view FDC parameters
of the specified device file.
The sx2 flag is used to perform the seeking on every
other cylinder. If you are to make an access to a 2D
type floppy disk (5/3.5"), set this flag to '1'. Note
that the cylinder-to-cylinder space of a 2D type floppy
disk is twice that of a 2DD/2HD type floppy disk.
If the seek operation is carried out to cylinder 17
with the sx2 flag set to '1', cylinder 34 on a 2DD/2HD
floppy disk will be reached.
Generally if a 2D type floppy disk is driven by a
4
fdsk(7) DEVICES AND MODULES fdsk(7)
2DD/2HD floppy disk drive unit (called a high-density
drive), the read operation between them will be
guaranteed. That is, the data written into the 2D type
floppy disk by the 2D floppy disk drive unit can be
read by the 2DD/2HD drive unit. However, the data writ-
ten into the 2DD/2HD type floppy disk by the high-
density drive may not be read by the 2D disk drive.
NOTE 1
If the NEWS internal floppy disk drive unit (unit 0) is
accessed, the EXT_VFO mode cannot be specified.
NOTE 2
If the 8" floppy disk drive unit is to be used, the
cylinder number exceeding 77 should not be specified.
FDCparam fdcp;
ioctl(fd, FDIOCSET, &fdcp);
ioctl(fd, FDIOCGET, &fdcp);
typedef struct FDCpram{
int nsect; /* # sectors/track */
int ntrak; /* # tracks/cylinder */
int ncyl; /* # cylinders */
int nbytes; /* # byts/sector/(fd_length) */
int n; /* sector length code(fd_n) */
int gsl; /* GSL */
int gpl; /* GPL */
int mf; /* mfm mode(1=MFM,0=FM) */
int ninterl; /* interleave(fd_interleave) */
int trspd; /* tarnsfer speed */
int fomt; /* format(ECMA_ISO,IBM) */
int vfomode; /* VFO mode(ext=1/int=0) */
int srt; /* SRT */
int hut; /* HUT */
int hlt; /* HLT */
int sx2; /* seek doublly flag */
int widd; /* write-id data */
}FDCparam;
#define MFM 1
#define FM 0
#define IBM 0
#define ECMA_ISO 1
#define EXT_VFO 1
#define INT_VFO 0
5
fdsk(7) DEVICES AND MODULES fdsk(7)
FDIOCSELECT
The FDIOCSELECT is used to specify a floppy disk format
type from the format types listed above. The selected
format type parameter will be set in FDC.
int type;
icotl(fd, FDIOCSELECT, &type);
FDIOCRESTORETYPE
The FDIOCRESTORETYPE is used to re-initialize the for-
mat control parameters for a specified device file.
ioctl(fd, FDIOCRESTORETYPE, 0);
FDIOCREADID
The FDIOCREADID is almost the same as the READID com-
mand of FDC. FDIOCREADID seeks a specified cylinder
first and then starts the READID command. Note that the
seek operation to that cylider is carried out normally
(as in case of a 2DD/2HD floppy disk). Note that this
seek operation is performed, irrespective of the sx2
flag specification.
The c, h, r, and n values of the first sector of an
accessed cylinder are returned. The return value will
be '0' if the read operation has terminated success-
fully. Otherwise, the value will be nagative.
As the seek operation is carried out in the above
manner, you can use the return values from cylinders
with odd numbers except for '0' to determine whether
the floppy disk now being accessed is a 2DD or 2D type
one. The relationship between a specified cylinder and
return value res_c is as follows:
2DD cylinder == res_c
2D cylinder == res_c * 2
FDCid fdcid;
ioctl(fd, FDIOCREADID, &fdcid);
typedef struct FDCid{
int cylinder; /* physical cylinder # */
int head; /* head */
int res_c; /* result: cylinder */
int res_h; /* result: head */
int res_r; /* result: sector */
int res_n; /* result: rec length code */
}FDCid;
6
fdsk(7) DEVICES AND MODULES fdsk(7)
IOCTL in order to support Auto Eject Function
MTIOCTOP
Set the internal disk drive unit to eject on close.
#include <sys/mtio.h>
struct mtop mt;
mt.mt_op = MTOFFL;
ioctl(fd, MTIOCTOP, &mt);
ERRORS
If a system call ends with an error, it returns -1 and the
following values are set in the errno (gloval variable).
Therefore, the user can identify what has caused the error
by viewing the content of that area.
#include <sys/errno.h>
extern int errno;
[ENXIO] The illegal 'open' system call has been issued.
The system call with an incorrect unit number may be used.
[EIO] The floppy disk drive is not active.
This error is detected if the floppy disk media has not
been mounted on the drive unit at the open system call.
[EACCES] User has made a write operation / write open
to the write-protected disk.
[EINVAL] The format parameters have not been specified.
Incorrect arguments were used in an ioctl.
[EFAULT] The seek operation terminated unsuccessfully.
Or IDs could not be read normally.
Note that related error messages will be logged in the sys-
tem log if the EFAULT, EACCES and EIO are set in the errno
area at read/write/format operation.
FILES
/dev/fh0 /dev/rfh0a
/dev/fd0 /dev/rfd0a
/dev/fd[0-3][0-7]a /dev/rfd[0-3][0-7]a
SEE ALSO
format(8), newfs(8), mkfs(8), tar(1)
BUGS
When you remove a mount(8)ed floppy disk from a drive unit,
you have to execute the umount(8) command in advance.
7