diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2002-05-02 12:59:59 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2002-05-02 12:59:59 +0000 |
commit | 8d47da7565f17117d20fa52c7d0933af79c89093 (patch) | |
tree | c6485ead76287ac3d7cd56880a7358e50d24ba79 | |
parent | 99b01678af971627c86296cf228031dca087423f (diff) |
In UKC, when adding a fixed unit device (foo0) by cloning a star device
(foo*), be sure to update all cf_starunit1 fields for related star devices,
so that they will not compete for the foo0 probe.
This fixes the new sparc bsd.scsi3 behaviour.
Tested by brad@ and myself, ok maja@
-rw-r--r-- | sys/kern/subr_userconf.c | 35 | ||||
-rw-r--r-- | usr.sbin/config/ukcutil.c | 38 |
2 files changed, 63 insertions, 10 deletions
diff --git a/sys/kern/subr_userconf.c b/sys/kern/subr_userconf.c index 6d8ee6d3872..c5663f12e89 100644 --- a/sys/kern/subr_userconf.c +++ b/sys/kern/subr_userconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_userconf.c,v 1.28 2002/03/14 03:16:09 millert Exp $ */ +/* $OpenBSD: subr_userconf.c,v 1.29 2002/05/02 12:59:58 miod Exp $ */ /* * Copyright (c) 1996-2001 Mats O Jansson <moj@stacken.kth.se> @@ -1055,7 +1055,7 @@ userconf_add(dev, len, unit, state) { int i = 0, found = 0; struct cfdata new; - int val, max_unit, orig; + int val, max_unit, star_unit, orig; bzero(&new, sizeof(struct cfdata)); @@ -1141,9 +1141,31 @@ userconf_add(dev, len, unit, state) i++; } - /* For all * entries set unit number to max+1 */ - + /* + * For all * entries set unit number to max+1, and update + * cf_starunit1 if necessary. + */ max_unit++; + star_unit = -1; + + i = 0; + while (cfdata[i].cf_attach != 0) { + if (strlen(cfdata[i].cf_driver->cd_name) == len && + strncasecmp(dev, cfdata[i].cf_driver->cd_name, + len) == 0) { + switch (cfdata[i].cf_fstate) { + case FSTATE_NOTFOUND: + case FSTATE_DNOTFOUND: + if (cfdata[i].cf_unit > star_unit) + star_unit = cfdata[i].cf_unit; + break; + default: + break; + } + } + i++; + } + star_unit++; i = 0; while (cfdata[i].cf_attach != 0) { @@ -1154,6 +1176,9 @@ userconf_add(dev, len, unit, state) case FSTATE_STAR: case FSTATE_DSTAR: cfdata[i].cf_unit = max_unit; + if (cfdata[i].cf_starunit1 < star_unit) + cfdata[i].cf_starunit1 = + star_unit; break; default: break; @@ -1164,7 +1189,7 @@ userconf_add(dev, len, unit, state) userconf_pdev(val); } - /* cf_attach, cf_driver, cf_unit, cf_state, cf_loc, cf_flags, + /* cf_attach, cf_driver, cf_unit, cf_fstate, cf_loc, cf_flags, cf_parents, cf_locnames, cf_locnames and cf_ivstubs */ } diff --git a/usr.sbin/config/ukcutil.c b/usr.sbin/config/ukcutil.c index c71cfc694a0..97c3bb1f336 100644 --- a/usr.sbin/config/ukcutil.c +++ b/usr.sbin/config/ukcutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ukcutil.c,v 1.9 2002/03/23 13:30:24 espie Exp $ */ +/* $OpenBSD: ukcutil.c,v 1.10 2002/05/02 12:59:54 miod Exp $ */ /* * Copyright (c) 1999-2001 Mats O Jansson. All rights reserved. @@ -30,7 +30,7 @@ */ #ifndef LINT -static char rcsid[] = "$OpenBSD: ukcutil.c,v 1.9 2002/03/23 13:30:24 espie Exp $"; +static char rcsid[] = "$OpenBSD: ukcutil.c,v 1.10 2002/05/02 12:59:54 miod Exp $"; #endif #include <sys/types.h> @@ -1058,7 +1058,7 @@ add(dev, len, unit, state) short *pv; struct cfdata new, *cd, *cdp; struct cfdriver *cdrv; - int val, max_unit; + int val, max_unit, star_unit; ukc_mod_kernel = 1; @@ -1158,8 +1158,34 @@ add(dev, len, unit, state) cd++; } - /* For all * entries set unit number to max+1 */ + /* + * For all * entries set unit number to max+1, and update + * cf_starunit1 if necessary. + */ max_unit++; + star_unit = -1; + cd = get_cfdata(0); + while (cd->cf_attach != 0) { + cdrv = (struct cfdriver *) + adjust((caddr_t)cd->cf_driver); + + if (strlen((char *)adjust(cdrv->cd_name)) == len && + strncasecmp(dev, (char *)adjust(cdrv->cd_name), + len) == 0) { + switch (cd->cf_fstate) { + case FSTATE_NOTFOUND: + case FSTATE_DNOTFOUND: + if (cd->cf_unit > star_unit) + star_unit = cd->cf_unit; + break; + default: + break; + } + } + cd++; + } + star_unit++; + cd = get_cfdata(0); while (cd->cf_attach != 0) { cdrv = (struct cfdriver *) @@ -1172,6 +1198,8 @@ add(dev, len, unit, state) case FSTATE_STAR: case FSTATE_DSTAR: cd->cf_unit = max_unit; + if (cd->cf_starunit1 < star_unit) + cd->cf_starunit1 = star_unit; break; default: break; @@ -1183,7 +1211,7 @@ add(dev, len, unit, state) pdev(val); } - /* cf_attach, cf_driver, cf_unit, cf_state, cf_loc, cf_flags, + /* cf_attach, cf_driver, cf_unit, cf_fstate, cf_loc, cf_flags, cf_parents, cf_locnames, cf_locnames and cf_ivstubs */ } |