summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2016-05-23 10:16:29 +0200
committerPeter Rajnoha <prajnoha@redhat.com>2016-06-02 14:08:11 +0200
commit232bc957bd14b8905a7fd03e0debaf95f91a68a5 (patch)
tree53d28914464a47acfe939f86bbc450e44f419c09
parentcd5e71e6b8f218cbef00fa27b6bf96f2526123fd (diff)
downloadlvm2-232bc957bd14b8905a7fd03e0debaf95f91a68a5.tar.gz
toollib: add report_group and status_rh to processing_handle and initialize cmd processing status report
-rw-r--r--tools/toollib.c9
-rw-r--r--tools/toollib.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index 0de6ee847..f36ab99f2 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -1725,6 +1725,11 @@ struct processing_handle *init_processing_handle(struct cmd_context *cmd)
handle->internal_report_for_select = arg_is_set(cmd, select_ARG);
handle->include_historical_lvs = cmd->include_historical_lvs;
+ if (!report_format_init(cmd, &handle->report_group, &handle->status_rh)) {
+ dm_pool_free(cmd->mem, handle);
+ return NULL;
+ }
+
return handle;
}
@@ -1754,6 +1759,10 @@ void destroy_processing_handle(struct cmd_context *cmd, struct processing_handle
if (handle) {
if (handle->selection_handle && handle->selection_handle->selection_rh)
dm_report_free(handle->selection_handle->selection_rh);
+ if (!dm_report_group_destroy(handle->report_group))
+ stack;
+ if (handle->status_rh)
+ dm_report_free(handle->status_rh);
/*
* TODO: think about better alternatives:
* handle mempool, dm_alloc for handle memory...
diff --git a/tools/toollib.h b/tools/toollib.h
index 06d0ef9fc..cddb36d20 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -72,6 +72,8 @@ struct processing_handle {
int internal_report_for_select;
int include_historical_lvs;
struct selection_handle *selection_handle;
+ struct dm_report_group *report_group;
+ struct dm_report *status_rh;
void *custom_handle;
};