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/lvmcmdline.c tools/tools.h test/she ...
Date: Fri, 16 Mar 2012 10:43:00 -0000	[thread overview]
Message-ID: <20120316104353.14779.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mornfall@sourceware.org	2012-03-16 10:43:52

Modified files:
	tools          : lvmcmdline.c tools.h 
Added files:
	test/shell     : activate-minor.sh 

Log message:
	Fix a regression in handling --major/--minor arguments to lvcreate & lvchange,
	by allowing arg_int_value to be used with groupable options.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.154&r2=1.155
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/tools.h.diff?cvsroot=lvm2&r1=1.80&r2=1.81
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/shell/activate-minor.sh.diff?cvsroot=lvm2&r1=NONE&r2=1.1

--- LVM2/tools/lvmcmdline.c	2012/03/12 14:15:04	1.154
+++ LVM2/tools/lvmcmdline.c	2012/03/16 10:43:52	1.155
@@ -94,9 +94,24 @@
 	return grouped_arg_count(av, a) ? av[a].i_value : def;
 }
 
+int32_t first_grouped_arg_int_value(struct cmd_context *cmd, int a, const int32_t def)
+{
+	struct arg_value_group_list *current_group;
+	struct arg_values *av;
+
+	dm_list_iterate_items(current_group, &cmd->arg_value_groups)  {
+		av = current_group->arg_values;
+		if (grouped_arg_count(av, a))
+			return grouped_arg_int_value(av, a, def);
+	}
+
+	return def;
+}
+
 int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def)
 {
-	return arg_count(cmd, a) ? cmd->arg_values[a].i_value : def;
+	return (_cmdline.arg_props[a].flags & ARG_GROUPABLE) ?
+		first_grouped_arg_int_value(cmd, a, def) : (arg_count(cmd, a) ? cmd->arg_values[a].i_value : def);
 }
 
 uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def)
--- LVM2/tools/tools.h	2012/03/06 02:30:50	1.80
+++ LVM2/tools/tools.h	2012/03/16 10:43:52	1.81
@@ -162,6 +162,7 @@
 const char *arg_value(struct cmd_context *cmd, int a);
 const char *arg_str_value(struct cmd_context *cmd, int a, const char *def);
 int32_t arg_int_value(struct cmd_context *cmd, int a, const int32_t def); 
+int32_t first_grouped_arg_int_value(struct cmd_context *cmd, int a, const int32_t def); 
 uint32_t arg_uint_value(struct cmd_context *cmd, int a, const uint32_t def);
 int64_t arg_int64_value(struct cmd_context *cmd, int a, const int64_t def);
 uint64_t arg_uint64_value(struct cmd_context *cmd, int a, const uint64_t def);
/cvs/lvm2/LVM2/test/shell/activate-minor.sh,v  -->  standard output
revision 1.1
--- LVM2/test/shell/activate-minor.sh
+++ -	2012-03-16 10:43:53.197583000 +0000
@@ -0,0 +1,19 @@
+#!/bin/bash
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+. lib/test
+
+aux prepare_vg 2
+lvcreate -a n --zero n -l 1 -n foo $vg
+lvchange $vg/foo -My --major=255 --minor=123
+lvchange $vg/foo -a y
+dmsetup info $vg-foo | tee info
+grep "254, 123" info


                 reply	other threads:[~2012-03-16 10:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20120316104353.14779.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).