From patchwork Fri Mar 19 13:56:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: heinzm@sourceware.org X-Patchwork-Id: 86944 Received: from mx02.colomx.prod.int.phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2JDxENb032017 for ; Fri, 19 Mar 2010 13:59:50 GMT Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx02.colomx.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2JDv80h008892; Fri, 19 Mar 2010 09:57:08 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2JDv7BS020353 for ; Fri, 19 Mar 2010 09:57:07 -0400 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.6]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2JDv11j018693 for ; Fri, 19 Mar 2010 09:57:02 -0400 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by mx1.redhat.com (8.13.8/8.13.8) with SMTP id o2JDuoUH029875 for ; Fri, 19 Mar 2010 09:56:50 -0400 Received: (qmail 22117 invoked by uid 9450); 19 Mar 2010 13:56:50 -0000 Date: 19 Mar 2010 13:56:50 -0000 Message-ID: <20100319135650.22115.qmail@sourceware.org> From: heinzm@sourceware.org To: dm-cvs@sourceware.org, dm-devel@redhat.com X-RedHat-Spam-Score: -2.31 (RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD) X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-Scanned-By: MIMEDefang 2.67 on 10.5.110.6 X-loop: dm-devel@redhat.com Subject: [dm-devel] dmraid include/dmraid/lib_context.h lib/metada ... X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 19 Mar 2010 13:59:50 +0000 (UTC) --- dmraid/include/dmraid/lib_context.h 2010/03/19 12:07:47 1.6 +++ dmraid/include/dmraid/lib_context.h 2010/03/19 13:56:49 1.7 @@ -54,21 +54,21 @@ /* Options access macros. */ /* Return option counter. */ #define OPT_COLUMN(lc) (lc_opt(lc, LC_COLUMN)) +#define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE)) #define OPT_DEBUG(lc) (lc_opt(lc, LC_DEBUG)) #define OPT_DEVICES(lc) (lc_opt(lc, LC_DEVICES)) #define OPT_DUMP(lc) (lc_opt(lc, LC_DUMP)) -#define OPT_GROUP(lc) (lc_opt(lc, LC_GROUP)) #define OPT_FORMAT(lc) (lc_opt(lc, LC_FORMAT)) +#define OPT_GROUP(lc) (lc_opt(lc, LC_GROUP)) +#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET)) #define OPT_IGNORELOCKING(lc) (lc_opt(lc, LC_IGNORELOCKING)) +#define OPT_IGNOREMONITORING(lc) (lc_opt(lc, LC_IGNOREMONITORING)) +#define OPT_PARTCHAR(lc) (lc_opt(lc, LC_PARTCHAR)) +#define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK)) #define OPT_SEPARATOR(lc) (lc_opt(lc, LC_SEPARATOR)) #define OPT_SETS(lc) (lc_opt(lc, LC_SETS)) #define OPT_TEST(lc) (lc_opt(lc, LC_TEST)) #define OPT_VERBOSE(lc) (lc_opt(lc, LC_VERBOSE)) -#define OPT_PARTCHAR(lc) (lc_opt(lc, LC_PARTCHAR)) -#define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE)) -#define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK)) -#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET)) -#define OPT_IGNOREMONITORING(lc) (lc_opt(lc, LC_IGNOREMONITORING)) /* Return option value. */ #define OPT_STR(lc, o) (lc->options[o].arg.str) --- dmraid/lib/metadata/metadata.c 2010/03/19 12:07:48 1.11 +++ dmraid/lib/metadata/metadata.c 2010/03/19 13:56:49 1.12 @@ -1901,23 +1901,21 @@ n++; } + if (n > 1) { printf("\nAbout to delete the raid super-set " "\"%s\" with the following RAID sets\n", rs->name); list_for_each_entry(rs1, &rs->sets, list) printf("%s\n", rs1->name); - } - else if (n == 1) { + } else if (n == 1) { rs1 = list_entry(rs->sets.next, struct raid_set, list); printf("\nAbout to delete RAID set %s\n", rs1->name); - } - else + } else LOG_ERR(lc, 0, "coding error"); - } - else + } else printf("\nAbout to delete RAID set %s\n", rs->name); printf("\nWARNING: The metadata stored on the raidset(s) " @@ -1932,7 +1930,6 @@ rd->fmt->name); rd->fmt->delete(lc, rs); - } return 1; --- dmraid/tools/commands.c 2010/03/19 12:07:48 1.8 +++ dmraid/tools/commands.c 2010/03/19 13:56:49 1.9 @@ -30,12 +30,11 @@ /* * Command line options. */ -static char const *short_opts = "a:hipP:" - "bc::dDEf:gIlxM:" +static char const *short_opts = "a:bc::C:dDEf:ghiIlM:" #ifdef DMRAID_NATIVE_LOG "n" #endif - "rR:s::tvVC:S::Z"; + "pP:rR:s::S::tvVxZ"; #ifdef HAVE_GETOPTLONG static struct option long_opts[] = { @@ -46,8 +45,8 @@ {"display_columns", optional_argument, NULL, 'c'}, {"display_group", no_argument, NULL, 'g'}, {"dump_metadata", no_argument, NULL, 'D'}, - {"format", required_argument, NULL, 'f'}, {"erase_metadata", no_argument, NULL, 'E'}, + {"format", required_argument, NULL, 'f'}, {"help", no_argument, NULL, 'h'}, {"ignorelocking", no_argument, NULL, 'i'}, {"ignoremonitoring", no_argument, NULL, 'I'}, @@ -618,6 +617,7 @@ if ((action & (DBG | VERBOSE)) == action) LOG_ERR(lc, 0, "more options needed with -d/-v"); + /* Enforce metadata dump on (mistaken) erase. */ if (action & DMERASE) { action |= DUMP; lc_inc_opt(lc, LC_DUMP); @@ -636,6 +636,7 @@ LOG_ERR(lc, 0, "invalid format for -f at (see -l)"); } +/* Save name of rebuild disk. */ int save_drive_name(struct lib_context *lc, char *drive) { @@ -643,6 +644,7 @@ return lc_strcat_opt(lc, LC_REBUILD_DISK, drive, ',') ? 1 : 0; } +/* Save name of hot spare disk. */ static int save_spare_name(struct lib_context *lc, char **argv) {