All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <45A81A61.4070401@ce.jp.nec.com>

diff --git a/a/1.txt b/N1/1.txt
index f2992f1..d49c7fc 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -44,3 +44,10 @@ except for a few spacing difference, which should be harmless.
 Thanks,
 --
 Jun'ichi Nomura, NEC Corporation of America
+-------------- next part --------------
+A non-text attachment was scrubbed...
+Name: 02-dmsetup-report.patch
+Type: text/x-patch
+Size: 17162 bytes
+Desc: not available
+URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070112/47367b4c/attachment.bin>
diff --git a/a/2.hdr b/a/2.hdr
deleted file mode 100644
index dd6eca5..0000000
--- a/a/2.hdr
+++ /dev/null
@@ -1,5 +0,0 @@
-Content-Type: text/x-patch;
- name="02-dmsetup-report.patch"
-Content-Transfer-Encoding: 7bit
-Content-Disposition: inline;
- filename="02-dmsetup-report.patch"
diff --git a/a/2.txt b/a/2.txt
deleted file mode 100644
index f25e9e1..0000000
--- a/a/2.txt
+++ /dev/null
@@ -1,621 +0,0 @@
-Extend "dmsetup info -c -o" using dm_report API.
-New options "-O" and "--seprator" are also added.
-
-  Usage:
-    dmsetup info -c -o <field1>[,<field2>...] \
-                   [-O <field>[,<field>...]
-                   [--separator <string>]
-
-Combination of the following field name is allowed:
-    name
-    device
-    major
-    minor
-    uuid
-    status
-    open_count
-    target_count
-    event_nr
-    deps
-    deps_count
-    parents
-    parents_count
-    parent_maps
-
-Examples:
-
-If you have the following dm tree:
-    # dmsetup ls --tree -o inverted
-     (7:0)
-     |-d4 (254:6)
-     |  |-testvg-lvol2 (254:17)
-     |  `-testvg-lvol0-real (254:15)
-     |     |-testvg-lvol1 (254:14)
-     |     `-testvg-lvol0 (254:13)
-     |-d1 (254:3)
-     |  |-testvg-m1_mimage_0 (254:10)
-     |  |  `-testvg-m1 (254:12)
-     |  `-testvg-lvol2 (254:17)
-     |-d3 (254:5)
-     |  `-testvg-lvol0-real (254:15)
-     |     |-testvg-lvol1 (254:14)
-     |     `-testvg-lvol0 (254:13)
-     |-d2 (254:4)
-     |  |-testvg-m1_mimage_1 (254:11)
-     |  |  `-testvg-m1 (254:12)
-     |  `-testvg-lvol2 (254:17)
-     |-d7 (254:9)
-     |  `-testvg-m1_mlog (254:0)
-     |     `-testvg-m1 (254:12)
-     |-d6 (254:8)
-     |  `-testvg-lvol2 (254:17)
-     `-d5 (254:7)
-        `-testvg-lvol1-cow (254:16)
-           `-testvg-lvol1 (254:14)
-     (8:48)
-     `-asr_HOSTRAID1 (254:18)
-        |-asr_HOSTRAID15 (254:22)
-        |-asr_HOSTRAID13 (254:21)
-        |-asr_HOSTRAID12 (254:20)
-        `-asr_HOSTRAID11 (254:19)
-     (8:32)
-     `-asr_HOSTRAID1 (254:18)
-        |-asr_HOSTRAID15 (254:22)
-        |-asr_HOSTRAID13 (254:21)
-        |-asr_HOSTRAID12 (254:20)
-        `-asr_HOSTRAID11 (254:19)
-
-To obtain the sorted list of the maps which have no parent maps:
-    # dmsetup info -c -o 'name,-parents_count=0' --noheadings -O name
-    asr_HOSTRAID11     
-    asr_HOSTRAID12     
-    asr_HOSTRAID13     
-    asr_HOSTRAID15     
-    testvg-lvol0       
-    testvg-lvol1       
-    testvg-lvol2       
-    testvg-m1          
-
-
-Output of "dmsetup info -c" is basically same as the former version
-except for a few spacing difference, which should be harmless.
-  - Field width is correctly aligned (e.g. in case of long map name)
-  - Trailing space is added to fill the width
-    (same behaviour as LVM2 lvs/pvs/vgs)
-
-
-Index: device-mapper/dmsetup/dmsetup.c
-===================================================================
---- device-mapper.orig/dmsetup/dmsetup.c	2007-01-12 16:50:37.000000000 -0500
-+++ device-mapper/dmsetup/dmsetup.c	2007-01-12 17:03:45.000000000 -0500
-@@ -1,7 +1,7 @@
- /*
-  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
-- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
-- * Copyright (C) 2005 NEC Corperation
-+ * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
-+ * Copyright (C) 2005-2007 NEC Corperation
-  *
-  * This file is part of the device-mapper userspace tools.
-  *
-@@ -114,7 +114,9 @@ enum {
- 	NOOPENCOUNT_ARG,
- 	NOTABLE_ARG,
- 	OPTIONS_ARG,
-+	SEPARATOR_ARG,
- 	SHOWKEYS_ARG,
-+	SORTKEYS_ARG,
- 	TABLE_ARG,
- 	TARGET_ARG,
- 	TREE_ARG,
-@@ -129,11 +131,12 @@ static int _switches[NUM_SWITCHES];
- static int _values[NUM_SWITCHES];
- static int _num_devices;
- static char *_uuid;
--static char *_fields;
-+static char *_fields[NUM_SWITCHES];
- static char *_table;
- static char *_target;
- static char *_command;
- static struct dm_tree *_dtree;
-+static struct dm_report *_rhandle;
- 
- /*
-  * Commands
-@@ -322,6 +325,8 @@ static void _display_info_long(struct dm
- 	printf("\n");
- }
- 
-+static int _report(int argc, char **argv, void *data);
-+
- static int _display_info(struct dm_task *dmt)
- {
- 	struct dm_info info;
-@@ -1056,6 +1061,12 @@ static int _info(int argc, char **argv, 
- 	struct dm_names *names = (struct dm_names *) data;
- 	char *name = NULL;
- 
-+	/*
-+	 * Using reporter function
-+	 */
-+	if (_switches[COLS_ARG])
-+		return _report(argc, argv, data);
-+
- 	if (data)
- 		name = names->name;
- 	else {
-@@ -1506,6 +1517,414 @@ static int _ls(int argc, char **argv, vo
- 		return _process_all(argc, argv, 0, _display_name);
- }
- 
-+
-+/*
-+ * Report device information
-+ */
-+
-+/* dm specific display functions */
-+
-+static int _dm_name_disp(struct dm_report *rh, struct dm_pool *mem,
-+			 struct dm_report_field *field, const void *data)
-+{
-+	const char *name = dm_task_get_name((struct dm_task *) data);
-+
-+	return dm_report_field_string(rh, mem, field, &name);
-+}
-+
-+static int _dm_uuid_disp(struct dm_report *rh, struct dm_pool *mem,
-+			 struct dm_report_field *field,
-+			 const void *data)
-+{
-+	const char *uuid = dm_task_get_uuid((struct dm_task *) data);
-+
-+	if (!uuid || !*uuid)
-+		uuid = "";
-+
-+	return dm_report_field_string(rh, mem, field, &uuid);
-+}
-+
-+static int _dm_info_status_disp(struct dm_report *rh, struct dm_pool *mem,
-+				struct dm_report_field *field, const void *data)
-+{
-+	char buf[5], *s = buf;
-+	struct dm_info *info = (struct dm_info *) data;
-+
-+	buf[0] = info->live_table ? 'L' : '-';
-+	buf[1] = info->inactive_table ? 'I' : '-';
-+	buf[2] = info->suspended ? 's' : '-';
-+	buf[3] = info->read_only ? 'r' : 'w';
-+	buf[4] = 0;
-+
-+	return dm_report_field_string(rh, mem, field, &s);
-+}
-+
-+#define MAJ_MIN_LEN 32
-+
-+static int _dm_info_device_disp(struct dm_report *rh, struct dm_pool *mem,
-+				struct dm_report_field *field, const void *data)
-+{
-+	char *repstr;
-+	struct dm_info *info = (struct dm_info *) data;
-+
-+	if (!(repstr = dm_pool_zalloc(mem, MAJ_MIN_LEN))) {
-+		log_error("dm_pool_alloc failed");
-+		return 0;
-+	}
-+
-+	if (dm_snprintf(repstr, MAJ_MIN_LEN, "%d:%d",
-+			info->major, info->minor) < 0) {
-+		dm_pool_free(mem, repstr);
-+		log_error("dm_pool_alloc failed");
-+		return 0;
-+	}
-+
-+	return dm_report_field_raw(rh, mem, field, repstr);
-+}
-+
-+static int _dm_tree_parent_maps_disp(struct dm_report *rh,
-+				     struct dm_pool *mem,
-+				     struct dm_report_field *field,
-+				     const void *data)
-+{
-+	struct dm_tree_node *node = (struct dm_tree_node *) data, *parent;
-+	void *t = NULL;
-+	const char *name;
-+	int first_node = 1;
-+	char *repstr;
-+
-+	if (!dm_pool_begin_object(mem, 256)) {
-+		log_error("dm_pool_begin_object failed");
-+		return 0;
-+	}
-+
-+	while ((parent = dm_tree_next_child(&t, node, 1))) {
-+		name = dm_tree_node_get_name(parent);
-+		if (!name || !*name)
-+			continue;
-+		if (!first_node && !dm_pool_grow_object(mem, ",", 1)) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+		if (!dm_pool_grow_object(mem, name, strlen(name))) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+		if (first_node)
-+			first_node = 0;
-+	}
-+
-+	if (!dm_pool_grow_object(mem, "\0", 1)) {
-+		log_error("dm_pool_grow_object failed");
-+		goto out_abandon;
-+	}
-+
-+	repstr = dm_pool_end_object(mem);
-+	return dm_report_field_raw(rh, mem, field, repstr);
-+
-+	return 1;
-+
-+      out_abandon:
-+	dm_pool_abandon_object(mem);
-+	return 0;
-+}
-+
-+static int _dm_tree_parents_disp(struct dm_report *rh, struct dm_pool *mem,
-+				 struct dm_report_field *field,
-+				 const void *data)
-+{
-+	struct dm_tree_node *node = (struct dm_tree_node *) data, *parent;
-+	void *t = NULL;
-+	const struct dm_info *info;
-+	int first_node = 1;
-+	char buf[MAJ_MIN_LEN], *repstr;
-+
-+	if (!dm_pool_begin_object(mem, 256)) {
-+		log_error("dm_pool_begin_object failed");
-+		return 0;
-+	}
-+
-+	while ((parent = dm_tree_next_child(&t, node, 1))) {
-+		info = dm_tree_node_get_info(parent);
-+		if (!info->major && !info->minor)
-+			continue;
-+		if (!first_node && !dm_pool_grow_object(mem, ",", 1)) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+		if (dm_snprintf(buf, MAJ_MIN_LEN, "%d:%d",
-+				info->major, info->minor) < 0) {
-+			log_error("dm_snprintf failed");
-+			goto out_abandon;
-+		}
-+		if (!dm_pool_grow_object(mem, buf, strlen(buf))) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+		if (first_node)
-+			first_node = 0;
-+	}
-+
-+	if (!dm_pool_grow_object(mem, "\0", 1)) {
-+		log_error("dm_pool_grow_object failed");
-+		goto out_abandon;
-+	}
-+
-+	repstr = dm_pool_end_object(mem);
-+	return dm_report_field_raw(rh, mem, field, repstr);
-+
-+      out_abandon:
-+	dm_pool_abandon_object(mem);
-+	return 0;
-+}
-+
-+static int _dm_tree_parents_count_disp(struct dm_report *rh,
-+				       struct dm_pool *mem,
-+				       struct dm_report_field *field,
-+				       const void *data)
-+{
-+	struct dm_tree_node *node = (struct dm_tree_node *) data;
-+	int num_parent = dm_tree_node_num_children(node, 1);
-+
-+	return dm_report_field_int(rh, mem, field, &num_parent);
-+}
-+
-+static int _dm_deps_disp(struct dm_report *rh, struct dm_pool *mem,
-+			 struct dm_report_field *field, const void *data)
-+{
-+	struct dm_deps *deps = (struct dm_deps *) data;
-+	int i;
-+	char buf[MAJ_MIN_LEN], *repstr;
-+
-+	if (!dm_pool_begin_object(mem, 256)) {
-+		log_error("dm_pool_begin_object failed");
-+		return 0;
-+	}
-+
-+	for (i = 0; i < deps->count; i++) {
-+		if (dm_snprintf(buf, sizeof(buf) - 1, "%d:%d",
-+		       (int) MAJOR(deps->device[i]),
-+		       (int) MINOR(deps->device[i])) < 0) {
-+			log_error("dm_snprintf failed");
-+			goto out_abandon;
-+		}
-+		if (!dm_pool_grow_object(mem, buf, strlen(buf))) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+		if (i + 1 < deps->count && !dm_pool_grow_object(mem, ",", 1)) {
-+			log_error("dm_pool_grow_object failed");
-+			goto out_abandon;
-+		}
-+	}
-+
-+	if (!dm_pool_grow_object(mem, "\0", 1)) {
-+		log_error("dm_pool_grow_object failed");
-+		goto out_abandon;
-+	}
-+
-+	repstr = dm_pool_end_object(mem);
-+	return dm_report_field_raw(rh, mem, field, repstr);
-+
-+      out_abandon:
-+	dm_pool_abandon_object(mem);
-+	return 0;
-+}
-+
-+/* Report object types */
-+
-+#define DESC1 "Device Mapper Device"
-+#define DESC2 "Dependency"
-+#define PREFIX "dm_"
-+enum { DR_TASK = 1, DR_INFO = 2, DR_DEPS = 4, DR_TREE = 8 };
-+
-+struct dmsetup_report_obj {
-+	struct dm_task *task;
-+	struct dm_info *info;
-+	struct dm_tree_node *tree;
-+};
-+
-+static void *_task_get_obj(void *obj)
-+{
-+	return ((struct dmsetup_report_obj *)obj)->task;
-+}
-+
-+static void *_info_get_obj(void *obj)
-+{
-+	return ((struct dmsetup_report_obj *)obj)->info;
-+}
-+
-+static void *_tree_get_obj(void *obj)
-+{
-+	return ((struct dmsetup_report_obj *)obj)->tree;
-+}
-+
-+static void *_deps_get_obj(void *obj)
-+{
-+	struct dm_task *dmt;
-+
-+	if (!(dmt = _task_get_obj((struct dmsetup_report_obj *)obj)))
-+		return NULL;
-+
-+	return dm_task_get_deps(dmt);
-+}
-+
-+static const struct dm_report_object_type _report_types[] = {
-+	{ DR_TASK, DESC1, PREFIX, _task_get_obj },
-+	{ DR_INFO, DESC1, PREFIX, _info_get_obj },
-+	{ DR_DEPS, DESC2, PREFIX, _deps_get_obj },
-+	{ DR_TREE, DESC2, PREFIX, _tree_get_obj },
-+};
-+
-+/* Column definitions */
-+static union {
-+	struct dm_info _dm_info;
-+	struct dm_deps _dm_deps;
-+} _dummy;
-+
-+#define OFFSET_OF(struct, field) ((unsigned int) ((void *)&_dummy._ ## struct.field - (void *)&_dummy._ ## struct))
-+#define STR (DM_REPORT_FIELD_STRING | DM_REPORT_FIELD_ALIGN_LEFT)
-+#define NUM (DM_REPORT_FIELD_NUMBER | DM_REPORT_FIELD_ALIGN_RIGHT)
-+#define FIELD_O(type, strct, sorttype, head, field, width, func, id) {DR_ ## type, id, OFFSET_OF(strct, field), head, width, sorttype, &dm_report_field_ ## func},
-+#define FIELD_F(type, sorttype, head, width, func, id) {DR_ ## type, id, 0, head, width, sorttype, &_ ## func ## _disp},
-+
-+static const struct dm_report_field_type _report_fields[] = {
-+/* *INDENT-OFF* */
-+FIELD_F(TASK, STR, "Name", 16, dm_name, "name")
-+FIELD_F(TASK, STR, "UUID", 32, dm_uuid, "uuid")
-+FIELD_F(INFO, STR, "Stat", 4, dm_info_status, "status")
-+FIELD_F(INFO, STR, "Device", 6, dm_info_device, "device")
-+FIELD_O(INFO, dm_info, NUM, "Maj", major, 3, int32, "major")
-+FIELD_O(INFO, dm_info, NUM, "Min", minor, 3, int32, "minor")
-+FIELD_O(INFO, dm_info, NUM, "Open", open_count, 4, int32, "open_count")
-+FIELD_O(INFO, dm_info, NUM, "Targ", target_count, 4, int32, "target_count")
-+FIELD_O(INFO, dm_info, NUM, "Event", event_nr, 6, uint32, "event_nr")
-+FIELD_O(DEPS, dm_deps, NUM, "Deps", count, 4, int32, "deps_count")
-+FIELD_F(DEPS, STR, "Depend on", 10, dm_deps, "deps")
-+FIELD_F(TREE, STR, "Parent Devices", 16, dm_tree_parents, "parents")
-+FIELD_F(TREE, STR, "Parent Maps", 12, dm_tree_parent_maps, "parent_maps")
-+FIELD_F(TREE, NUM, "Parents", 7, dm_tree_parents_count, "parents_count")
-+/* *INDENT-ON* */
-+};
-+
-+#undef STR
-+#undef NUM
-+#undef FIELD_O
-+#undef FIELD_F
-+
-+static const char *default_report_options = "name,major,minor,status,open_count,target_count,event_nr,uuid";
-+static unsigned int _num_report_fields = sizeof(_report_fields) / sizeof(_report_fields[0]);
-+static unsigned int _num_report_types = sizeof(_report_types) / sizeof(_report_types[0]);
-+
-+static int _do_report(int argc, char **argv, void *data)
-+{
-+	const char *name = NULL;
-+	struct dm_task *dmt;
-+	struct dm_info info;
-+	int r = 0;
-+	struct dmsetup_report_obj obj;
-+
-+	if (data) {
-+		if (argc == 0)
-+			name = dm_task_get_name((struct dm_task *)data);
-+		else
-+			name = ((struct dm_names *)data)->name;
-+	} else {
-+		if (argc == 1)
-+			return _process_all(argc, argv, 0, _report);
-+		if (argc == 2)
-+			name = argv[1];
-+	}
-+
-+	if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
-+		return 0;
-+
-+	if (!_set_task_device(dmt, name, 0))
-+		goto out;
-+
-+	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
-+		goto out;
-+
-+	if (!dm_task_run(dmt))
-+		goto out;
-+
-+	if (!dm_task_get_info(dmt, &info))
-+		goto out;
-+
-+	obj.task = dmt;
-+	obj.info = &info;
-+	obj.tree = dm_tree_find_node(_dtree, info.major, info.minor);
-+	dm_report_object(_rhandle, &obj);
-+
-+	r = 1;
-+
-+      out:
-+	dm_task_destroy(dmt);
-+	return r;
-+}
-+
-+static int _report(int argc, char **argv, void *data)
-+{
-+	char *options = (char *) default_report_options;
-+	const char *keys = "";
-+	const char *separator = " ";
-+	int aligned = 1, buffered = 1;
-+	int headings = !_switches[NOHEADINGS_ARG];
-+	uint32_t report_type = 0;
-+
-+	if (_rhandle)
-+		return _do_report(argc, argv, data);
-+
-+	if (!(_dtree = dm_tree_create()))
-+		return 0;
-+	if (!_process_all(argc, argv, 0, _add_dep))
-+		return 0;
-+
-+	if (_switches[OPTIONS_ARG] && _fields[OPTIONS_ARG]) {
-+		if (*_fields[OPTIONS_ARG] == '+') {
-+			int len = strlen(default_report_options) +
-+				  strlen(_fields[OPTIONS_ARG]);
-+			if (!(options = dm_malloc(len))) {
-+				err("Failed to malloc option string.");
-+				return 0;
-+			}
-+			if (dm_snprintf(options, len, "%s,%s",
-+					default_report_options,
-+					&_fields[OPTIONS_ARG][1]) < 0) {
-+				err("snprintf failed");
-+				return 0;
-+			}
-+		} else
-+			options = _fields[OPTIONS_ARG];
-+	}
-+	if (_switches[SORTKEYS_ARG] && _fields[SORTKEYS_ARG])
-+		keys = _fields[SORTKEYS_ARG];
-+	if (_switches[SEPARATOR_ARG] && _fields[SEPARATOR_ARG]) {
-+		separator = _fields[SEPARATOR_ARG];
-+		aligned = 0;
-+	}
-+
-+	if (!(_rhandle = dm_report_init(options, keys, &report_type,
-+					separator, aligned, buffered, headings,
-+					_report_fields, _num_report_fields,
-+					_report_types, _num_report_types,
-+					NULL)))
-+		return 0;
-+
-+	_do_report(argc, argv, data);
-+
-+	dm_report_output(_rhandle);
-+	dm_report_free(_rhandle);
-+	_rhandle = NULL;
-+
-+	if (_dtree) {
-+		dm_tree_free(_dtree);
-+		_dtree = NULL;
-+	}
-+
-+	return 1;
-+}
-+
- /*
-  * dispatch table
-  */
-@@ -1884,7 +2303,9 @@ static int _process_switches(int *argc, 
- 		{"noopencount", 0, &ind, NOOPENCOUNT_ARG},
- 		{"notable", 0, &ind, NOTABLE_ARG},
- 		{"options", 1, &ind, OPTIONS_ARG},
-+		{"separator", 1, &ind, SEPARATOR_ARG},
- 		{"showkeys", 0, &ind, SHOWKEYS_ARG},
-+		{"sortkeys", 1, &ind, SORTKEYS_ARG},
- 		{"table", 1, &ind, TABLE_ARG},
- 		{"target", 1, &ind, TARGET_ARG},
- 		{"tree", 0, &ind, TREE_ARG},
-@@ -1914,7 +2335,7 @@ static int _process_switches(int *argc, 
- 		_switches[OPTIONS_ARG]++;
- 		_switches[MAJOR_ARG]++;
- 		_switches[MINOR_ARG]++;
--		_fields = (char *) "name";
-+		_fields[OPTIONS_ARG] = (char *) "name";
- 
- 		if (*argc == 3) {
- 			_values[MAJOR_ARG] = atoi((*argv)[1]);
-@@ -1946,7 +2367,7 @@ static int _process_switches(int *argc, 
- 
- 	optarg = 0;
- 	optind = OPTIND_INIT;
--	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:ru:Uv",
-+	while ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, "cCfGj:m:Mno:O:ru:Uv",
- 					    long_options, NULL)) != -1) {
- 		if (c == ':' || c == '?')
- 			return 0;
-@@ -1968,7 +2389,15 @@ static int _process_switches(int *argc, 
- 			_switches[NOTABLE_ARG]++;
- 		if (c == 'o' || ind == OPTIONS_ARG) {
- 			_switches[OPTIONS_ARG]++;
--			_fields = optarg;
-+			_fields[OPTIONS_ARG] = optarg;
-+		}
-+		if (ind == SEPARATOR_ARG) {
-+			_switches[SEPARATOR_ARG]++;
-+			_fields[SEPARATOR_ARG] = optarg;
-+		}
-+		if (c == 'O' || ind == SORTKEYS_ARG) {
-+			_switches[SORTKEYS_ARG]++;
-+			_fields[SORTKEYS_ARG] = optarg;
- 		}
- 		if (c == 'v' || ind == VERBOSE_ARG)
- 			_switches[VERBOSE_ARG]++;
-@@ -2027,13 +2456,7 @@ static int _process_switches(int *argc, 
- 		return 0;
- 	}
- 
--	if (_switches[COLS_ARG] && _switches[OPTIONS_ARG] &&
--	    strcmp(_fields, "name")) {
--		fprintf(stderr, "Only -o name is supported so far.\n");
--		return 0;
--	}
--
--	if (_switches[TREE_ARG] && !_process_tree_options(_fields))
-+	if (_switches[TREE_ARG] && !_process_tree_options(_fields[OPTIONS_ARG]))
- 		return 0;
- 
- 	if (_switches[TABLE_ARG] && _switches[NOTABLE_ARG]) {
diff --git a/a/3.hdr b/a/3.hdr
deleted file mode 100644
index 4b86001..0000000
--- a/a/3.hdr
+++ /dev/null
@@ -1,4 +0,0 @@
-Content-Type: text/plain; charset="us-ascii"
-MIME-Version: 1.0
-Content-Transfer-Encoding: 7bit
-Content-Disposition: inline
diff --git a/a/3.txt b/a/3.txt
deleted file mode 100644
index 8b13789..0000000
--- a/a/3.txt
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/a/content_digest b/N1/content_digest
index 82b0c4f..d63b8f5 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -2,9 +2,8 @@
  "From\0Jun'ichi Nomura <j-nomura@ce.jp.nec.com>\0"
  "Subject\0[PATCH] (2/4) dmsetup info to use dm_report\0"
  "Date\0Fri, 12 Jan 2007 18:31:45 -0500\0"
- "To\0device-mapper development <dm-devel@redhat.com>"
- " LVM2 development <lvm-devel@redhat.com>\0"
- "\01:1\0"
+ "To\0lvm-devel@redhat.com\0"
+ "\00:1\0"
  "b\0"
  "Hi,\n"
  "\n"
@@ -51,632 +50,13 @@
  "\n"
  "Thanks,\n"
  "--\n"
- Jun'ichi Nomura, NEC Corporation of America
- "\01:2\0"
- "fn\002-dmsetup-report.patch\0"
- "b\0"
- "Extend \"dmsetup info -c -o\" using dm_report API.\n"
- "New options \"-O\" and \"--seprator\" are also added.\n"
- "\n"
- "  Usage:\n"
- "    dmsetup info -c -o <field1>[,<field2>...] \\\n"
- "                   [-O <field>[,<field>...]\n"
- "                   [--separator <string>]\n"
- "\n"
- "Combination of the following field name is allowed:\n"
- "    name\n"
- "    device\n"
- "    major\n"
- "    minor\n"
- "    uuid\n"
- "    status\n"
- "    open_count\n"
- "    target_count\n"
- "    event_nr\n"
- "    deps\n"
- "    deps_count\n"
- "    parents\n"
- "    parents_count\n"
- "    parent_maps\n"
- "\n"
- "Examples:\n"
- "\n"
- "If you have the following dm tree:\n"
- "    # dmsetup ls --tree -o inverted\n"
- "     (7:0)\n"
- "     |-d4 (254:6)\n"
- "     |  |-testvg-lvol2 (254:17)\n"
- "     |  `-testvg-lvol0-real (254:15)\n"
- "     |     |-testvg-lvol1 (254:14)\n"
- "     |     `-testvg-lvol0 (254:13)\n"
- "     |-d1 (254:3)\n"
- "     |  |-testvg-m1_mimage_0 (254:10)\n"
- "     |  |  `-testvg-m1 (254:12)\n"
- "     |  `-testvg-lvol2 (254:17)\n"
- "     |-d3 (254:5)\n"
- "     |  `-testvg-lvol0-real (254:15)\n"
- "     |     |-testvg-lvol1 (254:14)\n"
- "     |     `-testvg-lvol0 (254:13)\n"
- "     |-d2 (254:4)\n"
- "     |  |-testvg-m1_mimage_1 (254:11)\n"
- "     |  |  `-testvg-m1 (254:12)\n"
- "     |  `-testvg-lvol2 (254:17)\n"
- "     |-d7 (254:9)\n"
- "     |  `-testvg-m1_mlog (254:0)\n"
- "     |     `-testvg-m1 (254:12)\n"
- "     |-d6 (254:8)\n"
- "     |  `-testvg-lvol2 (254:17)\n"
- "     `-d5 (254:7)\n"
- "        `-testvg-lvol1-cow (254:16)\n"
- "           `-testvg-lvol1 (254:14)\n"
- "     (8:48)\n"
- "     `-asr_HOSTRAID1 (254:18)\n"
- "        |-asr_HOSTRAID15 (254:22)\n"
- "        |-asr_HOSTRAID13 (254:21)\n"
- "        |-asr_HOSTRAID12 (254:20)\n"
- "        `-asr_HOSTRAID11 (254:19)\n"
- "     (8:32)\n"
- "     `-asr_HOSTRAID1 (254:18)\n"
- "        |-asr_HOSTRAID15 (254:22)\n"
- "        |-asr_HOSTRAID13 (254:21)\n"
- "        |-asr_HOSTRAID12 (254:20)\n"
- "        `-asr_HOSTRAID11 (254:19)\n"
- "\n"
- "To obtain the sorted list of the maps which have no parent maps:\n"
- "    # dmsetup info -c -o 'name,-parents_count=0' --noheadings -O name\n"
- "    asr_HOSTRAID11     \n"
- "    asr_HOSTRAID12     \n"
- "    asr_HOSTRAID13     \n"
- "    asr_HOSTRAID15     \n"
- "    testvg-lvol0       \n"
- "    testvg-lvol1       \n"
- "    testvg-lvol2       \n"
- "    testvg-m1          \n"
- "\n"
- "\n"
- "Output of \"dmsetup info -c\" is basically same as the former version\n"
- "except for a few spacing difference, which should be harmless.\n"
- "  - Field width is correctly aligned (e.g. in case of long map name)\n"
- "  - Trailing space is added to fill the width\n"
- "    (same behaviour as LVM2 lvs/pvs/vgs)\n"
- "\n"
- "\n"
- "Index: device-mapper/dmsetup/dmsetup.c\n"
- "===================================================================\n"
- "--- device-mapper.orig/dmsetup/dmsetup.c\t2007-01-12 16:50:37.000000000 -0500\n"
- "+++ device-mapper/dmsetup/dmsetup.c\t2007-01-12 17:03:45.000000000 -0500\n"
- "@@ -1,7 +1,7 @@\n"
- " /*\n"
- "  * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.\n"
- "- * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.\n"
- "- * Copyright (C) 2005 NEC Corperation\n"
- "+ * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.\n"
- "+ * Copyright (C) 2005-2007 NEC Corperation\n"
- "  *\n"
- "  * This file is part of the device-mapper userspace tools.\n"
- "  *\n"
- "@@ -114,7 +114,9 @@ enum {\n"
- " \tNOOPENCOUNT_ARG,\n"
- " \tNOTABLE_ARG,\n"
- " \tOPTIONS_ARG,\n"
- "+\tSEPARATOR_ARG,\n"
- " \tSHOWKEYS_ARG,\n"
- "+\tSORTKEYS_ARG,\n"
- " \tTABLE_ARG,\n"
- " \tTARGET_ARG,\n"
- " \tTREE_ARG,\n"
- "@@ -129,11 +131,12 @@ static int _switches[NUM_SWITCHES];\n"
- " static int _values[NUM_SWITCHES];\n"
- " static int _num_devices;\n"
- " static char *_uuid;\n"
- "-static char *_fields;\n"
- "+static char *_fields[NUM_SWITCHES];\n"
- " static char *_table;\n"
- " static char *_target;\n"
- " static char *_command;\n"
- " static struct dm_tree *_dtree;\n"
- "+static struct dm_report *_rhandle;\n"
- " \n"
- " /*\n"
- "  * Commands\n"
- "@@ -322,6 +325,8 @@ static void _display_info_long(struct dm\n"
- " \tprintf(\"\\n\");\n"
- " }\n"
- " \n"
- "+static int _report(int argc, char **argv, void *data);\n"
- "+\n"
- " static int _display_info(struct dm_task *dmt)\n"
- " {\n"
- " \tstruct dm_info info;\n"
- "@@ -1056,6 +1061,12 @@ static int _info(int argc, char **argv, \n"
- " \tstruct dm_names *names = (struct dm_names *) data;\n"
- " \tchar *name = NULL;\n"
- " \n"
- "+\t/*\n"
- "+\t * Using reporter function\n"
- "+\t */\n"
- "+\tif (_switches[COLS_ARG])\n"
- "+\t\treturn _report(argc, argv, data);\n"
- "+\n"
- " \tif (data)\n"
- " \t\tname = names->name;\n"
- " \telse {\n"
- "@@ -1506,6 +1517,414 @@ static int _ls(int argc, char **argv, vo\n"
- " \t\treturn _process_all(argc, argv, 0, _display_name);\n"
- " }\n"
- " \n"
- "+\n"
- "+/*\n"
- "+ * Report device information\n"
- "+ */\n"
- "+\n"
- "+/* dm specific display functions */\n"
- "+\n"
- "+static int _dm_name_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t struct dm_report_field *field, const void *data)\n"
- "+{\n"
- "+\tconst char *name = dm_task_get_name((struct dm_task *) data);\n"
- "+\n"
- "+\treturn dm_report_field_string(rh, mem, field, &name);\n"
- "+}\n"
- "+\n"
- "+static int _dm_uuid_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t struct dm_report_field *field,\n"
- "+\t\t\t const void *data)\n"
- "+{\n"
- "+\tconst char *uuid = dm_task_get_uuid((struct dm_task *) data);\n"
- "+\n"
- "+\tif (!uuid || !*uuid)\n"
- "+\t\tuuid = \"\";\n"
- "+\n"
- "+\treturn dm_report_field_string(rh, mem, field, &uuid);\n"
- "+}\n"
- "+\n"
- "+static int _dm_info_status_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t\tstruct dm_report_field *field, const void *data)\n"
- "+{\n"
- "+\tchar buf[5], *s = buf;\n"
- "+\tstruct dm_info *info = (struct dm_info *) data;\n"
- "+\n"
- "+\tbuf[0] = info->live_table ? 'L' : '-';\n"
- "+\tbuf[1] = info->inactive_table ? 'I' : '-';\n"
- "+\tbuf[2] = info->suspended ? 's' : '-';\n"
- "+\tbuf[3] = info->read_only ? 'r' : 'w';\n"
- "+\tbuf[4] = 0;\n"
- "+\n"
- "+\treturn dm_report_field_string(rh, mem, field, &s);\n"
- "+}\n"
- "+\n"
- "+#define MAJ_MIN_LEN 32\n"
- "+\n"
- "+static int _dm_info_device_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t\tstruct dm_report_field *field, const void *data)\n"
- "+{\n"
- "+\tchar *repstr;\n"
- "+\tstruct dm_info *info = (struct dm_info *) data;\n"
- "+\n"
- "+\tif (!(repstr = dm_pool_zalloc(mem, MAJ_MIN_LEN))) {\n"
- "+\t\tlog_error(\"dm_pool_alloc failed\");\n"
- "+\t\treturn 0;\n"
- "+\t}\n"
- "+\n"
- "+\tif (dm_snprintf(repstr, MAJ_MIN_LEN, \"%d:%d\",\n"
- "+\t\t\tinfo->major, info->minor) < 0) {\n"
- "+\t\tdm_pool_free(mem, repstr);\n"
- "+\t\tlog_error(\"dm_pool_alloc failed\");\n"
- "+\t\treturn 0;\n"
- "+\t}\n"
- "+\n"
- "+\treturn dm_report_field_raw(rh, mem, field, repstr);\n"
- "+}\n"
- "+\n"
- "+static int _dm_tree_parent_maps_disp(struct dm_report *rh,\n"
- "+\t\t\t\t     struct dm_pool *mem,\n"
- "+\t\t\t\t     struct dm_report_field *field,\n"
- "+\t\t\t\t     const void *data)\n"
- "+{\n"
- "+\tstruct dm_tree_node *node = (struct dm_tree_node *) data, *parent;\n"
- "+\tvoid *t = NULL;\n"
- "+\tconst char *name;\n"
- "+\tint first_node = 1;\n"
- "+\tchar *repstr;\n"
- "+\n"
- "+\tif (!dm_pool_begin_object(mem, 256)) {\n"
- "+\t\tlog_error(\"dm_pool_begin_object failed\");\n"
- "+\t\treturn 0;\n"
- "+\t}\n"
- "+\n"
- "+\twhile ((parent = dm_tree_next_child(&t, node, 1))) {\n"
- "+\t\tname = dm_tree_node_get_name(parent);\n"
- "+\t\tif (!name || !*name)\n"
- "+\t\t\tcontinue;\n"
- "+\t\tif (!first_node && !dm_pool_grow_object(mem, \",\", 1)) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (!dm_pool_grow_object(mem, name, strlen(name))) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (first_node)\n"
- "+\t\t\tfirst_node = 0;\n"
- "+\t}\n"
- "+\n"
- "+\tif (!dm_pool_grow_object(mem, \"\\0\", 1)) {\n"
- "+\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\tgoto out_abandon;\n"
- "+\t}\n"
- "+\n"
- "+\trepstr = dm_pool_end_object(mem);\n"
- "+\treturn dm_report_field_raw(rh, mem, field, repstr);\n"
- "+\n"
- "+\treturn 1;\n"
- "+\n"
- "+      out_abandon:\n"
- "+\tdm_pool_abandon_object(mem);\n"
- "+\treturn 0;\n"
- "+}\n"
- "+\n"
- "+static int _dm_tree_parents_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t\t struct dm_report_field *field,\n"
- "+\t\t\t\t const void *data)\n"
- "+{\n"
- "+\tstruct dm_tree_node *node = (struct dm_tree_node *) data, *parent;\n"
- "+\tvoid *t = NULL;\n"
- "+\tconst struct dm_info *info;\n"
- "+\tint first_node = 1;\n"
- "+\tchar buf[MAJ_MIN_LEN], *repstr;\n"
- "+\n"
- "+\tif (!dm_pool_begin_object(mem, 256)) {\n"
- "+\t\tlog_error(\"dm_pool_begin_object failed\");\n"
- "+\t\treturn 0;\n"
- "+\t}\n"
- "+\n"
- "+\twhile ((parent = dm_tree_next_child(&t, node, 1))) {\n"
- "+\t\tinfo = dm_tree_node_get_info(parent);\n"
- "+\t\tif (!info->major && !info->minor)\n"
- "+\t\t\tcontinue;\n"
- "+\t\tif (!first_node && !dm_pool_grow_object(mem, \",\", 1)) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (dm_snprintf(buf, MAJ_MIN_LEN, \"%d:%d\",\n"
- "+\t\t\t\tinfo->major, info->minor) < 0) {\n"
- "+\t\t\tlog_error(\"dm_snprintf failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (!dm_pool_grow_object(mem, buf, strlen(buf))) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (first_node)\n"
- "+\t\t\tfirst_node = 0;\n"
- "+\t}\n"
- "+\n"
- "+\tif (!dm_pool_grow_object(mem, \"\\0\", 1)) {\n"
- "+\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\tgoto out_abandon;\n"
- "+\t}\n"
- "+\n"
- "+\trepstr = dm_pool_end_object(mem);\n"
- "+\treturn dm_report_field_raw(rh, mem, field, repstr);\n"
- "+\n"
- "+      out_abandon:\n"
- "+\tdm_pool_abandon_object(mem);\n"
- "+\treturn 0;\n"
- "+}\n"
- "+\n"
- "+static int _dm_tree_parents_count_disp(struct dm_report *rh,\n"
- "+\t\t\t\t       struct dm_pool *mem,\n"
- "+\t\t\t\t       struct dm_report_field *field,\n"
- "+\t\t\t\t       const void *data)\n"
- "+{\n"
- "+\tstruct dm_tree_node *node = (struct dm_tree_node *) data;\n"
- "+\tint num_parent = dm_tree_node_num_children(node, 1);\n"
- "+\n"
- "+\treturn dm_report_field_int(rh, mem, field, &num_parent);\n"
- "+}\n"
- "+\n"
- "+static int _dm_deps_disp(struct dm_report *rh, struct dm_pool *mem,\n"
- "+\t\t\t struct dm_report_field *field, const void *data)\n"
- "+{\n"
- "+\tstruct dm_deps *deps = (struct dm_deps *) data;\n"
- "+\tint i;\n"
- "+\tchar buf[MAJ_MIN_LEN], *repstr;\n"
- "+\n"
- "+\tif (!dm_pool_begin_object(mem, 256)) {\n"
- "+\t\tlog_error(\"dm_pool_begin_object failed\");\n"
- "+\t\treturn 0;\n"
- "+\t}\n"
- "+\n"
- "+\tfor (i = 0; i < deps->count; i++) {\n"
- "+\t\tif (dm_snprintf(buf, sizeof(buf) - 1, \"%d:%d\",\n"
- "+\t\t       (int) MAJOR(deps->device[i]),\n"
- "+\t\t       (int) MINOR(deps->device[i])) < 0) {\n"
- "+\t\t\tlog_error(\"dm_snprintf failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (!dm_pool_grow_object(mem, buf, strlen(buf))) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t\tif (i + 1 < deps->count && !dm_pool_grow_object(mem, \",\", 1)) {\n"
- "+\t\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\t\tgoto out_abandon;\n"
- "+\t\t}\n"
- "+\t}\n"
- "+\n"
- "+\tif (!dm_pool_grow_object(mem, \"\\0\", 1)) {\n"
- "+\t\tlog_error(\"dm_pool_grow_object failed\");\n"
- "+\t\tgoto out_abandon;\n"
- "+\t}\n"
- "+\n"
- "+\trepstr = dm_pool_end_object(mem);\n"
- "+\treturn dm_report_field_raw(rh, mem, field, repstr);\n"
- "+\n"
- "+      out_abandon:\n"
- "+\tdm_pool_abandon_object(mem);\n"
- "+\treturn 0;\n"
- "+}\n"
- "+\n"
- "+/* Report object types */\n"
- "+\n"
- "+#define DESC1 \"Device Mapper Device\"\n"
- "+#define DESC2 \"Dependency\"\n"
- "+#define PREFIX \"dm_\"\n"
- "+enum { DR_TASK = 1, DR_INFO = 2, DR_DEPS = 4, DR_TREE = 8 };\n"
- "+\n"
- "+struct dmsetup_report_obj {\n"
- "+\tstruct dm_task *task;\n"
- "+\tstruct dm_info *info;\n"
- "+\tstruct dm_tree_node *tree;\n"
- "+};\n"
- "+\n"
- "+static void *_task_get_obj(void *obj)\n"
- "+{\n"
- "+\treturn ((struct dmsetup_report_obj *)obj)->task;\n"
- "+}\n"
- "+\n"
- "+static void *_info_get_obj(void *obj)\n"
- "+{\n"
- "+\treturn ((struct dmsetup_report_obj *)obj)->info;\n"
- "+}\n"
- "+\n"
- "+static void *_tree_get_obj(void *obj)\n"
- "+{\n"
- "+\treturn ((struct dmsetup_report_obj *)obj)->tree;\n"
- "+}\n"
- "+\n"
- "+static void *_deps_get_obj(void *obj)\n"
- "+{\n"
- "+\tstruct dm_task *dmt;\n"
- "+\n"
- "+\tif (!(dmt = _task_get_obj((struct dmsetup_report_obj *)obj)))\n"
- "+\t\treturn NULL;\n"
- "+\n"
- "+\treturn dm_task_get_deps(dmt);\n"
- "+}\n"
- "+\n"
- "+static const struct dm_report_object_type _report_types[] = {\n"
- "+\t{ DR_TASK, DESC1, PREFIX, _task_get_obj },\n"
- "+\t{ DR_INFO, DESC1, PREFIX, _info_get_obj },\n"
- "+\t{ DR_DEPS, DESC2, PREFIX, _deps_get_obj },\n"
- "+\t{ DR_TREE, DESC2, PREFIX, _tree_get_obj },\n"
- "+};\n"
- "+\n"
- "+/* Column definitions */\n"
- "+static union {\n"
- "+\tstruct dm_info _dm_info;\n"
- "+\tstruct dm_deps _dm_deps;\n"
- "+} _dummy;\n"
- "+\n"
- "+#define OFFSET_OF(struct, field) ((unsigned int) ((void *)&_dummy._ ## struct.field - (void *)&_dummy._ ## struct))\n"
- "+#define STR (DM_REPORT_FIELD_STRING | DM_REPORT_FIELD_ALIGN_LEFT)\n"
- "+#define NUM (DM_REPORT_FIELD_NUMBER | DM_REPORT_FIELD_ALIGN_RIGHT)\n"
- "+#define FIELD_O(type, strct, sorttype, head, field, width, func, id) {DR_ ## type, id, OFFSET_OF(strct, field), head, width, sorttype, &dm_report_field_ ## func},\n"
- "+#define FIELD_F(type, sorttype, head, width, func, id) {DR_ ## type, id, 0, head, width, sorttype, &_ ## func ## _disp},\n"
- "+\n"
- "+static const struct dm_report_field_type _report_fields[] = {\n"
- "+/* *INDENT-OFF* */\n"
- "+FIELD_F(TASK, STR, \"Name\", 16, dm_name, \"name\")\n"
- "+FIELD_F(TASK, STR, \"UUID\", 32, dm_uuid, \"uuid\")\n"
- "+FIELD_F(INFO, STR, \"Stat\", 4, dm_info_status, \"status\")\n"
- "+FIELD_F(INFO, STR, \"Device\", 6, dm_info_device, \"device\")\n"
- "+FIELD_O(INFO, dm_info, NUM, \"Maj\", major, 3, int32, \"major\")\n"
- "+FIELD_O(INFO, dm_info, NUM, \"Min\", minor, 3, int32, \"minor\")\n"
- "+FIELD_O(INFO, dm_info, NUM, \"Open\", open_count, 4, int32, \"open_count\")\n"
- "+FIELD_O(INFO, dm_info, NUM, \"Targ\", target_count, 4, int32, \"target_count\")\n"
- "+FIELD_O(INFO, dm_info, NUM, \"Event\", event_nr, 6, uint32, \"event_nr\")\n"
- "+FIELD_O(DEPS, dm_deps, NUM, \"Deps\", count, 4, int32, \"deps_count\")\n"
- "+FIELD_F(DEPS, STR, \"Depend on\", 10, dm_deps, \"deps\")\n"
- "+FIELD_F(TREE, STR, \"Parent Devices\", 16, dm_tree_parents, \"parents\")\n"
- "+FIELD_F(TREE, STR, \"Parent Maps\", 12, dm_tree_parent_maps, \"parent_maps\")\n"
- "+FIELD_F(TREE, NUM, \"Parents\", 7, dm_tree_parents_count, \"parents_count\")\n"
- "+/* *INDENT-ON* */\n"
- "+};\n"
- "+\n"
- "+#undef STR\n"
- "+#undef NUM\n"
- "+#undef FIELD_O\n"
- "+#undef FIELD_F\n"
- "+\n"
- "+static const char *default_report_options = \"name,major,minor,status,open_count,target_count,event_nr,uuid\";\n"
- "+static unsigned int _num_report_fields = sizeof(_report_fields) / sizeof(_report_fields[0]);\n"
- "+static unsigned int _num_report_types = sizeof(_report_types) / sizeof(_report_types[0]);\n"
- "+\n"
- "+static int _do_report(int argc, char **argv, void *data)\n"
- "+{\n"
- "+\tconst char *name = NULL;\n"
- "+\tstruct dm_task *dmt;\n"
- "+\tstruct dm_info info;\n"
- "+\tint r = 0;\n"
- "+\tstruct dmsetup_report_obj obj;\n"
- "+\n"
- "+\tif (data) {\n"
- "+\t\tif (argc == 0)\n"
- "+\t\t\tname = dm_task_get_name((struct dm_task *)data);\n"
- "+\t\telse\n"
- "+\t\t\tname = ((struct dm_names *)data)->name;\n"
- "+\t} else {\n"
- "+\t\tif (argc == 1)\n"
- "+\t\t\treturn _process_all(argc, argv, 0, _report);\n"
- "+\t\tif (argc == 2)\n"
- "+\t\t\tname = argv[1];\n"
- "+\t}\n"
- "+\n"
- "+\tif (!(dmt = dm_task_create(DM_DEVICE_DEPS)))\n"
- "+\t\treturn 0;\n"
- "+\n"
- "+\tif (!_set_task_device(dmt, name, 0))\n"
- "+\t\tgoto out;\n"
- "+\n"
- "+\tif (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))\n"
- "+\t\tgoto out;\n"
- "+\n"
- "+\tif (!dm_task_run(dmt))\n"
- "+\t\tgoto out;\n"
- "+\n"
- "+\tif (!dm_task_get_info(dmt, &info))\n"
- "+\t\tgoto out;\n"
- "+\n"
- "+\tobj.task = dmt;\n"
- "+\tobj.info = &info;\n"
- "+\tobj.tree = dm_tree_find_node(_dtree, info.major, info.minor);\n"
- "+\tdm_report_object(_rhandle, &obj);\n"
- "+\n"
- "+\tr = 1;\n"
- "+\n"
- "+      out:\n"
- "+\tdm_task_destroy(dmt);\n"
- "+\treturn r;\n"
- "+}\n"
- "+\n"
- "+static int _report(int argc, char **argv, void *data)\n"
- "+{\n"
- "+\tchar *options = (char *) default_report_options;\n"
- "+\tconst char *keys = \"\";\n"
- "+\tconst char *separator = \" \";\n"
- "+\tint aligned = 1, buffered = 1;\n"
- "+\tint headings = !_switches[NOHEADINGS_ARG];\n"
- "+\tuint32_t report_type = 0;\n"
- "+\n"
- "+\tif (_rhandle)\n"
- "+\t\treturn _do_report(argc, argv, data);\n"
- "+\n"
- "+\tif (!(_dtree = dm_tree_create()))\n"
- "+\t\treturn 0;\n"
- "+\tif (!_process_all(argc, argv, 0, _add_dep))\n"
- "+\t\treturn 0;\n"
- "+\n"
- "+\tif (_switches[OPTIONS_ARG] && _fields[OPTIONS_ARG]) {\n"
- "+\t\tif (*_fields[OPTIONS_ARG] == '+') {\n"
- "+\t\t\tint len = strlen(default_report_options) +\n"
- "+\t\t\t\t  strlen(_fields[OPTIONS_ARG]);\n"
- "+\t\t\tif (!(options = dm_malloc(len))) {\n"
- "+\t\t\t\terr(\"Failed to malloc option string.\");\n"
- "+\t\t\t\treturn 0;\n"
- "+\t\t\t}\n"
- "+\t\t\tif (dm_snprintf(options, len, \"%s,%s\",\n"
- "+\t\t\t\t\tdefault_report_options,\n"
- "+\t\t\t\t\t&_fields[OPTIONS_ARG][1]) < 0) {\n"
- "+\t\t\t\terr(\"snprintf failed\");\n"
- "+\t\t\t\treturn 0;\n"
- "+\t\t\t}\n"
- "+\t\t} else\n"
- "+\t\t\toptions = _fields[OPTIONS_ARG];\n"
- "+\t}\n"
- "+\tif (_switches[SORTKEYS_ARG] && _fields[SORTKEYS_ARG])\n"
- "+\t\tkeys = _fields[SORTKEYS_ARG];\n"
- "+\tif (_switches[SEPARATOR_ARG] && _fields[SEPARATOR_ARG]) {\n"
- "+\t\tseparator = _fields[SEPARATOR_ARG];\n"
- "+\t\taligned = 0;\n"
- "+\t}\n"
- "+\n"
- "+\tif (!(_rhandle = dm_report_init(options, keys, &report_type,\n"
- "+\t\t\t\t\tseparator, aligned, buffered, headings,\n"
- "+\t\t\t\t\t_report_fields, _num_report_fields,\n"
- "+\t\t\t\t\t_report_types, _num_report_types,\n"
- "+\t\t\t\t\tNULL)))\n"
- "+\t\treturn 0;\n"
- "+\n"
- "+\t_do_report(argc, argv, data);\n"
- "+\n"
- "+\tdm_report_output(_rhandle);\n"
- "+\tdm_report_free(_rhandle);\n"
- "+\t_rhandle = NULL;\n"
- "+\n"
- "+\tif (_dtree) {\n"
- "+\t\tdm_tree_free(_dtree);\n"
- "+\t\t_dtree = NULL;\n"
- "+\t}\n"
- "+\n"
- "+\treturn 1;\n"
- "+}\n"
- "+\n"
- " /*\n"
- "  * dispatch table\n"
- "  */\n"
- "@@ -1884,7 +2303,9 @@ static int _process_switches(int *argc, \n"
- " \t\t{\"noopencount\", 0, &ind, NOOPENCOUNT_ARG},\n"
- " \t\t{\"notable\", 0, &ind, NOTABLE_ARG},\n"
- " \t\t{\"options\", 1, &ind, OPTIONS_ARG},\n"
- "+\t\t{\"separator\", 1, &ind, SEPARATOR_ARG},\n"
- " \t\t{\"showkeys\", 0, &ind, SHOWKEYS_ARG},\n"
- "+\t\t{\"sortkeys\", 1, &ind, SORTKEYS_ARG},\n"
- " \t\t{\"table\", 1, &ind, TABLE_ARG},\n"
- " \t\t{\"target\", 1, &ind, TARGET_ARG},\n"
- " \t\t{\"tree\", 0, &ind, TREE_ARG},\n"
- "@@ -1914,7 +2335,7 @@ static int _process_switches(int *argc, \n"
- " \t\t_switches[OPTIONS_ARG]++;\n"
- " \t\t_switches[MAJOR_ARG]++;\n"
- " \t\t_switches[MINOR_ARG]++;\n"
- "-\t\t_fields = (char *) \"name\";\n"
- "+\t\t_fields[OPTIONS_ARG] = (char *) \"name\";\n"
- " \n"
- " \t\tif (*argc == 3) {\n"
- " \t\t\t_values[MAJOR_ARG] = atoi((*argv)[1]);\n"
- "@@ -1946,7 +2367,7 @@ static int _process_switches(int *argc, \n"
- " \n"
- " \toptarg = 0;\n"
- " \toptind = OPTIND_INIT;\n"
- "-\twhile ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, \"cCfGj:m:Mno:ru:Uv\",\n"
- "+\twhile ((ind = -1, c = GETOPTLONG_FN(*argc, *argv, \"cCfGj:m:Mno:O:ru:Uv\",\n"
- " \t\t\t\t\t    long_options, NULL)) != -1) {\n"
- " \t\tif (c == ':' || c == '?')\n"
- " \t\t\treturn 0;\n"
- "@@ -1968,7 +2389,15 @@ static int _process_switches(int *argc, \n"
- " \t\t\t_switches[NOTABLE_ARG]++;\n"
- " \t\tif (c == 'o' || ind == OPTIONS_ARG) {\n"
- " \t\t\t_switches[OPTIONS_ARG]++;\n"
- "-\t\t\t_fields = optarg;\n"
- "+\t\t\t_fields[OPTIONS_ARG] = optarg;\n"
- "+\t\t}\n"
- "+\t\tif (ind == SEPARATOR_ARG) {\n"
- "+\t\t\t_switches[SEPARATOR_ARG]++;\n"
- "+\t\t\t_fields[SEPARATOR_ARG] = optarg;\n"
- "+\t\t}\n"
- "+\t\tif (c == 'O' || ind == SORTKEYS_ARG) {\n"
- "+\t\t\t_switches[SORTKEYS_ARG]++;\n"
- "+\t\t\t_fields[SORTKEYS_ARG] = optarg;\n"
- " \t\t}\n"
- " \t\tif (c == 'v' || ind == VERBOSE_ARG)\n"
- " \t\t\t_switches[VERBOSE_ARG]++;\n"
- "@@ -2027,13 +2456,7 @@ static int _process_switches(int *argc, \n"
- " \t\treturn 0;\n"
- " \t}\n"
- " \n"
- "-\tif (_switches[COLS_ARG] && _switches[OPTIONS_ARG] &&\n"
- "-\t    strcmp(_fields, \"name\")) {\n"
- "-\t\tfprintf(stderr, \"Only -o name is supported so far.\\n\");\n"
- "-\t\treturn 0;\n"
- "-\t}\n"
- "-\n"
- "-\tif (_switches[TREE_ARG] && !_process_tree_options(_fields))\n"
- "+\tif (_switches[TREE_ARG] && !_process_tree_options(_fields[OPTIONS_ARG]))\n"
- " \t\treturn 0;\n"
- " \n"
- " \tif (_switches[TABLE_ARG] && _switches[NOTABLE_ARG]) {"
- "\01:3\0"
- "b\0"
+ "Jun'ichi Nomura, NEC Corporation of America\n"
+ "-------------- next part --------------\n"
+ "A non-text attachment was scrubbed...\n"
+ "Name: 02-dmsetup-report.patch\n"
+ "Type: text/x-patch\n"
+ "Size: 17162 bytes\n"
+ "Desc: not available\n"
+ URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20070112/47367b4c/attachment.bin>
 
-5ab42cf024c220a92bece3d8d36f4291829742a973fd10ae5fab4bceec9d70e1
+6a545ffca6d036b04b1aaa5829c2641abd6c0abf98a29287426c8a19c87ae1c0

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.