public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW lib/config/config.c lib/confi ...
@ 2011-02-18 14:08 zkabelac
  0 siblings, 0 replies; 5+ messages in thread
From: zkabelac @ 2011-02-18 14:08 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	zkabelac@sourceware.org	2011-02-18 14:08:23

Modified files:
	.              : WHATS_NEW 
	lib/config     : config.c config.h 

Log message:
	Support 64bit ints in config

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1913&r2=1.1914
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.88&r2=1.89
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.32&r2=1.33

--- LVM2/WHATS_NEW	2011/02/18 00:36:04	1.1913
+++ LVM2/WHATS_NEW	2011/02/18 14:08:22	1.1914
@@ -1,5 +1,6 @@
 Version 2.02.85 - 
 ===================================
+  Add function to read 64bit ints from config find_config_tree_int64.
   Fix to make resuming exclusive cluster mirror use local target type.
 
 Version 2.02.84 - 9th February 2011
--- LVM2/lib/config/config.c	2011/01/28 10:19:00	1.88
+++ LVM2/lib/config/config.c	2011/02/18 14:08:22	1.89
@@ -1049,6 +1049,12 @@
 	return (int) _find_config_int64(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, (int64_t) fail);
 }
 
+int64_t find_config_tree_int64(struct cmd_context *cmd, const char *path, int64_t fail)
+{
+	return _find_config_int64(cmd->cft_override ? cmd->cft_override->root : NULL,
+				  cmd->cft->root, path, fail);
+}
+
 float find_config_tree_float(struct cmd_context *cmd, const char *path,
 			     float fail)
 {
--- LVM2/lib/config/config.h	2010/12/20 13:12:56	1.32
+++ LVM2/lib/config/config.h	2011/02/18 14:08:23	1.33
@@ -95,6 +95,8 @@
 				 const char *path, const char *fail);
 int find_config_tree_int(struct cmd_context *cmd, const char *path,
 			 int fail);
+int64_t find_config_tree_int64(struct cmd_context *cmd, const char *path,
+			     int64_t fail);
 float find_config_tree_float(struct cmd_context *cmd, const char *path,
 			     float fail);
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW lib/config/config.c lib/confi ...
@ 2009-07-09 11:29 mbroz
  0 siblings, 0 replies; 5+ messages in thread
From: mbroz @ 2009-07-09 11:29 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2009-07-09 11:29:01

Modified files:
	.              : WHATS_NEW 
	lib/config     : config.c config.h 
	lib/mirror     : mirrored.c 
	lib/striped    : striped.c 

Log message:
	Fix confusing metadata syntax error messages.
	
	If there is syntax error in metadata, it now prints messages
	like:
	Couldn't read 'start_extent' for segment 'extent_count'.
	Couldn't read all logical volumes for volume group vg_test.
	
	The segment specification is wrong and confusing.
	
	Patch fixes it by introducing "parent" member in config_node which
	points to parent section and config_parent_name function, which
	provides pointer to node section name.
	
	Also it adds several LV references where possible.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1171&r2=1.1172
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.73&r2=1.74
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.61&r2=1.62
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/striped/striped.c.diff?cvsroot=lvm2&r1=1.27&r2=1.28

--- LVM2/WHATS_NEW	2009/07/09 11:28:09	1.1171
+++ LVM2/WHATS_NEW	2009/07/09 11:29:00	1.1172
@@ -1,5 +1,7 @@
 Version 2.02.49 - 
 ================================
+  Fix segment metadata read function errors to use proper segment name.
+  Add parent node to config_node structure.
   Fix segment import functions to print segment name and logical volume name.
   Update vgsplit and vgcreate to call the new vg_create, then call 'set' fns.
   Change vg_create to take minimal parameters, obtain a lock, and return vg_t.
--- LVM2/lib/config/config.c	2009/03/26 09:25:18	1.73
+++ LVM2/lib/config/config.c	2009/07/09 11:29:00	1.74
@@ -546,6 +546,7 @@
 			root = n;
 		else
 			l->sib = n;
+		n->parent = root;
 		l = n;
 	}
 	return root;
@@ -573,6 +574,7 @@
 				root->child = n;
 			else
 				l->sib = n;
+			n->parent = root;
 			l = n;
 		}
 		match(TOK_SECTION_E);
@@ -1251,6 +1253,10 @@
 	return count_chars(str, len, c);
 }
 
+const char *config_parent_name(const struct config_node *n)
+{
+	return (n->parent ? n->parent->key : "(root)");
+}
 /*
  * Heuristic function to make a quick guess as to whether a text
  * region probably contains a valid config "section".  (Useful for
--- LVM2/lib/config/config.h	2008/11/03 22:14:27	1.26
+++ LVM2/lib/config/config.h	2009/07/09 11:29:00	1.27
@@ -40,7 +40,7 @@
 
 struct config_node {
 	char *key;
-	struct config_node *sib, *child;
+	struct config_node *parent, *sib, *child;
 	struct config_value *v;
 };
 
@@ -110,4 +110,6 @@
 
 unsigned maybe_config_section(const char *str, unsigned len);
 
+const char *config_parent_name(const struct config_node *n);
+
 #endif
--- LVM2/lib/mirror/mirrored.c	2009/02/28 20:04:25	1.61
+++ LVM2/lib/mirror/mirrored.c	2009/07/09 11:29:00	1.62
@@ -78,7 +78,7 @@
 {
 	if (!get_config_uint32(sn, "mirror_count", area_count)) {
 		log_error("Couldn't read 'mirror_count' for "
-			  "segment '%s'.", sn->key);
+			  "segment '%s'.", config_parent_name(sn));
 		return 0;
 	}
 
@@ -97,7 +97,8 @@
 			seg->status |= PVMOVE;
 		else {
 			log_error("Couldn't read 'extents_moved' for "
-				  "segment '%s'.", sn->key);
+				  "segment %s of logical volume %s.",
+				  config_parent_name(sn), seg->lv->name);
 			return 0;
 		}
 	}
@@ -106,7 +107,8 @@
 		if (!get_config_uint32(sn, "region_size",
 				      &seg->region_size)) {
 			log_error("Couldn't read 'region_size' for "
-				  "segment '%s'.", sn->key);
+				  "segment %s of logical volume %s.",
+				  config_parent_name(sn), seg->lv->name);
 			return 0;
 		}
 	}
@@ -118,22 +120,25 @@
 		}
 		logname = cn->v->v.str;
 		if (!(seg->log_lv = find_lv(seg->lv->vg, logname))) {
-			log_error("Unrecognised mirror log in segment %s.",
-				  sn->key);
+			log_error("Unrecognised mirror log in "
+				  "segment %s of logical volume %s.",
+				  config_parent_name(sn), seg->lv->name);
 			return 0;
 		}
 		seg->log_lv->status |= MIRROR_LOG;
 	}
 
 	if (logname && !seg->region_size) {
-		log_error("Missing region size for mirror log for segment "
-			  "'%s'.", sn->key);
+		log_error("Missing region size for mirror log for "
+			  "segment %s of logical volume %s.",
+			  config_parent_name(sn), seg->lv->name);
 		return 0;
 	}
 
 	if (!(cn = find_config_node(sn, "mirrors"))) {
-		log_error("Couldn't find mirrors array for segment "
-			  "'%s'.", sn->key);
+		log_error("Couldn't find mirrors array for "
+			  "segment %s of logical volume %s.",
+			  config_parent_name(sn), seg->lv->name);
 		return 0;
 	}
 
--- LVM2/lib/striped/striped.c	2009/02/28 20:04:25	1.27
+++ LVM2/lib/striped/striped.c	2009/07/09 11:29:01	1.28
@@ -54,7 +54,7 @@
 {
 	if (!get_config_uint32(sn, "stripe_count", area_count)) {
 		log_error("Couldn't read 'stripe_count' for "
-			  "segment '%s'.", sn->key);
+			  "segment '%s'.", config_parent_name(sn));
 		return 0;
 	}
 
@@ -68,14 +68,14 @@
 
 	if ((seg->area_count != 1) &&
 	    !get_config_uint32(sn, "stripe_size", &seg->stripe_size)) {
-		log_error("Couldn't read stripe_size for segment '%s'.",
-			  sn->key);
+		log_error("Couldn't read stripe_size for segment %s "
+			  "of logical volume %s.", config_parent_name(sn), seg->lv->name);
 		return 0;
 	}
 
 	if (!(cn = find_config_node(sn, "stripes"))) {
-		log_error("Couldn't find stripes array for segment "
-			  "'%s'.", sn->key);
+		log_error("Couldn't find stripes array for segment %s "
+			  "of logical volume %s.", config_parent_name(sn), seg->lv->name);
 		return 0;
 	}
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW lib/config/config.c lib/confi ...
@ 2007-04-27 20:41 agk
  0 siblings, 0 replies; 5+ messages in thread
From: agk @ 2007-04-27 20:41 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-04-27 21:41:50

Modified files:
	.              : WHATS_NEW 
	lib/config     : config.c config.h 

Log message:
	Fix get_config_uint64() to read a 64-bit value not a 32-bit one.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.610&r2=1.611
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.23&r2=1.24

--- LVM2/WHATS_NEW	2007/04/27 19:26:56	1.610
+++ LVM2/WHATS_NEW	2007/04/27 20:41:49	1.611
@@ -1,5 +1,6 @@
 Version 2.02.25 -
 =================================
+  Fix get_config_uint64() to read a 64-bit value not a 32-bit one.
   Add -Wformat-security and change one fprintf() to fputs().
   Move regex functions into libdevmapper.
   Change some #include lines to search only standard system directories.
--- LVM2/lib/config/config.c	2007/04/26 16:40:46	1.57
+++ LVM2/lib/config/config.c	2007/04/27 20:41:50	1.58
@@ -357,7 +357,7 @@
 		break;
 
 	case CFG_INT:
-		fprintf(fp, "%d", v->v.i);
+		fprintf(fp, "%" PRId64, v->v.i);
 		break;
 
 	case CFG_EMPTY_ARRAY:
@@ -568,7 +568,7 @@
 	switch (p->t) {
 	case TOK_INT:
 		v->type = CFG_INT;
-		v->v.i = strtol(p->tb, NULL, 0);	/* FIXME: check error */
+		v->v.i = strtoll(p->tb, NULL, 0);	/* FIXME: check error */
 		match(TOK_INT);
 		break;
 
@@ -871,25 +871,26 @@
 	return _find_config_str(cn, NULL, path, fail);
 }
 
-static int _find_config_int(const struct config_node *cn1,
-			    const struct config_node *cn2,
-			    const char *path, int fail)
+static int64_t _find_config_int64(const struct config_node *cn1,
+				  const struct config_node *cn2,
+				  const char *path, int64_t fail)
 {
 	const struct config_node *n = _find_first_config_node(cn1, cn2, path);
 
 	if (n && n->v && n->v->type == CFG_INT) {
-		log_very_verbose("Setting %s to %d", path, n->v->v.i);
+		log_very_verbose("Setting %s to %" PRId64, path, n->v->v.i);
 		return n->v->v.i;
 	}
 
-	log_very_verbose("%s not found in config: defaulting to %d",
+	log_very_verbose("%s not found in config: defaulting to %" PRId64,
 			 path, fail);
 	return fail;
 }
 
 int find_config_int(const struct config_node *cn, const char *path, int fail)
 {
-	return _find_config_int(cn, NULL, path, fail);
+	/* FIXME Add log_error message on overflow */
+	return (int) _find_config_int64(cn, NULL, path, (int64_t) fail);
 }
 
 static float _find_config_float(const struct config_node *cn1,
@@ -931,7 +932,8 @@
 int find_config_tree_int(struct cmd_context *cmd, const char *path,
                          int fail)
 {
-	return _find_config_int(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, fail);
+	/* FIXME Add log_error message on overflow */
+	return (int) _find_config_int64(cmd->cft_override ? cmd->cft_override->root : NULL, cmd->cft->root, path, (int64_t) fail);
 }
 
 float find_config_tree_float(struct cmd_context *cmd, const char *path,
@@ -1023,7 +1025,6 @@
 	if (!n || !n->v || n->v->type != CFG_INT)
 		return 0;
 
-	/* FIXME Support 64-bit value! */
 	*result = (uint64_t) n->v->v.i;
 	return 1;
 }
--- LVM2/lib/config/config.h	2007/04/25 20:38:39	1.23
+++ LVM2/lib/config/config.h	2007/04/27 20:41:50	1.24
@@ -31,7 +31,7 @@
 struct config_value {
 	int type;
 	union {
-		int i;
+		int64_t i;
 		float r;
 		char *str;
 	} v;


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW lib/config/config.c lib/confi ...
@ 2007-04-25 20:38 wysochanski
  0 siblings, 0 replies; 5+ messages in thread
From: wysochanski @ 2007-04-25 20:38 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	wysochanski@sourceware.org	2007-04-25 21:38:39

Modified files:
	.              : WHATS_NEW 
	lib/config     : config.c config.h 

Log message:
	Add support functions for analysis of config sections,
	and hence, on-disk LVM2 metadata.
	
	--

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.603&r2=1.604
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.55&r2=1.56
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.22&r2=1.23

--- LVM2/WHATS_NEW	2007/04/25 20:03:15	1.603
+++ LVM2/WHATS_NEW	2007/04/25 20:38:39	1.604
@@ -1,5 +1,6 @@
 Version 2.02.25 -
 =================================
+  Add support functions for analysis of config sections
   Update pvck to read labels on disk, with --labelsector parameter
   Add count_chars and count_chars_len functions
   Add /sys/block listings to lvm_dump.sh
--- LVM2/lib/config/config.c	2007/04/19 02:10:42	1.55
+++ LVM2/lib/config/config.c	2007/04/25 20:38:39	1.56
@@ -19,6 +19,7 @@
 #include "device.h"
 #include "str_list.h"
 #include "toolcontext.h"
+#include "lvm-string.h"
 
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -26,6 +27,9 @@
 #include <fcntl.h>
 #include <ctype.h>
 
+#define SECTION_B_CHAR '{'
+#define SECTION_E_CHAR '}'
+
 enum {
 	TOK_INT,
 	TOK_FLOAT,
@@ -474,7 +478,7 @@
 
 static struct config_node *_section(struct parser *p)
 {
-	/* IDENTIFIER '{' VALUE* '}' */
+	/* IDENTIFIER SECTION_B_CHAR VALUE* SECTION_E_CHAR */
 	struct config_node *root, *n, *l = NULL;
 	if (!(root = _create_node(p))) {
 		stack;
@@ -623,12 +627,12 @@
 	p->t = TOK_INT;		/* fudge so the fall through for
 				   floats works */
 	switch (*p->te) {
-	case '{':
+	case SECTION_B_CHAR:
 		p->t = TOK_SECTION_B;
 		p->te++;
 		break;
 
-	case '}':
+	case SECTION_E_CHAR:
 		p->t = TOK_SECTION_E;
 		p->te++;
 		break;
@@ -708,8 +712,9 @@
 	default:
 		p->t = TOK_IDENTIFIER;
 		while ((p->te != p->fe) && (*p->te) && !isspace(*p->te) &&
-		       (*p->te != '#') && (*p->te != '=') && (*p->te != '{') &&
-		       (*p->te != '}'))
+		       (*p->te != '#') && (*p->te != '=') &&
+		       (*p->te != SECTION_B_CHAR) &&
+		       (*p->te != SECTION_E_CHAR))
 			p->te++;
 		break;
 	}
@@ -1146,3 +1151,61 @@
 
 	return 1;
 }
+
+/*
+ * Convert a token type to the char it represents.
+ */
+static char _token_type_to_char(int type)
+{
+	switch (type) {
+		case TOK_SECTION_B:
+			return SECTION_B_CHAR;
+		case TOK_SECTION_E:
+			return SECTION_E_CHAR;
+		default:
+			return 0;
+	}
+}
+
+/*
+ * Returns:
+ *  # of 'type' tokens in 'str'.
+ */
+static unsigned _count_tokens (const char *str, unsigned len, int type)
+{
+	char c;
+
+	c = _token_type_to_char(type);
+
+	return(count_chars_len(str, len, c));
+}
+
+/*
+ * Heuristic function to make a quick guess as to whether a text
+ * region probably contains a valid config "section".  (Useful for
+ * scanning areas of the disk for old metadata.)
+ * Config sections contain various tokens, may contain other sections
+ * and strings, and are delimited by begin (type 'TOK_SECTION_B') and
+ * end (type 'TOK_SECTION_E') tokens.  As a quick heuristic, we just
+ * count the number of begin and end tokens, and see if they are
+ * non-zero and the counts match.
+ * Full validation of the section should be done with another function
+ * (for example, read_config_fd).
+ *
+ * Returns:
+ *  0 - probably is not a valid config section
+ *  1 - probably _is_ a valid config section
+ */
+unsigned maybe_config_section(const char *str, unsigned len)
+{
+	int begin_count;
+	int end_count;
+
+	begin_count = _count_tokens(str, len, TOK_SECTION_B);
+	end_count = _count_tokens(str, len, TOK_SECTION_E);
+
+	if (begin_count && end_count && (begin_count - end_count == 0))
+		return 1;
+	else
+		return 0;
+}
--- LVM2/lib/config/config.h	2007/01/09 23:22:31	1.22
+++ LVM2/lib/config/config.h	2007/04/25 20:38:39	1.23
@@ -108,4 +108,6 @@
 int get_config_str(const struct config_node *cn, const char *path,
 		   char **result);
 
+unsigned maybe_config_section(const char *str, unsigned len);
+
 #endif


^ permalink raw reply	[flat|nested] 5+ messages in thread

* LVM2 ./WHATS_NEW lib/config/config.c lib/confi ...
@ 2007-01-09 23:22 agk
  0 siblings, 0 replies; 5+ messages in thread
From: agk @ 2007-01-09 23:22 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	agk@sourceware.org	2007-01-09 23:22:32

Modified files:
	.              : WHATS_NEW 
	lib/config     : config.c config.h 
	tools          : commands.h dumpconfig.c 

Log message:
	dumpconfig accepts a list of configuration variables to display.
	Change dumpconfig to use --file to redirect output to a file.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.531&r2=1.532
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/config/config.h.diff?cvsroot=lvm2&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/commands.h.diff?cvsroot=lvm2&r1=1.92&r2=1.93
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/dumpconfig.c.diff?cvsroot=lvm2&r1=1.4&r2=1.5

--- LVM2/WHATS_NEW	2007/01/09 23:14:35	1.531
+++ LVM2/WHATS_NEW	2007/01/09 23:22:31	1.532
@@ -1,5 +1,7 @@
 Version 2.02.18 -
 ====================================
+  dumpconfig accepts a list of configuration variables to display.
+  Change dumpconfig to use --file to redirect output to a file.
   Avoid vgreduce error when mirror code removes the log LV.
   Remove 3 redundant AC_MSG_RESULTs from configure.in.
   Free memory in _raw_read_mda_header() error paths.
--- LVM2/lib/config/config.c	2006/11/21 15:13:36	1.50
+++ LVM2/lib/config/config.c	2007/01/09 23:22:31	1.51
@@ -373,7 +373,8 @@
 	}
 }
 
-static int _write_config(struct config_node *n, FILE *fp, int level)
+static int _write_config(struct config_node *n, int only_one, FILE *fp,
+			 int level)
 {
 	char space[MAX_INDENT + 1];
 	int l = (level < MAX_INDENT) ? level : MAX_INDENT;
@@ -386,12 +387,12 @@
 		space[i] = '\t';
 	space[i] = '\0';
 
-	while (n) {
+	do {
 		fprintf(fp, "%s%s", space, n->key);
 		if (!n->v) {
 			/* it's a sub section */
 			fprintf(fp, " {\n");
-			_write_config(n->child, fp, level + 1);
+			_write_config(n->child, 0, fp, level + 1);
 			fprintf(fp, "%s}", space);
 		} else {
 			/* it's a value */
@@ -411,13 +412,15 @@
 		}
 		fprintf(fp, "\n");
 		n = n->sib;
-	}
+	} while (n && !only_one);
 	/* FIXME: add error checking */
 	return 1;
 }
 
-int write_config_file(struct config_tree *cft, const char *file)
+int write_config_file(struct config_tree *cft, const char *file,
+		      int argc, char **argv)
 {
+	struct config_node *cn;
 	int r = 1;
 	FILE *fp;
 
@@ -430,9 +433,22 @@
 	}
 
 	log_verbose("Dumping configuration to %s", file);
-	if (!_write_config(cft->root, fp, 0)) {
-		log_error("Failure while writing configuration");
-		r = 0;
+	if (!argc) {
+		if (!_write_config(cft->root, 0, fp, 0)) {
+			log_error("Failure while writing configuration");
+			r = 0;
+		}
+	} else while (argc--) {
+		if ((cn = find_config_node(cft->root, *argv))) {
+			if (!_write_config(cn, 1, fp, 0)) {
+				log_error("Failure while writing configuration");
+				r = 0;
+			}
+		} else {
+			log_error("Configuration node %s not found", *argv);
+			r = 0;
+		}
+		argv++;
 	}
 
 	if (fp != stdout)
--- LVM2/lib/config/config.h	2006/11/04 03:34:09	1.21
+++ LVM2/lib/config/config.h	2007/01/09 23:22:31	1.22
@@ -65,7 +65,8 @@
 		   checksum_fn_t checksum_fn, uint32_t checksum);
 
 int read_config_file(struct config_tree *cft);
-int write_config_file(struct config_tree *cft, const char *file);
+int write_config_file(struct config_tree *cft, const char *file,
+		      int argc, char **argv);
 time_t config_file_timestamp(struct config_tree *cft);
 int config_file_changed(struct config_tree *cft);
 int merge_config_tree(struct cmd_context *cmd, struct config_tree *cft,
--- LVM2/tools/commands.h	2006/11/10 18:24:11	1.92
+++ LVM2/tools/commands.h	2007/01/09 23:22:31	1.93
@@ -30,7 +30,10 @@
 
 xx(dumpconfig,
    "Dump active configuration",
-   "dumpconfig <filename>\n")
+   "dumpconfig "
+   "\t[-f|--file filename] " "\n"
+   "[ConfigurationVariable...]\n",
+   file_ARG)
 
 xx(formats,
    "List available metadata formats",
--- LVM2/tools/dumpconfig.c	2004/03/30 19:35:42	1.4
+++ LVM2/tools/dumpconfig.c	2007/01/09 23:22:31	1.5
@@ -19,15 +19,10 @@
 {
 	const char *file = NULL;
 
-	if (argc == 1)
-		file = argv[0];
+	if (arg_count(cmd, file_ARG))
+		file = arg_str_value(cmd, file_ARG, "");
 
-	if (argc > 1) {
-		log_error("Please specify one file for output");
-		return EINVALID_CMD_LINE;
-	}
-
-	if (!write_config_file(cmd->cft, file))
+	if (!write_config_file(cmd->cft, file, argc, argv))
 		return ECMD_FAILED;
 
 	return ECMD_PROCESSED;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-18 14:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-18 14:08 LVM2 ./WHATS_NEW lib/config/config.c lib/confi zkabelac
  -- strict thread matches above, loose matches on Subject: below --
2009-07-09 11:29 mbroz
2007-04-27 20:41 agk
2007-04-25 20:38 wysochanski
2007-01-09 23:22 agk

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