Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Apr 2002 21:40:49 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Greg 'groggy' Lehey" <grog@FreeBSD.ORG>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, <freebsd-bugs@FreeBSD.ORG>
Subject:   Re: bin/37458: twed (3ware escalade) devices not supported by vinum
Message-ID:  <20020426212651.F4109-100000@gamplex.bde.org>
In-Reply-To: <20020426090420.R33950@wantadilla.lemis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Apr 2002, Greg 'groggy' Lehey wrote:

> On Thursday, 25 April 2002 at 11:30:08 -0700, Poul-Henning Kamp wrote:
> > The following reply was made to PR bin/37458; it has been noted by GNATS.
> >
> > From: Poul-Henning Kamp <phk@critter.freebsd.dk>
> > To: holger.kipp@alogis.com
> > Cc: FreeBSD-gnats-submit@FreeBSD.ORG
> > Subject: Re: bin/37458: twed (3ware escalade) devices not supported by vinum
> > Date: Thu, 25 Apr 2002 20:21:55 +0200
> >
> >  While this patch is technically correct, the code it patches is
> >  mightily bogus.
> >> *** vinumio.c.orig      Tue Apr 23 13:05:19 2002
> >> --- vinumio.c           Tue Apr 23 13:22:57 2002
> >> ***************
> >> *** 93,98 ****
> >> --- 93,101 ----
> >>      } else if (bcmp(dname, "idad", 4) == 0) {
> >>        devmajor = 109;
> >>        dname += 2;
> >> +     } else if (bcmp(dname, "twed", 4) == 0) {               /* 3ware raid */
> >> +         devmajor = 147;
> >> +         dname += 2;
> >>      } else
>
> You obviously haven't read the comments.
>
>     /*
>      * Yes, Bruce, I know this is horrible, but we
>      * don't have a root file system when we first
>      * try to do this.  If you can come up with a
>      * better solution, I'd really like it.  I'm
>      * just putting it in now to add ammuntion to
>      * moving the system to devfs.
>      */

It can be done less worse by looking up the driver name in the cdevsw,
as in vfs_conf.c:vfs_mountroot_ask():

			printf("Possibly valid devices for 'ufs' root:\n");
			for (i = 0; i < NUMCDEVSW; i++) {
				dev = makedev(i, 0);
				if (devsw(dev) != NULL)
					printf(" \"%s\"", devsw(dev)->d_name);
			}
			printf("\n");

This code has some style bugs and bogusly prints _all_ _driver names_  as
candidates for root devices.  Fix:

%%%
Index: vfs_conf.c
===================================================================
RCS file: /home/ncvs/src/sys/kern/vfs_conf.c,v
retrieving revision 1.68
diff -u -2 -r1.68 vfs_conf.c
--- vfs_conf.c	17 Apr 2002 13:06:36 -0000	1.68
+++ vfs_conf.c	21 Apr 2002 13:58:11 -0000
@@ -284,11 +277,12 @@
 		printf("\nmountroot> ");
 		gets(name);
-		if (name[0] == 0)
-			return(1);
+		if (name[0] == '\0')
+			return (1);
 		if (name[0] == '?') {
-			printf("Possibly valid devices for 'ufs' root:\n");
-			for (i = 0; i < NUMCDEVSW; i++) {
-				dev = makedev(i, 0);
-				if (devsw(dev) != NULL)
+			printf("Possibly valid driver names for 'ufs' root:\n");
+			for (cd = 0; cd < NUMCDEVSW; cd++) {
+				dev = makedev(cd, 0);
+				if (devsw(dev) != NULL &&
+				    devsw(dev)->d_flags & D_DISK)
 					printf(" \"%s\"", devsw(dev)->d_name);
 			}
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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