Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Sep 1997 17:57:58 +0200 (CEST)
From:      Andre Albsmeier <Andre.Albsmeier@mchp.siemens.de>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/4660: bug in wd.c when using devfs
Message-ID:  <199709301557.RAA03366@curry.mchp.siemens.de>
Resent-Message-ID: <199709301600.JAA03499@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4660
>Category:       kern
>Synopsis:       bug in wd.c when using devfs
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep 30 09:00:00 PDT 1997
>Last-Modified:
>Originator:     Andre Albsmeier
>Organization:
>Release:        FreeBSD 2.2-STABLE i386
>Environment:

	I suspect all systems, but at least 2.2-STABLE

>Description:

When using devfs on 2.2-STABLE with 3 IDE drives, I saw that wd2
doesn't appear in /devs. Instead, when booting, the kernel prints
a message that wd0 (yes, wd0) is already present. IMHO this is due
to a bug in wd.c: When calling the devfs routines, the variable unit
is passed instead of lunit. As far as I am correct, unit refers to
the physical unit on the controller wdc which is 0 for wd2. And
lunit refers to the logical unit which is 2 for wd2. So the kernel
thinks, wd0 should be registered once more and complains. I have
attached my changes to wd.c which makes it work.

Maybe, this applies to 2.1 and current, too.

And maybe, I am also completely wrong :-)

*** wd.c.ORI	Sun Sep 21 14:38:19 1997
--- wd.c	Sun Sep 21 14:50:16 1997
***************
*** 478,492 ****
  			wdtimeout(du);
  
  #ifdef DEVFS
! 			mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
  			du->dk_bdev = devfs_add_devswf(&wd_bdevsw, mynor,
  						       DV_BLK, UID_ROOT,
  						       GID_OPERATOR, 0640,
! 						       "wd%d", unit);
  			du->dk_cdev = devfs_add_devswf(&wd_cdevsw, mynor,
  						       DV_CHR, UID_ROOT,
  						       GID_OPERATOR, 0640,
! 						       "rwd%d", unit);
  #endif
  
  			if (dk_ndrive < DK_NDRIVE) {
--- 478,492 ----
  			wdtimeout(du);
  
  #ifdef DEVFS
! 			mynor = dkmakeminor(lunit, WHOLE_DISK_SLICE, RAW_PART);
  			du->dk_bdev = devfs_add_devswf(&wd_bdevsw, mynor,
  						       DV_BLK, UID_ROOT,
  						       GID_OPERATOR, 0640,
! 						       "wd%d", lunit);
  			du->dk_cdev = devfs_add_devswf(&wd_cdevsw, mynor,
  						       DV_CHR, UID_ROOT,
  						       GID_OPERATOR, 0640,
! 						       "rwd%d", lunit);
  #endif
  
  			if (dk_ndrive < DK_NDRIVE) {
	

>How-To-Repeat:

	Make a machine with at least 3 IDE drives and enable devfs.

>Fix:
	
	see above

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709301557.RAA03366>