Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern use the old cloning-device cf_unit increment behavi...



details:   https://anonhg.NetBSD.org/src/rev/6025375a8872
branches:  trunk
changeset: 480699:6025375a8872
user:      cgd <cgd%NetBSD.org@localhost>
date:      Tue Jan 18 07:45:04 2000 +0000

description:
use the old cloning-device cf_unit increment behaviour, if
__BROKEN_CONFIG_UNIT_USAGE is defined.

diffstat:

 sys/kern/subr_autoconf.c |  27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diffs (71 lines):

diff -r 2a0611e6ee48 -r 6025375a8872 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Tue Jan 18 05:36:19 2000 +0000
+++ b/sys/kern/subr_autoconf.c  Tue Jan 18 07:45:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_autoconf.c,v 1.45 1999/12/30 01:03:43 cgd Exp $   */
+/*     $NetBSD: subr_autoconf.c,v 1.46 2000/01/18 07:45:04 cgd Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -308,6 +308,7 @@
        ca = cf->cf_attach;
        if (ca->ca_devsize < sizeof(struct device))
                panic("config_attach");
+#ifndef __BROKEN_CONFIG_UNIT_USAGE
        if (cf->cf_fstate == FSTATE_STAR) {
                for (myunit = cf->cf_unit; myunit < cd->cd_ndevs; myunit++)
                        if (cd->cd_devs[myunit] == NULL)
@@ -318,6 +319,12 @@
                 */
        } else {
                myunit = cf->cf_unit;
+#else /* __BROKEN_CONFIG_UNIT_USAGE */
+       myunit = cf->cf_unit;
+       if (cf->cf_fstate == FSTATE_STAR)
+               cf->cf_unit++;
+       else {
+#endif /* __BROKEN_CONFIG_UNIT_USAGE */
                KASSERT(cf->cf_fstate == FSTATE_NOTFOUND);
                cf->cf_fstate = FSTATE_FOUND;
        }
@@ -387,10 +394,17 @@
         * Before attaching, clobber any unfound devices that are
         * otherwise identical.
         */
+#ifdef __BROKEN_CONFIG_UNIT_USAGE
+       /* bump the unit number on all starred cfdata for this device. */
+#endif /* __BROKEN_CONFIG_UNIT_USAGE */
        for (cf = cfdata; cf->cf_driver; cf++)
                if (cf->cf_driver == cd && cf->cf_unit == dev->dv_unit) {
                        if (cf->cf_fstate == FSTATE_NOTFOUND)
                                cf->cf_fstate = FSTATE_FOUND;
+#ifdef __BROKEN_CONFIG_UNIT_USAGE
+                       if (cf->cf_fstate == FSTATE_STAR)
+                               cf->cf_unit++;
+#endif /* __BROKEN_CONFIG_UNIT_USAGE */
                }
 #if defined(__alpha__) || defined(hp300) || defined(__i386__) || \
        defined(__sparc__) || defined(__vax__) || defined(x68k)
@@ -480,11 +494,22 @@
        /*
         * Mark cfdata to show that the unit can be reused, if possible.
         */
+#ifdef __BROKEN_CONFIG_UNIT_USAGE
+       /*
+        * Note that we can only re-use a starred unit number if the unit
+        * being detached had the last assigned unit number.
+        */
+#endif /* __BROKEN_CONFIG_UNIT_USAGE */
        for (cf = cfdata; cf->cf_driver; cf++) {
                if (cf->cf_driver == cd) {
                        if (cf->cf_fstate == FSTATE_FOUND &&
                            cf->cf_unit == dev->dv_unit)
                                cf->cf_fstate = FSTATE_NOTFOUND;
+#ifdef __BROKEN_CONFIG_UNIT_USAGE
+                       if (cf->cf_fstate == FSTATE_STAR &&
+                           cf->cf_unit == dev->dv_unit + 1)
+                               cf->cf_unit--;
+#endif /* __BROKEN_CONFIG_UNIT_USAGE */
                }
        }
 



Home | Main Index | Thread Index | Old Index