1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

Move basic reporting functions into libdevmapper.

This commit is contained in:
Alasdair Kergon 2007-01-16 18:06:12 +00:00
parent 61997bb9bb
commit d838a1e314
5 changed files with 295 additions and 928 deletions

View File

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

View File

@ -444,7 +444,7 @@ static int _target_register_events(struct cmd_context *cmd,
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 @@ static int _target_unregister_events(struct cmd_context *cmd,
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);

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
#include "tools.h"
#include "lvm2cmdline.h"
#include "label.h"
#include "memlock.h"
#include "version.h"
#include "lvm2cmd.h"

View File

@ -25,7 +25,7 @@ static int _vgs_single(struct cmd_context *cmd __attribute((unused)),
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 @@ static int _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
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 _lvs_single(struct cmd_context *cmd, struct logical_volume *lv,
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 @@ static int _pvsegs_sub_single(struct cmd_context *cmd, struct volume_group *vg,
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 @@ static int _pvs_single(struct cmd_context *cmd, struct volume_group *vg,
}
}
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 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
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 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,
break;
}
report_output(report_handle);
dm_report_output(report_handle);
report_free(report_handle);
dm_report_free(report_handle);
return r;
}