master - report: recognize selection (-S|--select) for each subreport; make -S|--select groupable
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b864a062217cf31d86343f37ecbefeeeb15610cf Commit: b864a062217cf31d86343f37ecbefeeeb15610cf Parent: e081203f3e2ee5e3270c7f5f2753ed446d8b72cb Author: Peter Rajnoha <[email protected]> AuthorDate: Thu May 26 15:20:27 2016 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Mon Jun 20 11:33:42 2016 +0200
report: recognize selection (-S|--select) for each subreport; make -S|--select groupable
--- WHATS_NEW | 1 + lib/report/report.h | 1 + tools/args.h | 2 +- tools/reporter.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++---- tools/toollib.c | 7 ++++- 5 files changed, 57 insertions(+), 8 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.158 - ================================= + Make -S|--select option groupable that allows this option to be repeated. Make -O|--sort option groupable that allows this option to be repeated. Add --configreport option to select report for which next options are applied. Add support for priorities on grouping command arguments.
lib/report/report.h +1 -0
@@ -88,6 +88,7 @@ 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, int quoted, int columns_as_rows, const char *selection); +int report_get_single_selection (struct cmd_context *cmd,const char **selection);void *report_init_for_selection (struct cmd_context *cmd,report_type_t *report_type,const char *selection);const char *report_get_field_prefix (report_type_t report_type);
tools/args.h +1 -1
@@ -206,7 +206,7 @@ arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0, 0) arg(snapshot_ARG, 's', "snapshot", NULL, 0, 0) arg(short_ARG, 's', "short", NULL, 0, 0) arg(stdin_ARG, 's', "stdin", NULL, 0, 0) -arg(select_ARG, 'S', "select", string_arg, 0, 0) +arg(select_ARG, 'S', "select", string_arg, ARG_GROUPABLE, 0) arg(test_ARG, 't', "test", NULL, 0, 0) arg(thin_ARG, 'T', "thin", NULL, 0, 0)arg (uuid_ARG,'u' ,"uuid" ,NULL ,0 ,0 )
tools/reporter.c +49 -5
65 lines not on this page · raw message
tools/toollib.c +5 -2
@@ -1742,15 +1742,18 @@ int init_selection_handle(struct cmd_context *cmd, struct processing_handle *han report_type_t initial_report_type) {struct selection_handle *sh; +const char *selection;if (!(sh =dm_pool_zalloc (cmd->mem,sizeof (struct selection_handle )))) {log_error ("_init_selection_handle: failed to allocate memory for selection handle" );return 0 ; } +if (!report_get_single_selection (cmd, &selection)) + return_0; + sh->report_type = initial_report_type; -if (!(sh->selection_rh =report_init_for_selection (cmd, &sh->report_type, -arg_str_value (cmd, select_ARG,NULL )))) { +if (!(sh->selection_rh =report_init_for_selection (cmd, &sh->report_type, selection))) {dm_pool_free (cmd->mem, sh); return_0; }