Module Name:    src
Committed By:   mrg
Date:           Tue Jul 21 05:54:44 UTC 2015

Modified Files:
        src/sbin/raidctl: raidctl.c

Log Message:
convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G".  now this actually works when fed back
into raidctl -[cC].


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 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.c
diff -u src/sbin/raidctl/raidctl.c:1.61 src/sbin/raidctl/raidctl.c:1.62
--- src/sbin/raidctl/raidctl.c:1.61	Tue Jun 30 17:02:14 2015
+++ src/sbin/raidctl/raidctl.c	Tue Jul 21 05:54:44 2015
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.61 2015/06/30 17:02:14 sborrill Exp $   */
+/*      $NetBSD: raidctl.c,v 1.62 2015/07/21 05:54:44 mrg 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.61 2015/06/30 17:02:14 sborrill Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.62 2015/07/21 05:54:44 mrg Exp $");
 #endif
 
 
@@ -576,6 +576,14 @@ rf_pm_configure(int fd, int raidID, char
 	    raidID, dis ? "dis" : "en");
 }
 
+/* convert "component0" into "absent" */
+static const char *rf_output_devname(const char *devname)
+{
+
+	if (strncmp(devname, "component", 9) == 0)
+		return "absent";
+	return devname;
+}
 
 static void
 rf_output_configuration(int fd, const char *name)
@@ -602,7 +610,8 @@ rf_output_configuration(int fd, const ch
 
 	printf("START disks\n");
 	for(i=0; i < device_config.ndevs; i++)
-		printf("%s\n", device_config.devs[i].devname);
+		printf("%s\n",
+		    rf_output_devname(device_config.devs[i].devname));
 	printf("\n");
 
 	if (device_config.nspares > 0) {

Reply via email to