public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: mornfall@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/tools lvchange.c
Date: Mon, 28 Jun 2010 19:10:00 -0000	[thread overview]
Message-ID: <20100628191016.16125.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2010-06-28 19:10:16

Modified files:
	tools          : lvchange.c 

Log message:
	Refactor the handles_missing_pv logic in lvchange.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.120&r2=1.121

--- LVM2/tools/lvchange.c	2010/05/06 11:15:56	1.120
+++ LVM2/tools/lvchange.c	2010/06/28 19:10:16	1.121
@@ -714,32 +714,31 @@
 
 int lvchange(struct cmd_context *cmd, int argc, char **argv)
 {
-	if (!arg_count(cmd, available_ARG) && !arg_count(cmd, contiguous_ARG)
-	    && !arg_count(cmd, permission_ARG) && !arg_count(cmd, readahead_ARG)
-	    && !arg_count(cmd, minor_ARG) && !arg_count(cmd, major_ARG)
-	    && !arg_count(cmd, persistent_ARG) && !arg_count(cmd, addtag_ARG)
-	    && !arg_count(cmd, deltag_ARG) && !arg_count(cmd, refresh_ARG)
-	    && !arg_count(cmd, alloc_ARG) && !arg_count(cmd, monitor_ARG)
-	    && !arg_count(cmd, poll_ARG) && !arg_count(cmd, resync_ARG)) {
+	int update = /* options other than -a, --refresh or --monitor */
+		arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
+		arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
+		arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
+		arg_count(cmd, resync_ARG) || arg_count(cmd, alloc_ARG);
+
+	if (!update &&
+            !arg_count(cmd, available_ARG) && !arg_count(cmd, refresh_ARG) &&
+            !arg_count(cmd, monitor_ARG) && !arg_count(cmd, poll_ARG) &&
+            /* for persistent_ARG */
+	    !arg_count(cmd, minor_ARG) && !arg_count(cmd, major_ARG)) {
 		log_error("Need 1 or more of -a, -C, -j, -m, -M, -p, -r, "
 			  "--resync, --refresh, --alloc, --addtag, --deltag, "
 			  "--monitor or --poll");
 		return EINVALID_CMD_LINE;
 	}
 
-	int avail_only = /* i.e. only one of -a or --refresh is given */
-	    !(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
-	     arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
-	     arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
-	     arg_count(cmd, resync_ARG) || arg_count(cmd, alloc_ARG));
 
 	if ((arg_count(cmd, ignorelockingfailure_ARG) ||
-	     arg_count(cmd, sysinit_ARG)) && !avail_only) {
+	     arg_count(cmd, sysinit_ARG)) && update) {
 		log_error("Only -a permitted with --ignorelockingfailure and --sysinit");
 		return EINVALID_CMD_LINE;
 	}
 
-	if (avail_only)
+	if (!update)
 		cmd->handles_missing_pvs = 1;
 
 	if (!argc) {
@@ -769,6 +768,6 @@
 	}
 
 	return process_each_lv(cmd, argc, argv,
-			       avail_only ? 0 : READ_FOR_UPDATE, NULL,
+			       update ? READ_FOR_UPDATE : 0, NULL,
 			       &lvchange_single);
 }


             reply	other threads:[~2010-06-28 19:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28 19:10 mornfall [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-12-01  0:04 jbrassow
2009-11-04 12:39 zkabelac
2009-07-15  5:48 mornfall
2006-10-24 15:30 agk
2004-05-05 18:27 agk
2004-03-26 21:49 agk
2004-03-26 21:47 agk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100628191016.16125.qmail@sourceware.org \
    --to=mornfall@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).