Module Name:    src
Committed By:   jld
Date:           Tue Mar 16 03:23:47 UTC 2010

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

Log Message:
Give a more polite message for `raidctl -m` on a non-parity RAID set.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 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.47 src/sbin/raidctl/raidctl.c:1.48
--- src/sbin/raidctl/raidctl.c:1.47	Sat Mar 13 13:45:05 2010
+++ src/sbin/raidctl/raidctl.c	Tue Mar 16 03:23:47 2010
@@ -1,4 +1,4 @@
-/*      $NetBSD: raidctl.c,v 1.47 2010/03/13 13:45:05 plunky Exp $   */
+/*      $NetBSD: raidctl.c,v 1.48 2010/03/16 03:23:47 jld 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.47 2010/03/13 13:45:05 plunky Exp $");
+__RCSID("$NetBSD: raidctl.c,v 1.48 2010/03/16 03:23:47 jld Exp $");
 #endif
 
 
@@ -487,8 +487,15 @@
 	int dis, dr;
 	struct rf_pmstat st;
 
-	do_ioctl(fd, RAIDFRAME_PARITYMAP_STATUS, &st,
-	    "RAIDFRAME_PARITYMAP_STATUS");
+	if (ioctl(fd, RAIDFRAME_PARITYMAP_STATUS, &st) == -1) {
+		if (errno == EINVAL) {
+			printf("raid%d: has no parity; parity map disabled\n",
+				raidID);
+			return;
+		}
+		err(1, "ioctl (%s) failed", "RAIDFRAME_PARITYMAP_STATUS");
+	}
+
 	if (st.enabled) {
 		if (0 > humanize_number(srs, 7, st.region_size * DEV_BSIZE, 
 			"B", HN_AUTOSCALE, HN_NOSPACE))

Reply via email to