summaryrefslogtreecommitdiff
path: root/usr.sbin/config/ukcutil.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 /usr.sbin/config/ukcutil.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 'usr.sbin/config/ukcutil.c')
-rw-r--r--usr.sbin/config/ukcutil.c38
1 files changed, 33 insertions, 5 deletions
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 */
}