 This package contains an updated version of the fdpatches which were
originally made by Heiko Schroeder. Moreover, I have added some new
features, and new formats, which allow you to fit even more data on your
floppy disks (up to 1992K on a high density 3 1/2 disk!!!) Some of these
formats may be read with appropriate utilities under MSDOS.
 This updated version is for linux 1.1.38

-----------------------------------------------------------------------------
WARNING
=======
 Although most drives are able to use 83 tracks, some may not. If your drive
is making strange noises while accessing these tracks, don't use those 
formats (13-19). (You may still gain something by the increased number of 
sectors)
-----------------------------------------------------------------------------

 After applying this patch you will be able to use formats with more than
the usual 18 (or 15) sectors per track, with more than 80 tracks (only for
drives which support this), and with bigger sectors.

I. New features:
================
 1. Every user with write-permission to the device may now change its
geometry (instead of just the superuser). The superuser may still
specify a maximal number of tracks allowed on a given drive, which can
not be overriden by "normal" users. I added some sanity checks for the
geometry parameters. (Number of sectors, heads and tracks must be
strictly positive.) This patch comes with a new mtools program which
uses this feature to set the geometry according to the geometry found
on the msdos bootsector...
 2. ... thus it is no longer necessary to autodetect formats with
more than the standard number of sectors. Autodetection of these
formats has now become option (option in make config)
 3. The autodetection sequence is now configurable via an ioctl.
 4. Arbitrary logical blocksizes (interface to fs code) can now be
handled. It should for instance be possible to use the floppy drive as
(slow) swap device.
 5. Physical sector sizes of 1024, 2048, 4096, 8192 and 16384 bytes
can now be handled (this gives us the 1826K HD and 3520 ED formats)
 6. Several sector sizes may be mixed on one track. (This gives us the
1992K HD and 3840 ED formats)
 7. Requests are now clustered. This is needed if you use a sector
size which is bigger than the logical blocksize. It doesn't speed up
operations on normal disks however :-(
 8. There is now support for two controllers (untested). If you want to try
this out, define HAVE_2_CONTROLLERS at the beginning of floppy.c
 9. Access to internal driver structures, and drive configuration
using the floppycontrol program.

New ioctls: 
===========

 All these ioctl's may be issued using the floppycontrol program. (See also
floppycontrols man page)

 1. FDGETDRVTYP displays the type of a drive (name parameter). This is
used by MAKEFLOPPIES. For the naming convention, see the description
of the MAKEFLOPPIES script. For formats which work in several drive
types, FDGETDRVTYP return a name which is appropriate for the oldes
drive type which supports this format.
 2. FDSETDRVPRM sets various drive parameters.
 3. FDGETDRVPRM reads these parameters back.
 4. FDGETDRVSTAT gets the cached drive state (disk changed, write
protected et al.)
 5. FDPOLLDRVSTAT polls the drive and return its state.
 6. FDGETFDSTAT gets the floppy controller state.
 7. FDRESET resets the floppy controller under certain conditions.
 8. FDRAWCMD sends a raw command to the floppy controller.

 Floppypatches 2 already introduced some new ioctls. These are still
available, but their use is discouraged (read they might disappear in
the next version), as the parameters they get/set are included in the
drive state.
 I didn't get around to writing the documentation to these calls yet,
but a lot can be figured out from floppycontrol's man page.


II. Bug fixes:
==============
 1. When the user specified a geometry with 0 sectors or heads and
then tried to read from the disk, a "division by zero error" occured
in the kernel, and some locks were not released correctly. I added
a sanity checks to make FDSETPRM fail under this condition. I added
a similar checks for the number of tracks.  This bug is fixed now.
 2. I added a check to the open routine to make sure the minor device
number corresponds to an existing format.
 3. Logical block sizes other than 1k are now supported. Thus, it is
now possible (altho slow) to swap on a floppy disk.
 4. This floppy driver now handles absent disks or drives more
gracefully.

 The new formats
 ===============

 Some formats use more than 80 tracks. It is not possible for the
kernel to autodetect the number of tracks in a reasonable time, so you
have to use the mtools coming with this package to set the number of
tracks according to the boot sector of the disk. (This doesn't
obviously work with disks containing something else than a MSDOS
filesystem)

 After recompiling your kernel and rebooting, you can use a few more
minor device numbers for disks with the new formats.  The minor device
number for the floppy devices is calculated as follows:
    minor_device = format_nr * 4 + 128 * fdc_nr + unit_nr 
 (fdc_nr identifies the floppy disk controller, and unit_nr identifies
which drive on the floppy disk controller to be used)

The major device number is 2. The format_nr is the number of the entry
in the table in floppy.c. Valid numbers and formats are:

             format_nr     Format
             ---------     ------
                  0        autodetect
                  1        360kB,  5.25" DD drive
                  2        1200kB, 5.25" HD drive
                  3        360kB,  3.5"  DD drive (fixed)
                  4        720kB,  3.5"  DD drive
                  5        360kB,  5.25" DD disk in HD drive
                  6        720kB,  5.25" DD disk in HD drive
                  7        1440kB, 3.5"  HD drive
                  8        2880kB, 3.5"  ED drive
                  9        2880kB, 3.5"  ED drive (obsolete since pl30)

                 10        1440kB, 5.25" HD drive
                 11        1680kB, 3.5"  HD drive
                 12        410kB,  5.25" DD disk in HD drive (fixed)
                 13        820kB,  3.5"  DD drive (fixed)
                 14        1476kB, 5.25" HD drive
                 15        1722kB, 3.5"  HD drive
                 16        420kB,  5.25" DD disk in HD drive (fixed)
                 17        830kB,  3.5"  DD drive
                 18        1494kB, 5.25" HD drive
                 19        1743kB, 3.5"  HD drive

                 24        1760kB, 3.5"  DD drive
                 24        1760kB, 3.5"  DD drive
                 23        1600kB, 5.25" HD drive
                 24        1760kB, 3.5"  HD drive
                 25        1920kB, 3.5"  HD drive
		 26	   3200kB, 3.5"  ED drive
		 27	   3520kB, 3.5"  ED drive
		 28	   3840kB, 3.5"  ED drive
		 29	   1476kB, 5.25" HD drive
		 30	   1494kB, 5.25" HD drive
		 31	   1600kB, 5.25" HD drive

 The formats 0..8 are standard, 9 was in pl23-pl29 and is apparently
needed for certain CompaQ computers, 10..19 are the extensions from
this patch with normal sized sectors (taken from Heiko Schroeder's
original fdpatches), and 20..29 are formats with bigger sectors, added
by David and me. Formats 26-28 are ED formats with bigger sectors.
Formats 30 and 31 are non-interleaved formats with normal sized
sectors, and have the highest capacity that can be achieved without
resorting to interleaving or bigger sectors.
 BEWARE OF FORMATS 13-19 IF YOUR DRIVE ONLY SUPPORTS 80 TRACKS.

 Formats 3, 12, 13, 17 and 18 were buggy. 
 3 used stretch=1 double sided instead of stretch=0 single sided (there were
never 40-track 3.5" drives. Thus stretch != 0 doesn't make sense for a
3.5" disk)

 12 and 16 used a transfer rate of 250Kb/s and stretch=1 in Heiko's patches.
Now they use 300Kb/s as it should be.

 13 and 17 used a transfer rate of 300Kb/s in Heiko's patches. Now they use
250KB/s as it should be. However, the old formats worked on 5.25 disks, and
some people might use them for this purpose. If that is your case, just
change their rate field back to 1. (Using setfdprm, or by editing the 
floppy_type structure)

 Formats 8 and 9 were buggy in Heiko's patches too, and since pl23 they are
used for the ED drives.

 You can redefine these formats using the setfdprm program (Included
in the major distributions (Slackware...)). 

 To use the new formats, you have to make new /dev/fd* entries, using the
MAKEFLOPPIES shell script.

You may also make the devices manually: (This is needed if you redefine
your default formats using setfdprm)

Example:
   Make a device entry for a 1.74MB floppy in drive 0:
   The format number is 19, drive 0, floppy disk controller 0 so 
   the minor device number is 128*0+4*19+0=76. The command line to make 
   the new device entry is:
          mknod /dev/fd0H1743 b 2 76
                   ^          ^ ^ ^
                   |          | | Minor device number
                   |          | Major device number (always 2!)           
                   |          Blockdevice
                   A name that you choose for the format. I
		   recommend the names I used in floppy.c, but
                   you can choose any name you want.


I hope this description helps installing the patches. 

 Using more than 80 tracks:
 ==========================

 Although most drives support more than 80 tracks some may not, and
repeatedly trying to read beyond track 80 might be damaging to them.
In order to know wether your drive supports more than eighty tracks,
first set the number of allowed tracks to 82.
(using floppycontrol --tracks 82 -d <drive>)
 Then format a disks with a 82 track format (for example
/dev/fd0H1722), and copy a file on it large enough to fill the disk it
completely. (Many small files will do too. The disk is full enough if
the free space is less than a track, in this case 18k) Then eject and
reinsert the disk, and compare the file on the disk with the
original. If they are still the same, your drive supports 82
tracks. (If yes, you might want to try also with 83 tracks: /dev/fd0H1743))
 (This single experience should not damage the drive.)
 If you do have a drive which supports more than 80 tracks, you have
to enable the additional tracks after each boot, for instance by
calling floppycontrol --track 82 from your /etc/rc.local in order to
allow programs to use these tracks. (Alternatively, you could also
change it in the default_drive_params structure)
 If your drive doesn't support more than 80 tracks, please remove the
entries for formats 13-19 from your /dev directory after running
MAKEFLOPPIES.

 N.B. I have yet to see a 3.5" drive which doesn't support 82 tracks.
If you have such a beast, please mail me.

 Included utilities:
 ===================

 1. mtools. This version of mtools configures the geometry according
to the on found in the boot sector. It also supports formats with bug
sectors, and 2m formats.
 The mtools program that comes with fdpatches reads the bootsector of
msdos disks and automatically sets the geometry according to the one
found in the bootsector. It is based on mtools-2.0.7.
 I added some other new features to it, see mtools/Release.Notes
for details.
 You can use this new mtools without the fdpatches (in that case, it
doesn't adjust the geometry and can't handle the formats with bigger
sectors, but you still will get the other features.)
 The file mtools/Configure contains more information about mtools.

 2. floppycontrol. This program sets the various error tresholds
(error reporting, operation abortion, and read track), prints out
drive drive types, and flushes buffers. There is a -h help option.
 This program provides examples on how to use the new ioctl's.
 
 To compile this program just type make in the util directory.

 Floppycontrol must be recompiled whenever you change any options
relevant to fdpatches in the kernel make config.

 See also the included manpage.

 2. MAKEFLOPPIES. This shell script creates the new floppy block
device files.  It uses the floppycontrol program to translate the
minor device numbers into meaningful names. It also uses these names
to decide wether to create a given block device file or not, depending
on the type of the physical drive (for instance, for a 3 1/2 drive,
the formats corresponding to a 5 1/4 drive are not created).
 If you have more than two floppy drives, the kernel cannot find out
the types of these additional drives, and you need to specify them
with the environmental variables FD2 and FD3. The following types are
available: H1440 ( HD 3''1/2), h1200 (HD 5''1/4), D720 (DD 3''1/2) and
d360 (DD 5''1/4).
 Sample command line:
  FD2=1.44M FD3=1.2M MAKEFLOPPIES

 The names of the device are a letter describing the _drive_ types,
followed by a letter describing the size of the _format_.
The letters are
 E = 3.5"  ED drive
 H = 3.5"  HD drive
 D = 3.5"  DD drive
 h = 5.25" HD drive
 d = 5.25" DD drive

 Example: h360 is a device for accessing a 360k disk in a 5.25" HD drive.

 This convention is the same as used by Slackware and the MAKEDEV script,
except for the ED drives (which are named H2880 by MAKEDEV, and don't yet
exist in Slackware)

 IMPORTANT: The MAKEFLOPPIES script needs the floppycontrol program on
the search PATH.

 Formatting disks with bigger sectors:
 =====================================

 To format disks with bigger sectors, you can't use fdformat. Use
superformat instead (included in this package, with man
page). (fdformat still can format disks with 512 byte sectors)

 Reading these disks under dos:
 ==============================

 *formats with normal sector sizes: (10..19)
 	There are zillions of utilities which are able to read these:
		fdformat, vgacopy, ...

	With dos6, you don't even need those, just put the following
	line in your config.sys:

		drivparm=/d:0 /f:7 /h:2 /s:21 /t:82
			    ^    ^ \______________/
			    |    |          |
                 drive number    |       max geometry
                                 |
			drive type, consult the dos help for details



 *formats with bigger sectors:
	There is only one utility which can do this: 
	2m20 (by Ciriaco Garcia)
	You can get this program from 
	nic.switch.ch:/mirror/msdos/diskutil/2m20.zip
	(for other adresses, see archie)	

	This program uses a normal format for the first track and first head
	(18 sectors), and enhanced formats for the other tracks (up to
	24*512 bytes per track !)
	See the manpage of superformat (option --2m) to know how to
	format disks readable by this program.

 Other Doc:
 ==========

 There are man pages for mtools and the utilities included. There's
also a FAQ list. It is regularily updated on
ftp.imag.fr:pub/ZLIBC/fdpatches/ALPHA. In the same directory, you can
find alpha versions of fdpatches too. (They are named fdpddmm.taz,
where dd stands for the day and mm for the month. I'll only leave
these in for a month, and then move them into an old directory, or
remove them.)
