Skip to contentSkip to conversation

LVM2 ./WHATS_NEW lib/mirror/mirrored.c lib/rep ...

PATCH [email protected] 1 participant 1 message Jan 16, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: agk at sourceware.org 2007-01-16 18:06:12

Modified files:

	.              : WHATS_NEW 
	lib/mirror     : mirrored.c 
	lib/report     : report.c 
	tools          : lvmcmdlib.c reporter.c 

Log message:
Move basic reporting functions into libdevmapper.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.542&r2=1.543
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/mirror/mirrored.c.diff?cvsroot=lvm2&r1=1.40&r2=1.41
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/report/report.c.diff?cvsroot=lvm2&r1=1.50&r2=1.51
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvmcmdlib.c.diff?cvsroot=lvm2&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/reporter.c.diff?cvsroot=lvm2&r1=1.16&r2=1.17

WHATS_NEW +1 -0
@@ -1,5 +1,6 @@
 Version 2.02.19 - 
 ===================================
+  Move basic reporting functions into libdevmapper.
   Fix partition table processing after sparc changes (2.02.16).
   Fix cmdline PE range processing segfault (2.02.13).
   Some libdevmapper-event interface changes.
lib/mirror/mirrored.c +2 -2
@@ -444,7 +444,7 @@
 		return_0;
 
 	dm_event_handler_set_dso(dmevh, dso);
-	dm_event_handler_set_devname(dmevh, name);
+	dm_event_handler_set_dev_name(dmevh, name);
 	dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS);
 	if (!dm_event_register_handler(dmevh)) {
 		dm_event_handler_destroy(dmevh);
@@ -481,7 +481,7 @@
 		return_0;
 
 	dm_event_handler_set_dso(dmevh, dso);
-	dm_event_handler_set_devname(dmevh, name);
+	dm_event_handler_set_dev_name(dmevh, name);
 	dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS);
 	if (!dm_event_unregister_handler(dmevh)) {
 		dm_event_handler_destroy(dmevh);
lib/report/report.c +254 -909

1,634 lines not on this page · raw message

tools/lvmcmdlib.c +1 -0
@@ -16,6 +16,7 @@
 #include "tools.h"
 #include "lvm2cmdline.h"
 #include "label.h"
+#include "memlock.h"
 #include "version.h"
 
 #include "lvm2cmd.h"
tools/reporter.c +27 -7
@@ -25,7 +25,7 @@
 		return ECMD_FAILED;
 	}
 
-	if (!report_object(handle, vg, NULL, NULL, NULL, NULL))
+	if (!report_object(handle, vg, NULL, NULL, NULL, NULL));
 		return ECMD_FAILED;
 
 	check_current_backup(vg);
@@ -39,7 +39,7 @@
 	if (!arg_count(cmd, all_ARG) && !lv_is_visible(lv))
 		return ECMD_PROCESSED;
 
-	if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL))
+	if (!report_object(handle, lv->vg, lv, NULL, NULL, NULL));
 		return ECMD_FAILED;
 
 	return ECMD_PROCESSED;
@@ -48,7 +48,7 @@
 static int _segs_single(struct cmd_context *cmd __attribute((unused)),
 			struct lv_segment *seg, void *handle)
 {
-	if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL))
+	if (!report_object(handle, seg->lv->vg, seg->lv, NULL, seg, NULL));
 		return ECMD_FAILED;
 
 	return ECMD_PROCESSED;
@@ -78,7 +78,7 @@
 		goto out;
 	}
 
-	if (!report_object(handle, vg, NULL, pv, NULL, pvseg))
+	if (!report_object(handle, vg, NULL, pv, NULL, pvseg));
 		ret = ECMD_FAILED;
 
 out:
@@ -128,7 +128,7 @@
 		}
 	}
 
-	if (!report_object(handle, vg, NULL, pv, NULL, NULL))
+	if (!report_object(handle, vg, NULL, pv, NULL, NULL));
 		ret = ECMD_FAILED;
 
 out:
@@ -262,6 +262,26 @@
 					  headings)))
 		return 0;
 
+	/* Ensure options selected are compatible */
+	if (report_type & SEGS)
+		report_type |= LVS;
+	if (report_type & PVSEGS)
+		report_type |= PVS;
+	if ((report_type & LVS) && (report_type & PVS)) {
+		log_error("Can't report LV and PV fields at the same time");
+		return 0;
+	}
+
+	/* Change report type if fields specified makes this necessary */
+	if (report_type & SEGS)
+		report_type = SEGS;
+	else if (report_type & LVS)
+		report_type = LVS;
+	else if (report_type & PVSEGS)
+		report_type = PVSEGS;
+	else if (report_type & PVS)
+		report_type = PVS;
+
 	switch (report_type) {
 	case LVS:
 		r = process_each_lv(cmd, argc, argv, LCK_VG_READ, report_handle,
@@ -285,9 +305,9 @@
 		break;
 	}
 
-	report_output(report_handle);
+	dm_report_output(report_handle);
 
-	report_free(report_handle);
+	dm_report_free(report_handle);
 	return r;
 }