public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: agk@sourceware.org
To: lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW tools/lvcreate.c tools/lvrena ...
Date: Fri, 25 Aug 2006 23:02:00 -0000	[thread overview]
Message-ID: <20060825230235.8980.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2006-08-25 23:02:33

Modified files:
	.              : WHATS_NEW 
	tools          : lvcreate.c lvrename.c pvmove.c toollib.c 
	                 toollib.h vgcfgrestore.c vgcreate.c vgextend.c 
	                 vgmerge.c vgreduce.c vgrename.c 

Log message:
	Add skip_dev_dir() to process command line VGs.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.431&r2=1.432
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvrename.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/pvmove.c.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.c.diff?cvsroot=lvm2&r1=1.85&r2=1.86
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/toollib.h.diff?cvsroot=lvm2&r1=1.41&r2=1.42
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcfgrestore.c.diff?cvsroot=lvm2&r1=1.11&r2=1.12
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgcreate.c.diff?cvsroot=lvm2&r1=1.46&r2=1.47
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgextend.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgmerge.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgreduce.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgrename.c.diff?cvsroot=lvm2&r1=1.39&r2=1.40

--- LVM2/WHATS_NEW	2006/08/24 12:45:04	1.431
+++ LVM2/WHATS_NEW	2006/08/25 23:02:33	1.432
@@ -1,11 +1,12 @@
 Version 2.02.10 - 
 ==================================
+  Add skip_dev_dir() to process command line VGs.
+  Stop clvmd complaining about nodes that have left the cluster.
   Move lvm_snprintf(), split_words() and split_dm_name() into libdevmapper.
   Add lvconvert man page.
   Add mirror options to man pages.
   Prevent mirror renames.
   Move CMDLIB code into separate file and record whether static build.
-  Stop clvmd complaining about nodes that have left the cluster
 
 Version 2.02.09 - 17th August 2006
 ==================================
--- LVM2/tools/lvcreate.c	2006/08/17 18:23:44	1.122
+++ LVM2/tools/lvcreate.c	2006/08/25 23:02:33	1.123
@@ -94,19 +94,7 @@
 			}
 
 		} else {
-			vg_name = argv[0];
-			/* Strip dev_dir (optional) */
-			if (*vg_name == '/') {
-				while (*vg_name == '/')
-					vg_name++;
-				vg_name--;
-			}
-			if (!strncmp(vg_name, cmd->dev_dir,
-				     strlen(cmd->dev_dir))) {
-				vg_name += strlen(cmd->dev_dir);
-				while (*vg_name == '/')
-					vg_name++;
-			}
+			vg_name = skip_dev_dir(cmd, argv[0]);
 			if (strrchr(vg_name, '/')) {
 				log_error("Volume group name expected "
 					  "(no slash)");
--- LVM2/tools/lvrename.c	2006/08/18 21:19:54	1.38
+++ LVM2/tools/lvrename.c	2006/08/25 23:02:33	1.39
@@ -29,9 +29,7 @@
 	struct lv_list *lvl;
 
 	if (argc == 3) {
-		vg_name = argv[0];
-		if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir)))
-			vg_name += strlen(cmd->dev_dir);
+		vg_name = skip_dev_dir(cmd, argv[0]);
 		lv_name_old = argv[1];
 		lv_name_new = argv[2];
 		if (strchr(lv_name_old, '/') &&
--- LVM2/tools/pvmove.c	2006/05/09 21:23:51	1.30
+++ LVM2/tools/pvmove.c	2006/08/25 23:02:33	1.31
@@ -27,9 +27,7 @@
 	if (!strchr(arg, '/'))
 		return arg;
 
-	lvname = arg;
-	if (!strncmp(lvname, cmd->dev_dir, strlen(cmd->dev_dir)))
-		lvname += strlen(cmd->dev_dir);
+	lvname = skip_dev_dir(cmd, arg);
 	while (*lvname == '/')
 		lvname++;
 	if (!strchr(lvname, '/')) {
--- LVM2/tools/toollib.c	2006/08/21 12:54:53	1.85
+++ LVM2/tools/toollib.c	2006/08/25 23:02:33	1.86
@@ -81,6 +81,28 @@
 }
 
 /*
+ * Strip dev_dir if present
+ */
+char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name)
+{
+	/* FIXME Do this properly */
+
+	if (*vg_name == '/') {
+		while (*vg_name == '/')
+			vg_name++;
+		vg_name--;
+	}
+
+	if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir))) {
+		vg_name += strlen(cmd->dev_dir);
+		while (*vg_name == '/')
+			vg_name++;
+	}
+
+	return (char *) vg_name;
+}
+
+/*
  * Metadata iteration functions
  */
 int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
@@ -450,7 +472,6 @@
 	struct list arg_vgnames, tags;
 
 	const char *vg_name, *vgid;
-	char *dev_dir = cmd->dev_dir;
 
 	list_init(&tags);
 	list_init(&arg_vgnames);
@@ -475,13 +496,7 @@
 				continue;
 			}
 
-			if (*vg_name == '/') {
-				while (*vg_name == '/')
-					vg_name++;
-				vg_name--;
-			}
-			if (!strncmp(vg_name, dev_dir, strlen(dev_dir)))
-				vg_name += strlen(dev_dir);
+			vg_name = skip_dev_dir(cmd, vg_name);
 			if (strchr(vg_name, '/')) {
 				log_error("Invalid volume group name: %s",
 					  vg_name);
@@ -768,21 +783,13 @@
 char *default_vgname(struct cmd_context *cmd)
 {
 	char *vg_path;
-	char *dev_dir = cmd->dev_dir;
 
 	/* Take default VG from environment? */
 	vg_path = getenv("LVM_VG_NAME");
 	if (!vg_path)
 		return 0;
 
-	/* Strip dev_dir (optional) */
-	if (*vg_path == '/') {
-		while (*vg_path == '/')
-			vg_path++;
-		vg_path--;
-	}
-	if (!strncmp(vg_path, dev_dir, strlen(dev_dir)))
-		vg_path += strlen(dev_dir);
+	vg_path = skip_dev_dir(cmd, vg_path);
 
 	if (strchr(vg_path, '/')) {
 		log_error("Environment Volume Group in LVM_VG_NAME invalid: "
--- LVM2/tools/toollib.h	2006/05/11 18:39:24	1.41
+++ LVM2/tools/toollib.h	2006/08/25 23:02:33	1.42
@@ -76,6 +76,7 @@
 
 char *default_vgname(struct cmd_context *cmd);
 const char *extract_vgname(struct cmd_context *cmd, const char *lv_name);
+char *skip_dev_dir(struct cmd_context *cmd, const char *vg_name);
 
 /*
  * Builds a list of pv's from the names in argv.  Used in
--- LVM2/tools/vgcfgrestore.c	2004/03/30 19:35:44	1.11
+++ LVM2/tools/vgcfgrestore.c	2006/08/25 23:02:33	1.12
@@ -24,10 +24,7 @@
 		return ECMD_FAILED;
 	}
 
-	vg_name = argv[0];
-
-	if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir)))
-		vg_name += strlen(cmd->dev_dir);
+	vg_name = skip_dev_dir(cmd, argv[0]);
 
 	if (!validate_name(vg_name)) {
 		log_error("Volume group name \"%s\" is invalid", vg_name);
--- LVM2/tools/vgcreate.c	2006/05/09 21:23:51	1.46
+++ LVM2/tools/vgcreate.c	2006/08/25 23:02:33	1.47
@@ -38,7 +38,7 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name = argv[0];
+	vg_name = skip_dev_dir(cmd, argv[0]);
 	max_lv = arg_uint_value(cmd, maxlogicalvolumes_ARG, 0);
 	max_pv = arg_uint_value(cmd, maxphysicalvolumes_ARG, 0);
 	alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL);
@@ -84,10 +84,6 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	/* Strip dev_dir if present */
-	if (!strncmp(vg_name, cmd->dev_dir, strlen(cmd->dev_dir)))
-		vg_name += strlen(cmd->dev_dir);
-
 	if (!validate_vg_name(cmd, vg_name)) {
 		log_error("New volume group name \"%s\" is invalid", vg_name);
 		return ECMD_FAILED;
--- LVM2/tools/vgextend.c	2006/04/12 21:23:04	1.25
+++ LVM2/tools/vgextend.c	2006/08/25 23:02:33	1.26
@@ -32,7 +32,7 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name = argv[0];
+	vg_name = skip_dev_dir(cmd, argv[0]);
 	argc--;
 	argv++;
 
--- LVM2/tools/vgmerge.c	2006/05/11 17:58:58	1.32
+++ LVM2/tools/vgmerge.c	2006/08/25 23:02:33	1.33
@@ -231,7 +231,7 @@
 
 int vgmerge(struct cmd_context *cmd, int argc, char **argv)
 {
-	char *vg_name_to;
+	char *vg_name_to, *vg_name_from;
 	int opt = 0;
 	int ret = 0, ret_max = 0;
 
@@ -240,12 +240,14 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name_to = argv[0];
+	vg_name_to = skip_dev_dir(cmd, argv[0]);
 	argc--;
 	argv++;
 
 	for (; opt < argc; opt++) {
-		ret = _vgmerge_single(cmd, vg_name_to, argv[opt]);
+		vg_name_from = skip_dev_dir(cmd, argv[opt]);
+
+		ret = _vgmerge_single(cmd, vg_name_to, vg_name_from);
 		if (ret > ret_max)
 			ret_max = ret;
 	}
--- LVM2/tools/vgreduce.c	2006/07/04 19:52:47	1.50
+++ LVM2/tools/vgreduce.c	2006/08/25 23:02:33	1.51
@@ -459,7 +459,7 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name = argv[0];
+	vg_name = skip_dev_dir(cmd, argv[0]);
 	argv++;
 	argc--;
 
--- LVM2/tools/vgrename.c	2006/05/09 21:23:51	1.39
+++ LVM2/tools/vgrename.c	2006/08/25 23:02:33	1.40
@@ -35,18 +35,12 @@
 		return EINVALID_CMD_LINE;
 	}
 
-	vg_name_old = argv[0];
-	vg_name_new = argv[1];
+	vg_name_old = skip_dev_dir(cmd, argv[0]);
+	vg_name_new = skip_dev_dir(cmd, argv[1]);
 
 	dev_dir = cmd->dev_dir;
 	length = strlen(dev_dir);
 
-	/* If present, strip dev_dir */
-	if (!strncmp(vg_name_old, dev_dir, length))
-		vg_name_old += length;
-	if (!strncmp(vg_name_new, dev_dir, length))
-		vg_name_new += length;
-
 	/* Check sanity of new name */
 	if (strlen(vg_name_new) > NAME_LEN - length - 2) {
 		log_error("New volume group path exceeds maximum length "


             reply	other threads:[~2006-08-25 23:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25 23:02 agk [this message]
2007-03-09 20:47 agk
2009-06-26  9:19 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=20060825230235.8980.qmail@sourceware.org \
    --to=agk@sourceware.org \
    --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).