Skip to contentSkip to conversation

LVM2 ./WHATS_NEW tools/lvchange.c tools/pvchan ...

PATCH [email protected] 1 participant 1 message Jan 24, 2011

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2011-01-24 13:38:33

Modified files:
. : WHATS_NEW
tools : lvchange.c pvchange.c toollib.c toollib.h
vgchange.c

Log message:
Add change_tag to toollib.
Allow multiple pvchange command line options to be specified together.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1886&r2=1.1887
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvchange.c.diff?cvsroot=lvm2&r1=1.127&r2=1.128
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvchange.c.diff?cvsroot=lvm2&r1=1.87&r2=1.88
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.218&r2=1.219
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.75&r2=1.76
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgchange.c.diff?cvsroot=lvm2&r1=1.117&r2=1.118

WHATS_NEW +2 -0
@@ -1,5 +1,7 @@
 Version 2.02.82 -
 ===================================
+  Add change_tag to toollib.
+  Allow multiple pvchange command line options to be specified together.
   Add -f (don't fork) option to clvmd and fix clvmd -d<num> description.
   Fix possible clvmd DLM lockspace increasing reference count.
   Do not fail polling if pvmove finished in another process.
tools/lvchange.c +3 -17
@@ -491,24 +491,10 @@
 	return 1;
 }
 
-static int lvchange_tag(struct cmd_context *cmd, struct logical_volume *lv,
-			int arg)
+static int lvchange_tag(struct cmd_context *cmd, struct logical_volume *lv, int arg)
 {
-	const char *tag;
-	struct arg_value_group_list *current_group;
-
-	dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
-		if (!grouped_arg_is_set(current_group->arg_values, arg))
-			continue;
-
-		if (!(tag = grouped_arg_str_value(current_group->arg_values, arg, NULL))) {
-			log_error("Failed to get tag");
-			return 0;
-		}
-
-		if (!lv_change_tag(lv, tag, arg == addtag_ARG))
-			return_0;
-	}
+	if (!change_tag(cmd, NULL, lv, NULL, arg))
+		return_0;
 
 	log_very_verbose("Updating logical volume \"%s\" on disk(s)", lv->name);
 
tools/pvchange.c +35 -58

194 lines not on this page · raw message

tools/toollib.c +46 -2

63 lines not on this page · raw message

tools/toollib.h +3 -0
@@ -115,4 +115,7 @@
 int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes,
 		      uint32_t *stripe_size);
 
+int change_tag(struct cmd_context *cmd, struct volume_group *vg,
+	       struct logical_volume *lv, struct physical_volume *pv, int arg);
+
 #endif
tools/vgchange.c +2 -25
@@ -360,37 +360,14 @@
 	return 1;
 }
 
-static int _vgchange_tag(struct cmd_context *cmd, struct volume_group *vg,
-			 int arg)
-{
-	const char *tag;
-	struct arg_value_group_list *current_group;
-
-	dm_list_iterate_items(current_group, &cmd->arg_value_groups) {
-		if (!grouped_arg_is_set(current_group->arg_values, arg))
-			continue;
-
-		if (!(tag = grouped_arg_str_value(current_group->arg_values, arg, NULL))) {
-			log_error("Failed to get tag");
-			return 0;
-		}
-
-		if (!vg_change_tag(vg, tag, arg == addtag_ARG))
-			return_0;
-
-	}
-
-	return 1;
-}
-
 static int _vgchange_addtag(struct cmd_context *cmd, struct volume_group *vg)
 {
-	return _vgchange_tag(cmd, vg, addtag_ARG);
+	return change_tag(cmd, vg, NULL, NULL, addtag_ARG);
 }
 
 static int _vgchange_deltag(struct cmd_context *cmd, struct volume_group *vg)
 {
-	return _vgchange_tag(cmd, vg, deltag_ARG);
+	return change_tag(cmd, vg, NULL, NULL, deltag_ARG);
 }
 
 static int _vgchange_uuid(struct cmd_context *cmd __attribute__((unused)),