Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/evbmips Use deviter(9) instead of accessing alldevs...



details:   https://anonhg.NetBSD.org/src/rev/09ffea3d148e
branches:  trunk
changeset: 748771:09ffea3d148e
user:      dyoung <dyoung%NetBSD.org@localhost>
date:      Thu Nov 05 00:35:12 2009 +0000

description:
Use deviter(9) instead of accessing alldevs directly.  Test-compiled,
only.

diffstat:

 sys/arch/evbmips/gdium/autoconf.c |  16 ++++++++++------
 sys/arch/evbmips/malta/autoconf.c |  16 ++++++++++------
 2 files changed, 20 insertions(+), 12 deletions(-)

diffs (88 lines):

diff -r a3058f139eab -r 09ffea3d148e sys/arch/evbmips/gdium/autoconf.c
--- a/sys/arch/evbmips/gdium/autoconf.c Thu Nov 05 00:34:05 2009 +0000
+++ b/sys/arch/evbmips/gdium/autoconf.c Thu Nov 05 00:35:12 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.2 2009/08/07 19:27:54 macallan Exp $    */
+/*     $NetBSD: autoconf.c,v 1.3 2009/11/05 00:35:12 dyoung Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2009/08/07 19:27:54 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2009/11/05 00:35:12 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,17 +83,21 @@
 static void
 findroot(void)
 {
-       struct device *dv;
+       device_t dv;
+       deviter_t di;
 
        if (booted_device)
                return;
 
-       if ((booted_device == NULL) && netboot == 0)
-               for (dv = TAILQ_FIRST(&alldevs); dv != NULL;
-                    dv = TAILQ_NEXT(dv, dv_list))
+       if ((booted_device == NULL) && netboot == 0) {
+               for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); dv != NULL;
+                    dv = deviter_next(&di)) {
                        if (device_class(dv) == DV_DISK &&
                            device_is_a(dv, "wd"))
                                    booted_device = dv;
+               }
+               deviter_release(&di);
+       }
 
        /*
         * XXX Match up MBR boot specification with BSD disklabel for root?
diff -r a3058f139eab -r 09ffea3d148e sys/arch/evbmips/malta/autoconf.c
--- a/sys/arch/evbmips/malta/autoconf.c Thu Nov 05 00:34:05 2009 +0000
+++ b/sys/arch/evbmips/malta/autoconf.c Thu Nov 05 00:35:12 2009 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.14 2009/03/18 10:22:27 cegger Exp $     */
+/*     $NetBSD: autoconf.c,v 1.15 2009/11/05 00:35:43 dyoung Exp $     */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.14 2009/03/18 10:22:27 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.15 2009/11/05 00:35:43 dyoung Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -83,17 +83,21 @@
 static void
 findroot(void)
 {
-       struct device *dv;
+       device_t dv;
+       deviter_t di;
 
        if (booted_device)
                return;
 
-       if ((booted_device == NULL) && netboot == 0)
-               for (dv = TAILQ_FIRST(&alldevs); dv != NULL;
-                    dv = TAILQ_NEXT(dv, dv_list))
+       if ((booted_device == NULL) && netboot == 0) {
+               for (dv = deviter_first(&di, DEVITER_F_ROOT_FIRST); dv != NULL;
+                    dv = deviter_next(&di)) {
                        if (device_class(dv) == DV_DISK &&
                            device_is_a(dv, "wd"))
                                    booted_device = dv;
+               }
+               deviter_release(&di);
+       }
 
        /*
         * XXX Match up MBR boot specification with BSD disklabel for root?



Home | Main Index | Thread Index | Old Index