Subject: RE: proposal for MI floppy formatting
To: 'John Kohl' <jtk@kolvir.arlington.ma.us>
From: Adam Glass <adamg@microsoft.com>
List: tech-kern
Date: 11/17/1996 11:28:12
A question about the fdformat_result enumerator:

Why does it exist?  Isn't returning an appropriate code back from the
ioctl sufficient?  Seems like it is sufficient for every other ioctl I
can think of.

later,
Adam

>-----Original Message-----
>From:	John Kohl [SMTP:jtk@kolvir.arlington.ma.us]
>Sent:	Saturday, November 16, 1996 9:03 AM
>To:	netbsd-developers@netbsd.org; gwr@netbsd.org; is@netbsd.org;
>fvdl@netbsd.org; mycroft@netbsd.org; tech-kern@netbsd.org
>Subject:	proposal for MI floppy formatting
>
>MI floppy formatting proposal:
>$Id: proposal,v 1.2 1996/11/16 17:02:32 jtk Exp $
>
>Gordon Ross and Ignatios Souvatzis commented last month on my call for
>suggestions on floppy formatting.
>
>Gordon suggested a generic formatting interface with get/set and format
>commands, and suggested that we verify any interface is sufficiently
>flexible for SCSI floppy formatting.
>
>Ignatios explained how the amiga drivers work (essentially, all software
>magic); I think the interface below should work OK for an Amiga; it's
>more complicated than the simple "dd" that they can use for formatting
>but should be easily implementable for those drivers.
>
>So, here's my first draft proposal for floppy drivers, mostly pulled up
>from the existing i386 floppy formatting code.  I haven't a SCSI-2 spec
>to verify this with--can someone take a look and see if there are any
>additional parameters that could/should be passed in the fdformat_parms?
>
>Floppy diskette drivers provide the following IOCTLs:
>
>FDIOCSETFORMAT(struct fdformat_parms):
>	set formatting parameters, using 'struct fdformat_parms'
>	the driver saves this state and it persists while the device is open.
>
>FDIOCGETFORMAT(struct fdformat_parms):
>	fetch current formatting parameters into 'struct fdformat_parms'
>
>FDIOCFORMAT_TRACK(struct fdformat_cmd):
>	format a track on the medium, returning format results
>	[I chose a per-track format, since feedback during formatting a
>	disk is nice.  An alternative would be a list or range of
>	heads/cylinders to format, and an array of success/failure values for
>	each one.  Comments welcome]
>
>enum fdformat_result {
>	FDFORMAT_SUCCESS,
>	FDFORMAT_MEDIA_ERROR,		/* hardware reported a formatting
>					   error */
>	FDFORMAT_CONFIG_ERROR		/* something bogus in parameters */
>};
>
>struct fdformat_cmd {
>	int head;		/* IN */
>	int cylinder;		/* IN */
>	enum fdformat_result result;	/* OUT */
>};
>
>#define FDFORMAT_VERSION 19961116
>struct fdformat_parms {
>/* list of items taken from i386 formatting glop (NEC 765);
>   should be made the union of support needed for other devices. */
>    int fdformat_version;	/* rev this when needed; write drivers to
>				   allow forward compatibility, please,
>				   and add elements to the end of the
>				   structure */
>    int sector_shift;
>    int nbps;				/* number of bytes per sector */
>    int ncyl;				/* number of cylinders */
>    int nspt;				/* sectors per track */
>    int ntrk;				/* number of heads/tracks per cyl */
>    int stepspercyl;			/* steps per cylinder */
>    int gaplen;				/* formatting gap length */
>    int fillbyte;			/* formatting fill byte */
>    int xfer_rate;			/* in bits per second; driver
>					   must convert */
>};
>
>