Skip to contentSkip to conversation

master - toollib: add report_format_init fn to create report group and to create/add log report handle

PATCH Peter Rajnoha 1 participant 1 message Jun 20, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=79a74e9aaecee0b02cfd83f544a99870f29e0016
Commit:        79a74e9aaecee0b02cfd83f544a99870f29e0016
Parent:        c36d4632a697f6e8f68a214a7c7db9f6fb25c09c
Author:        Peter Rajnoha <[email protected]>
AuthorDate:    Mon May 2 14:22:02 2016 +0200
Committer:     Peter Rajnoha <[email protected]>
CommitterDate: Mon Jun 20 11:33:41 2016 +0200

toollib: add report_format_init fn to create report group and to create/add log report handle

Add new --reportformat option and new report_format_init function that checks this option and creates new report group accordingly, also preparing log report handle and adding it to the report group just created.

---
 WHATS_NEW           |    1 +
 lib/report/report.h |    3 ++
 tools/args.h        |    1 +
 tools/reporter.c    |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 0 deletions(-)
WHATS_NEW +1 -0
index 1e80d82..90ae561 100644
@@ -1,5 +1,6 @@
 Version 2.02.158 - 
 =================================
+  Recognize --reportformat {basic|json} option to select report output format.
   Add log/command_log_{sort,cols} to lvm.conf to configure command log report.
   Add log_object_{type,name,id,group,group_id} fields to cmd log.
   Add log_{seq_num,type,context,message,errno,ret_code} fields to cmd log.
lib/report/report.h +3 -0
index 06ffe70..62c52dc 100644
@@ -80,6 +80,9 @@ struct processing_handle;
 typedef int (*field_report_fn) (struct report_handle * dh, struct field * field,
 				const void *data);
 
+int report_format_init(struct cmd_context *cmd, dm_report_group_type_t *report_group_type,
+		       struct dm_report_group **report_group, struct dm_report **log_rh);
+
 void *report_init(struct cmd_context *cmd, const char *format, const char *keys,
 		  report_type_t *report_type, const char *separator,
 		  int aligned, int buffered, int headings, int field_prefixes,
tools/args.h +1 -0
index ef9dbc9..049ea5a 100644
@@ -96,6 +96,7 @@ arg(refresh_ARG, '\0', "refresh", NULL, 0)
 arg(removemissing_ARG, '\0', "removemissing", NULL, 0)
 arg(repair_ARG, '\0', "repair", NULL, 0)
 arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE)
+arg(reportformat_ARG, '\0', "reportformat", string_arg, 0)
 arg(restorefile_ARG, '\0', "restorefile", string_arg, 0)
 arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0)
 arg(resync_ARG, '\0', "resync", NULL, 0)
tools/reporter.c +66 -0

75 lines not on this page · raw message