Skip to contentSkip to conversation

LVM2 ./WHATS_NEW doc/example.conf lib/activate ...

PATCH [email protected] 1 participant 1 message Apr 26, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2007-04-26 17:45:00

Modified files:

	.              : WHATS_NEW 
	doc            : example.conf 
	lib/activate   : dev_manager.c 
	lib/commands   : toolcontext.c 
	lib/device     : dev-cache.c dev-cache.h 
	lib/filters    : filter-persistent.c filter-regex.c 

filter-sysfs.c
lib/format1 : disk-rep.c format1.c import-extents.c
lib/format_text: import_vsn1.c
lib/log : log.h
lib/metadata : metadata.c
lib/misc : lvm-file.c
lib/regex : matcher.c
tools : lvmcmdline.c

Log message:
Add devices/preferred_names config regex list for displayed device names. Free a temporary dir string in fcntl_lock_file() after use. Fix a dm_pool_destroy() in matcher_create().
Introduce goto_bad macro.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.606&r2=1.607
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/doc/example.conf.diff?cvsroot=lvm2&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/activate/dev_manager.c.diff?cvsroot=lvm2&r1=1.121&r2=1.122
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/commands/toolcontext.c.diff?cvsroot=lvm2&r1=1.49&r2=1.50
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.c.diff?cvsroot=lvm2&r1=1.45&r2=1.46
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/device/dev-cache.h.diff?cvsroot=lvm2&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-persistent.c.diff?cvsroot=lvm2&r1=1.29&r2=1.30
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-regex.c.diff?cvsroot=lvm2&r1=1.20&r2=1.21
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/filters/filter-sysfs.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/disk-rep.c.diff?cvsroot=lvm2&r1=1.65&r2=1.66
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.99&r2=1.100
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/import-extents.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/import_vsn1.c.diff?cvsroot=lvm2&r1=1.38&r2=1.39
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/log/log.h.diff?cvsroot=lvm2&r1=1.35&r2=1.36
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/lvm-file.c.diff?cvsroot=lvm2&r1=1.19&r2=1.20
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/regex/matcher.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdline.c.diff?cvsroot=lvm2&r1=1.41&r2=1.42

WHATS_NEW +13 -9
@@ -1,15 +1,20 @@
 Version 2.02.25 -
 =================================
-  Fix warnings on x86_64 involving ptrdiff_t in log_error messages
-  Update pvck to include text metadata area and record detection
-  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
-  Make lvm_dump.sh list /dev recursively
+  Add devices/preferred_names config regex list for displayed device names.
+  Free a temporary dir string in fcntl_lock_file() after use.
+  Fix a dm_pool_destroy() in matcher_create().
+  Introduce goto_bad macro.
+  Fix warnings on x86_64 involving ptrdiff_t in log_error messages.
+  Update pvck to include text metadata area and record detection.
+  Add support functions for token counting in config file extracts.
+  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.
+  Make lvm_dump.sh list /dev recursively.
   Fix thread race in clvmd.
   Add scan_sector param to label_read and _find_labeller.
-  Make clvmd cope with quorum devices on RHEL5
+  Make clvmd cope with quorum devices.
+  Add extra internal error checking to clvmd.
   Add dev_read_circular.
   Add pvck command stub.
   Update lists of attribute characters in man pages.
@@ -17,7 +22,6 @@
   Fix creation and conversion of mirrors with tags.
   Fix vgsplit for lvm1 format (set and validate VG name in PVs metadata).
   Split metadata areas in vgsplit properly.
-  Add extra internal error checking to clvmd
 
 Version 2.02.24 - 19th March 2007
 =================================
doc/example.conf +8 -0
@@ -19,6 +19,14 @@
     # to use with LVM2.
     scan = [ "/dev" ]
 
+    # If several entries in the scanned directories correspond to the
+    # same block device and the tools need to display a name for device,
+    # all the pathnames are matched against each item in the following
+    # list of regular expressions in turn and the first match is used.
+    preferred_names = [ ]
+
+    # preferred_names = [ "^/dev/mpath/", "^/dev/[hs]d" ]
+
     # A filter that tells LVM2 to only use a restricted set of devices.
     # The filter consists of an array of regular expressions.  These
     # expressions can be delimited by a character of your choice, and
lib/activate/dev_manager.c +4 -8
@@ -435,10 +435,8 @@
 		return NULL;
 	}
 
-	if (!(dm = dm_pool_alloc(mem, sizeof(*dm)))) {
-		stack;
-		goto bad;
-	}
+	if (!(dm = dm_pool_alloc(mem, sizeof(*dm))))
+		goto_bad;
 
 	dm->cmd = cmd;
 	dm->mem = mem;
@@ -450,10 +448,8 @@
 	}
 	dm->stripe_filler = stripe_filler;
 
-	if (!(dm->vg_name = dm_pool_strdup(dm->mem, vg_name))) {
-		stack;
-		goto bad;
-	}
+	if (!(dm->vg_name = dm_pool_strdup(dm->mem, vg_name)))
+		goto_bad;
 
 	dm->target_state = NULL;
 
lib/commands/toolcontext.c +2 -4
@@ -465,10 +465,8 @@
 	const struct config_node *cn;
 	struct config_value *cv;
 
-	if (!dev_cache_init()) {
-		stack;
-		return 0;
-	}
+	if (!dev_cache_init(cmd))
+		return_0;
 
 	if (!(cn = find_config_tree_node(cmd, "devices/scan"))) {
 		if (!dev_cache_add_dir("/dev")) {
lib/device/dev-cache.c +102 -1

148 lines not on this page · raw message

lib/device/dev-cache.h +4 -1
@@ -30,7 +30,8 @@
 /*
  * The global device cache.
  */
-int dev_cache_init(void);
+struct cmd_context;
+int dev_cache_init(struct cmd_context *cmd);
 void dev_cache_exit(void);
 
 /* Trigger(1) or avoid(0) a scan */
@@ -41,6 +42,8 @@
 int dev_cache_add_loopfile(const char *path);
 struct device *dev_cache_get(const char *name, struct dev_filter *f);
 
+void dev_set_preferred_name(struct str_list *sl, struct device *dev);
+
 /*
  * Object for iterating through the cache.
  */
lib/filters/filter-persistent.c +5 -8
@@ -301,10 +301,9 @@
 	}
 	memset(pf, 0, sizeof(*pf));
 
-	if (!(pf->file = dm_malloc(strlen(file) + 1))) {
-		stack;
-		goto bad;
-	}
+	if (!(pf->file = dm_malloc(strlen(file) + 1)))
+		goto_bad;
+
 	strcpy(pf->file, file);
 	pf->real = real;
 
@@ -313,10 +312,8 @@
 		goto bad;
 	}
 
-	if (!(f = dm_malloc(sizeof(*f)))) {
-		stack;
-		goto bad;
-	}
+	if (!(f = dm_malloc(sizeof(*f))))
+		goto_bad;
 
 	f->passes_filter = _lookup_p;
 	f->destroy = _persistent_destroy;
lib/filters/filter-regex.c +14 -30

84 lines not on this page · raw message

lib/filters/filter-sysfs.c +2 -4
@@ -284,10 +284,8 @@
 		goto bad;
 	}
 
-	if (!(f = dm_pool_zalloc(mem, sizeof(*f)))) {
-		stack;
-		goto bad;
-	}
+	if (!(f = dm_pool_zalloc(mem, sizeof(*f))))
+		goto_bad;
 
 	f->passes_filter = _accept_p;
 	f->destroy = _destroy;
lib/format1/disk-rep.c +2 -4
@@ -357,10 +357,8 @@
 	list_init(&dl->uuids);
 	list_init(&dl->lvds);
 
-	if (!_read_pvd(dev, &dl->pvd)) {
-		stack;
-		goto bad;
-	}
+	if (!_read_pvd(dev, &dl->pvd))
+		goto_bad;
 
 	/*
 	 * is it an orphan ?
lib/format1/format1.c +19 -28

95 lines not on this page · raw message

lib/format1/import-extents.c +6 -12
@@ -59,22 +59,16 @@
 		if (ll->lv->status & SNAPSHOT)
 			continue;
 
-		if (!(lvm = dm_pool_alloc(mem, sizeof(*lvm)))) {
-			stack;
-			goto bad;
-		}
+		if (!(lvm = dm_pool_alloc(mem, sizeof(*lvm))))
+			goto_bad;
 
 		lvm->lv = ll->lv;
 		if (!(lvm->map = dm_pool_zalloc(mem, sizeof(*lvm->map)
-					     * ll->lv->le_count))) {
-			stack;
-			goto bad;
-		}
+					     * ll->lv->le_count)))
+			goto_bad;
 
-		if (!dm_hash_insert(maps, ll->lv->name, lvm)) {
-			stack;
-			goto bad;
-		}
+		if (!dm_hash_insert(maps, ll->lv->name, lvm))
+			goto_bad;
 	}
 
 	return maps;
lib/format_text/import_vsn1.c +4 -8
@@ -660,15 +660,11 @@
 	/* eg Set to instance of fmt1 here if reading a format1 backup? */
 	vg->fid = fid;
 
-	if (!(vg->name = dm_pool_strdup(mem, vgn->key))) {
-		stack;
-		goto bad;
-	}
+	if (!(vg->name = dm_pool_strdup(mem, vgn->key)))
+		goto_bad;
 
-	if (!(vg->system_id = dm_pool_zalloc(mem, NAME_LEN))) {
-		stack;
-		goto bad;
-	}
+	if (!(vg->system_id = dm_pool_zalloc(mem, NAME_LEN)))
+		goto_bad;
 
 	vgn = vgn->child;
 
lib/log/log.h +1 -0
@@ -138,5 +138,6 @@
 #define return_0	do { stack; return 0; } while (0)
 #define return_NULL	do { stack; return NULL; } while (0)
 #define goto_out	do { stack; goto out; } while (0)
+#define goto_bad	do { stack; goto bad; } while (0)
 
 #endif
lib/metadata/metadata.c +6 -9
@@ -280,10 +280,9 @@
 	vg->seqno = 0;
 
 	vg->status = (RESIZEABLE_VG | LVM_READ | LVM_WRITE);
-	if (!(vg->system_id = dm_pool_alloc(mem, NAME_LEN))) {
-		stack;
-		goto bad;
-	}
+	if (!(vg->system_id = dm_pool_alloc(mem, NAME_LEN)))
+		goto_bad;
+
 	*vg->system_id = '\0';
 
 	vg->extent_size = extent_size;
@@ -320,7 +319,7 @@
 
 	/* attach the pv's */
 	if (!vg_extend(vg->fid, vg, pv_count, pv_names))
-		goto bad;
+		goto_bad;
 
 	return vg;
 
@@ -561,10 +560,8 @@
 
 	pv->dev = dev;
 
-	if (!(pv->vg_name = dm_pool_zalloc(mem, NAME_LEN))) {
-		stack;
-		goto bad;
-	}
+	if (!(pv->vg_name = dm_pool_zalloc(mem, NAME_LEN)))
+		goto_bad;
 
 	pv->status = ALLOCATABLE_PV;
 
lib/misc/lvm-file.c +5 -1
@@ -273,8 +273,12 @@
 	if ((c = strrchr(dir, '/')))
 		*c = '\0';
 
-	if (!create_dir(dir))
+	if (!create_dir(dir)) {
+		dm_free(dir);
 		return -1;
+	}
+
+	dm_free(dir);
 
 	log_very_verbose("Locking %s (%s, %hd)", file,
 			 (lock_type == F_WRLCK) ? "F_WRLCK" : "F_RDLCK",
lib/regex/matcher.c +8 -15
@@ -273,15 +273,12 @@
 	struct dm_pool *scratch = dm_pool_create("regex matcher", 10 * 1024);
 	struct matcher *m;
 
-	if (!scratch) {
-		stack;
-		return NULL;
-	}
+	if (!scratch)
+		return_NULL;
 
 	if (!(m = dm_pool_alloc(mem, sizeof(*m)))) {
-		stack;
 		dm_pool_destroy(scratch);
-		return NULL;
+		return_NULL;
 	}
 
 	memset(m, 0, sizeof(*m));
@@ -292,10 +289,8 @@
 
 	ptr = all = dm_pool_alloc(scratch, len + 1);
 
-	if (!all) {
-		stack;
-		goto bad;
-	}
+	if (!all)
+		goto_bad;
 
 	for (i = 0; i < num; i++) {
 		ptr += sprintf(ptr, "(.*(%s)%c)", patterns[i], TARGET_TRANS);
@@ -314,10 +309,8 @@
 	m->num_nodes = _count_nodes(rx);
 	m->nodes = dm_pool_alloc(scratch, sizeof(*m->nodes) * m->num_nodes);
 
-	if (!m->nodes) {
-		stack;
-		goto bad;
-	}
+	if (!m->nodes)
+		goto_bad;
 
 	_fill_table(m, rx);
 	_create_bitsets(m);
@@ -330,7 +323,7 @@
 
       bad:
 	dm_pool_destroy(scratch);
-	dm_pool_destroy(mem);
+	dm_pool_free(mem, m);
 	return NULL;
 }
 
tools/lvmcmdline.c +6 -6
@@ -827,30 +827,30 @@
 	 * description for backups.
 	 */
 	if (!dm_pool_begin_object(cmd->mem, 128))
-		goto bad;
+		goto_bad;
 
 	for (i = 0; i < argc; i++) {
 		space = strchr(argv[i], ' ') ? 1 : 0;
 
 		if (space && !dm_pool_grow_object(cmd->mem, "'", 1))
-			goto bad;
+			goto_bad;
 
 		if (!dm_pool_grow_object(cmd->mem, argv[i], strlen(argv[i])))
-			goto bad;
+			goto_bad;
 
 		if (space && !dm_pool_grow_object(cmd->mem, "'", 1))
-			goto bad;
+			goto_bad;
 
 		if (i < (argc - 1))
 			if (!dm_pool_grow_object(cmd->mem, " ", 1))
-				goto bad;
+				goto_bad;
 	}
 
 	/*
 	 * Terminate.
 	 */
 	if (!dm_pool_grow_object(cmd->mem, "\0", 1))
-		goto bad;
+		goto_bad;
 
 	return dm_pool_end_object(cmd->mem);