Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe print additional debug information. make ...



details:   https://anonhg.NetBSD.org/src/rev/7c24b10625de
branches:  trunk
changeset: 838719:7c24b10625de
user:      bad <bad%NetBSD.org@localhost>
date:      Mon Jan 28 21:14:08 2019 +0000

description:
print additional debug information.  make rf_containsboot() return 0
if bdv == NULL, to aid in the former.

As discussed 1 week ago on tech-kern.

diffstat:

 sys/dev/raidframe/rf_netbsdkintf.c |  32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)

diffs (75 lines):

diff -r 43f771a98106 -r 7c24b10625de sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 28 21:13:58 2019 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Mon Jan 28 21:14:08 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $    */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.358 2019/01/27 02:08:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.359 2019/01/28 21:14:08 bad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -466,8 +466,15 @@
 
 static int
 rf_containsboot(RF_Raid_t *r, device_t bdv) {
-       const char *bootname = device_xname(bdv);
-       size_t len = strlen(bootname);
+       const char *bootname;
+       size_t len;
+
+       /* if bdv is NULL, the set can't contain it. exit early. */
+       if (bdv == NULL)
+               return 0;
+
+       bootname = device_xname(bdv);
+       len = strlen(bootname);
 
        for (int col = 0; col < r->numCol; col++) {
                const char *devname = r->Disks[col].devname;
@@ -506,8 +513,8 @@
                    cset->ac->clabel->autoconfigure == 1) {
                        sc = rf_auto_config_set(cset);
                        if (sc != NULL) {
-                               aprint_debug("raid%d: configured ok\n",
-                                   sc->sc_unit);
+                               aprint_debug("raid%d: configured ok, rootable %d\n",
+                                   sc->sc_unit, cset->rootable);
                                if (cset->rootable) {
                                        rsc = sc;
                                        num_root++;
@@ -531,8 +538,10 @@
        /* if the user has specified what the root device should be
           then we don't touch booted_device or boothowto... */
 
-       if (rootspec != NULL)
+       if (rootspec != NULL) {
+               DPRINTF("%s: rootspec %s\n", __func__, rootspec);
                return;
+       }
 
        /* we found something bootable... */
 
@@ -574,9 +583,12 @@
                        candidate_root = dksc->sc_dev;
                DPRINTF("%s: candidate root=%p\n", __func__, candidate_root);
                DPRINTF("%s: booted_device=%p root_partition=%d "
-                  "contains_boot=%d\n", __func__, booted_device,
-                  rsc->sc_r.root_partition,
-                  rf_containsboot(&rsc->sc_r, booted_device));
+                       "contains_boot=%d",
+                   __func__, booted_device, rsc->sc_r.root_partition,
+                          rf_containsboot(&rsc->sc_r, booted_device));
+               /* XXX the check for booted_device == NULL can probably be
+                * dropped, now that rf_containsboot handles that case.
+                */
                if (booted_device == NULL ||
                    rsc->sc_r.root_partition == 1 ||
                    rf_containsboot(&rsc->sc_r, booted_device)) {



Home | Main Index | Thread Index | Old Index