Source-Changes-HG archive

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

[src/trunk]: src/sbin/raidctl Give a more polite message for `raidctl -m` on ...



details:   https://anonhg.NetBSD.org/src/rev/010b2895a52c
branches:  trunk
changeset: 753115:010b2895a52c
user:      jld <jld%NetBSD.org@localhost>
date:      Tue Mar 16 03:23:47 2010 +0000

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

diffstat:

 sbin/raidctl/raidctl.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r e39d9952f19c -r 010b2895a52c sbin/raidctl/raidctl.c
--- a/sbin/raidctl/raidctl.c    Tue Mar 16 01:49:34 2010 +0000
+++ b/sbin/raidctl/raidctl.c    Tue Mar 16 03:23:47 2010 +0000
@@ -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))



Home | Main Index | Thread Index | Old Index