Module Name: src Committed By: christos Date: Thu Apr 3 18:54:10 UTC 2014
Modified Files: src/sbin/raidctl: raidctl.8 raidctl.c Log Message: 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). To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sbin/raidctl/raidctl.8 cvs rdiff -u -r1.56 -r1.57 src/sbin/raidctl/raidctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/raidctl/raidctl.8 diff -u src/sbin/raidctl/raidctl.8:1.66 src/sbin/raidctl/raidctl.8:1.67 --- src/sbin/raidctl/raidctl.8:1.66 Mon Oct 7 06:50:37 2013 +++ src/sbin/raidctl/raidctl.8 Thu Apr 3 14:54:10 2014 @@ -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 @@ Note that all components of the set must 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 @@ in the disklabel. 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. Index: src/sbin/raidctl/raidctl.c diff -u src/sbin/raidctl/raidctl.c:1.56 src/sbin/raidctl/raidctl.c:1.57 --- src/sbin/raidctl/raidctl.c:1.56 Fri Oct 18 21:09:59 2013 +++ src/sbin/raidctl/raidctl.c Thu Apr 3 14:54:10 2014 @@ -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 @@ static void rf_pm_configure(int, int, c int verbose; +static const char *rootpart[] = { "No", "Force", "Soft", "*invalid*" }; + int main(int argc,char *argv[]) { @@ -748,7 +750,7 @@ get_component_label(int fd, char *compon 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 @@ set_autoconfig(int fd, int raidID, char 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 @@ set_autoconfig(int fd, int raidID, char 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 @@ usage(void) 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);