Re: disklabel(8) floppy panic

2002-04-03 Thread Bruce Evans

On Tue, 2 Apr 2002, Joerg Wunsch wrote:

 As Bruce Evans wrote:

  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
  /dev/fd0c@
  ttyp1:bde@besplex:/tmp exit

 I can also see this.  IMHO, that's an artifact of how device on-demand
 alias creation is working.  Cc to Poul-Henning, maybe he can shed some
 light on this.

 Ah, hmm, i think that's a problem of ls -F, actually.  Look here.

 j@uriah 90% ls -l /dev/fd1*
 crw-r-  1 root  operator9,  64 Apr  1 22:37 /dev/fd1
 j@uriah 91% /bin/ls /dev/fd1c
 /dev/fd1c
 j@uriah 92% ls -l /dev/fd1*
 crw-r-  1 root  operator9,  64 Apr  1 22:37 /dev/fd1
 lrwxr-xr-x  1 root  wheel4 Apr  2 20:34 /dev/fd1c@ - fd0

 Plain /bin/ls (without any options) works as expected.

You are right that I forgot to use plain ls.  I have ls aliased to ls -Fg
(the g tells how long it is since I changed this :-).  I also tried a
stat utility.  It failed like ls.  I just tried cat.  It failed in the
same way.

Plain ls works accidentally by first doing a stat() which fails except for
creating a directory entry; ls then does a successful lstat().

This seems to be a bug in the fd driver.  ls -F works the first time
on nonexistent partitions.  But it should only work on devices that
exist.  fd0a and fd0c may need to exist for compatibility, but shouldn't.
fd0b and fd0[d-h] just shouldn't exist.

Bruce


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



Re: disklabel(8) floppy panic

2002-04-03 Thread Bruce Evans

On Wed, 3 Apr 2002, I wrote:

 ...
 This seems to be a bug in the fd driver.  ls -F works the first time
 on nonexistent partitions.  But it should only work on devices that
oops:  ^ on devices that go through the disk layer
 exist.  fd0a and fd0c may need to exist for compatibility, but shouldn't.
 fd0b and fd0[d-h] just shouldn't exist.

Bruce


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



Re: disklabel(8) floppy panic

2002-04-03 Thread Joerg Wunsch

As Bruce Evans wrote:

 On Wed, 3 Apr 2002, I wrote:
 
  ...
  This seems to be a bug in the fd driver.  ls -F works the first time
  exist.  fd0a and fd0c may need to exist for compatibility, but shouldn't.
  fd0b and fd0[d-h] just shouldn't exist.
 
 Bruce
 

As Bruce Evans wrote:

 This seems to be a bug in the fd driver.  ls -F works the first time
 on nonexistent partitions.  But it should only work on devices that
 oops:^ on devices that go through the disk layer
 exist.

I have not much clues about how make_dev_alias(9) and NAMI lookups
are stacked here.  I've simply taken phk's code (for the aliases, it
should be functionally identical to phk's version, i only had to
rewrite the non-alias device creation).

  fd0a and fd0c may need to exist for compatibility, but shouldn't.
 fd0b and fd0[d-h] just shouldn't exist.

Hmm, they all used to be in /dev/MAKEDEV.  IMHO, all of them can go
away, but i didn't want to force too much of my opinion onto others
here. :)

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

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



Re: disklabel(8) floppy panic

2002-04-03 Thread Joerg Wunsch

Brandon S. Allbery  KF8NH [EMAIL PROTECTED] wrote:

 lrwxr-xr-x  1 root  wheel4 Apr  2 20:34 /dev/fd1c@ - fd0
 
 Uh?

Interesting that you spooted /that/. :-)

OK, gonna fix it...

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

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



Re: disklabel(8) floppy panic

2002-04-02 Thread Bruce Evans

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

Yikes.

 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 -  1.224
 +++ isa/fd.c  1 Apr 2002 20:56:22 -
 @@ -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
things.

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
/dev/fd0c@
ttyp1:bde@besplex:/tmp exit

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

Bruce


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



Re: disklabel(8) floppy panic

2002-04-02 Thread Joerg Wunsch

As Bruce Evans wrote:

 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
 /dev/fd0c@
 ttyp1:bde@besplex:/tmp exit

I can also see this.  IMHO, that's an artifact of how device on-demand
alias creation is working.  Cc to Poul-Henning, maybe he can shed some
light on this.

Ah, hmm, i think that's a problem of ls -F, actually.  Look here.

j@uriah 90% ls -l /dev/fd1*
crw-r-  1 root  operator9,  64 Apr  1 22:37 /dev/fd1
j@uriah 91% /bin/ls /dev/fd1c
/dev/fd1c
j@uriah 92% ls -l /dev/fd1*
crw-r-  1 root  operator9,  64 Apr  1 22:37 /dev/fd1
lrwxr-xr-x  1 root  wheel4 Apr  2 20:34 /dev/fd1c@ - fd0

Plain /bin/ls (without any options) works as expected.
-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

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



Re: disklabel(8) floppy panic

2002-04-02 Thread Brandon S. Allbery

On Tue, 2002-04-02 at 13:35, Joerg Wunsch wrote:
 j@uriah 92% ls -l /dev/fd1*
(...)
 lrwxr-xr-x  1 root  wheel4 Apr  2 20:34 /dev/fd1c@ - fd0

Uh?

-- 
brandon s allbery [openafs/solaris/japh/freebsd] [EMAIL PROTECTED]
system administrator [linux/heimdal/too many hats] [EMAIL PROTECTED]
electrical and computer engineering  KF8NH
carnegie mellon university  [better check the oblivious first -ke6sls]

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



Re: disklabel(8) floppy panic

2002-04-01 Thread Joerg Wunsch

Crist J. Clark [EMAIL PROTECTED] wrote:

 Have a crash box handy?
 
   $ disklabel fd0.1440

The patch below should fix that, thanks for the bug report.

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.c18 Dec 2001 22:16:33 -  1.224
+++ isa/fd.c1 Apr 2002 20:56:22 -
@@ -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;

-- 
cheers, Jorg   .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

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



disklabel(8) floppy panic

2002-03-19 Thread Crist J. Clark

Have a crash box handy?

  $ disklabel fd0.1440

-- 
Crist J. Clark | [EMAIL PROTECTED]
   | [EMAIL PROTECTED]
http://people.freebsd.org/~cjc/| [EMAIL PROTECTED]

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