Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/raidframe Statically initialize the raidautoconfig v...



details:   https://anonhg.NetBSD.org/src/rev/69c9fa26e972
branches:  trunk
changeset: 770991:69c9fa26e972
user:      erh <erh%NetBSD.org@localhost>
date:      Sat Nov 05 16:40:35 2011 +0000

description:
Statically initialize the raidautoconfig variable when RAID_AUTOCONFIG is set,
instead of setting it in code, so it can easily be checked and changed in an
on-disk kernel with gdb.  Use a separate raidautoconfigdone variable to keep
track of whether raid configuration has actually occurred.

diffstat:

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

diffs (79 lines):

diff -r 316a554221c4 -r 69c9fa26e972 sys/dev/raidframe/rf_netbsdkintf.c
--- a/sys/dev/raidframe/rf_netbsdkintf.c        Sat Nov 05 15:37:17 2011 +0000
+++ b/sys/dev/raidframe/rf_netbsdkintf.c        Sat Nov 05 16:40:35 2011 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: rf_netbsdkintf.c,v 1.294 2011/08/03 14:44:38 oster Exp $       */
+/*     $NetBSD: rf_netbsdkintf.c,v 1.295 2011/11/05 16:40:35 erh Exp $ */
 
 /*-
- * Copyright (c) 1996, 1997, 1998, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -101,7 +101,7 @@
  ***********************************************************/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.294 2011/08/03 14:44:38 oster Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.295 2011/11/05 16:40:35 erh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -307,11 +307,17 @@
 int rf_auto_config_set(RF_ConfigSet_t *, int *);
 static void rf_fix_old_label_size(RF_ComponentLabel_t *, uint64_t);
 
-static int raidautoconfig = 0; /* Debugging, mostly.  Set to 0 to not
-                                 allow autoconfig to take place.
-                                 Note that this is overridden by having
-                                 RAID_AUTOCONFIG as an option in the
-                                 kernel config file.  */
+/*
+ * Debugging, mostly.  Set to 0 to not allow autoconfig to take place.
+ * Note that this is overridden by having RAID_AUTOCONFIG as an option
+ * in the kernel config file.
+ */
+#ifdef RAID_AUTOCONFIG
+int raidautoconfig = 1;
+#else
+int raidautoconfig = 0;
+#endif
+static bool raidautoconfigdone = false;
 
 struct RF_Pools_s rf_pools;
 
@@ -385,9 +391,7 @@
                aprint_error("raidattach: config_cfattach_attach failed?\n");
        }
 
-#ifdef RAID_AUTOCONFIG
-       raidautoconfig = 1;
-#endif
+       raidautoconfigdone = false;
 
        /*
         * Register a finalizer which will be used to auto-config RAID
@@ -403,11 +407,11 @@
        RF_AutoConfig_t *ac_list;
        RF_ConfigSet_t *config_sets;
 
-       if (raidautoconfig == 0)
+       if (!raidautoconfig || raidautoconfigdone == true)
                return (0);
 
        /* XXX This code can only be run once. */
-       raidautoconfig = 0;
+       raidautoconfigdone = true;
 
        /* 1. locate all RAID components on the system */
        aprint_debug("Searching for RAID components...\n");
@@ -510,7 +514,7 @@
                                rootID = raidID;
                        }
                }
- 
+
                if (num_root == 1) {
                        booted_device = raid_softc[rootID].sc_dev;
                } else {



Home | Main Index | Thread Index | Old Index