summaryrefslogtreecommitdiff
path: root/sys/kern/subr_userconf.c
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2002-05-02 12:59:59 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2002-05-02 12:59:59 +0000
commit8d47da7565f17117d20fa52c7d0933af79c89093 (patch)
treec6485ead76287ac3d7cd56880a7358e50d24ba79 /sys/kern/subr_userconf.c
parent99b01678af971627c86296cf228031dca087423f (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@
Diffstat (limited to 'sys/kern/subr_userconf.c')
-rw-r--r--sys/kern/subr_userconf.c35
1 files changed, 30 insertions, 5 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 */
}