Source-Changes-HG archive

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

[src/trunk]: src/sbin/raidctl Add the ability to "softroot" mount (i.e. mount...



details:   https://anonhg.NetBSD.org/src/rev/34c332f01455
branches:  trunk
changeset: 328458:34c332f01455
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Apr 03 18:54:10 2014 +0000

description:
Add the ability to "softroot" mount (i.e. mount root only when the raid
set contains the boot device), as opposed to "hardroot" (the previous
default which forces the raid to be root no matter what).

diffstat:

 sbin/raidctl/raidctl.8 |  12 ++++++++----
 sbin/raidctl/raidctl.c |  23 ++++++++++++++---------
 2 files changed, 22 insertions(+), 13 deletions(-)

diffs (123 lines):

diff -r 88b343c54e6d -r 34c332f01455 sbin/raidctl/raidctl.8
--- a/sbin/raidctl/raidctl.8    Thu Apr 03 18:49:52 2014 +0000
+++ b/sbin/raidctl/raidctl.8    Thu Apr 03 18:54:10 2014 +0000
@@ -1,4 +1,4 @@
-.\"     $NetBSD: raidctl.8,v 1.66 2013/10/07 10:50:37 jdc Exp $
+.\"     $NetBSD: raidctl.8,v 1.67 2014/04/03 18:54:10 christos Exp $
 .\"
 .\" Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -53,7 +53,7 @@
 .\" any improvements or extensions that they make and grant Carnegie the
 .\" rights to redistribute these changes.
 .\"
-.Dd October 7, 2013
+.Dd April 3, 2014
 .Dt RAIDCTL 8
 .Os
 .Sh NAME
@@ -65,7 +65,7 @@
 .Fl a Ar component Ar dev
 .Nm
 .Op Fl v
-.Fl A Op yes | no | root
+.Fl A Op yes | no | forceroot | softroot
 .Ar dev
 .Nm
 .Op Fl v
@@ -163,7 +163,7 @@
 in the disklabel.
 .It Fl A Ic no Ar dev
 Turn off auto-configuration for the RAID set.
-.It Fl A Ic root Ar dev
+.It Fl A Ic forceroot Ar dev
 Make the RAID set auto-configurable, and also mark the set as being
 eligible to be the root partition.
 A RAID set configured this way will
@@ -175,6 +175,10 @@
 Note that only certain architectures
 .Pq currently alpha, amd64, i386, pmax, sandpoint, sparc, sparc64, and vax
 support booting a kernel directly from a RAID set.
+.It Fl A Ic softroot Ar dev
+Like
+.Ic forceroot ,
+but only change the root device if the boot device is part of the RAID set.
 .It Fl B Ar dev
 Initiate a copyback of reconstructed data from a spare disk to
 its original disk.
diff -r 88b343c54e6d -r 34c332f01455 sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Thu Apr 03 18:49:52 2014 +0000
+++ b/sbin/raidctl/raidctl.c    Thu Apr 03 18:54:10 2014 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.56 2013/10/19 01:09:59 christos Exp $   */
+/*      $NetBSD: raidctl.c,v 1.57 2014/04/03 18:54:10 christos Exp $   */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: raidctl.c,v 1.56 2013/10/19 01:09:59 christos Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.57 2014/04/03 18:54:10 christos Exp $");
 #endif
 
 
@@ -88,6 +88,8 @@
 
 int verbose;
 
+static const char *rootpart[] = { "No", "Force", "Soft", "*invalid*" };
+
 int
 main(int argc,char *argv[])
 {
@@ -748,7 +750,7 @@
        printf("   Autoconfig: %s\n", 
               component_label.autoconfigure ? "Yes" : "No" );
        printf("   Root partition: %s\n",
-              component_label.root_partition ? "Yes" : "No" );
+              rootpart[component_label.root_partition & 3]);
        printf("   Last configured as: raid%d\n", component_label.last_unit );
 }
 
@@ -806,12 +808,16 @@
        auto_config = 0;
        root_config = 0;
 
-       if (strncasecmp(autoconf,"root", 4) == 0) {
+       if (strncasecmp(autoconf, "root", 4) == 0 ||
+           strncasecmp(autoconf, "hard", 4) == 0 ||
+           strncasecmp(autoconf, "force", 4) == 0) {
                root_config = 1;
+       } else if (strncasecmp(autoconf, "soft", 4) == 0) {
+               root_config = 2;
        }
 
        if ((strncasecmp(autoconf,"yes", 3) == 0) ||
-           root_config == 1) {
+           root_config > 0) {
                auto_config = 1;
        }
 
@@ -824,9 +830,8 @@
        printf("raid%d: Autoconfigure: %s\n", raidID,
               auto_config ? "Yes" : "No");
 
-       if (root_config == 1) {
-               printf("raid%d: Root: %s\n", raidID,
-                      auto_config ? "Yes" : "No");
+       if (auto_config == 1) {
+               printf("raid%d: Root: %s\n", raidID, rootpart[root_config]);
        }
 }
 
@@ -1130,7 +1135,7 @@
        const char *progname = getprogname();
 
        fprintf(stderr, "usage: %s [-v] -a component dev\n", progname);
-       fprintf(stderr, "       %s [-v] -A [yes | no | root] dev\n", progname);
+       fprintf(stderr, "       %s [-v] -A [yes | no | softroot | hardroot] dev\n", progname);
        fprintf(stderr, "       %s [-v] -B dev\n", progname);
        fprintf(stderr, "       %s [-v] -c config_file dev\n", progname);
        fprintf(stderr, "       %s [-v] -C config_file dev\n", progname);



Home | Main Index | Thread Index | Old Index