On Mon, 1 Apr 2002, Joerg Wunsch wrote:

> fdioctl() historically attempted to determine the "raw" partition
> (`c') of the device in order to read the label.  However, the floppy
> driver never really supported UFS-style partitions anyway.  This ended
> up in selecting the wrong device for reading the label, which was a
> not-so-fatal error before the last floppy driver rewrite (it actually
> selected the fdX.1480 device then, which was obviously benign for 3.5"
> drives).  However, now it hits an unitialized device which becomes


> fatal in readdisklabel() by attempting an indirect call to the
> strategy routine that hasn't been entered in the struct dev passed
> down.

> The call to dkmodpart() entered in rev. 1.64 of fd.c, so i'm Cc'ing
> Bruce for a comment whether the fix below is indeed TRT.
> Index: sys/isa/fd.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/isa/fd.c,v
> retrieving revision 1.224
> diff -u -r1.224 fd.c
> --- isa/fd.c  18 Dec 2001 22:16:33 -0000      1.224
> +++ isa/fd.c  1 Apr 2002 20:56:22 -0000
> @@ -2704,7 +2704,7 @@
>               fdt = fd->ft;
>               lp->d_secpercyl = fdt->size / fdt->tracks;
>               lp->d_type = DTYPE_FLOPPY;
> -             if (readdisklabel(dkmodpart(dev, RAW_PART), lp) != NULL)
> +             if (readdisklabel(dev, lp) != NULL)
>                       error = EINVAL;
>               else
>                       *(struct disklabel *)addr = *lp;

I think this is the right fix.  The `dk' macros don't apply to the floppy
driver since it doesn't use the disk or diskslice layer.  This one probably
escaped from my version which optionally uses the diskslice layer.  Sorry.
You probably remmeber the "Trick diskerr()" stuff.  That was for related

I had to fix this better for the slice case.  The problem is that dkmodpart()
gives a half-baked device struct.  It used to just modify the minor number,
and everything that deals with the minor number handled weird ones reasonably.
Even fd handled them as reasonably as possible (fdX.1480 was perfect GIGO).

BTW, device cloning seems to work wrong for fd:

Script started on Wed Apr  3 02:16:43 2002
ttyp1:bde@besplex:/tmp> ls /dev/fd0c
ls: /dev/fd0c: No such file or directory
ttyp1:bde@besplex:/tmp> ls /dev/fd0c
ttyp1:bde@besplex:/tmp> exit

Script done on Wed Apr  3 02:16:55 2002


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to