master - report: make "help" and "?" field implicit
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cd7325f18d6869452447b7e1d08d8ada7703e0de Commit: cd7325f18d6869452447b7e1d08d8ada7703e0de Parent: 012dab7aa3373201e59a77fa1e11823bd95c771c Author: Peter Rajnoha <[email protected]> AuthorDate: Thu Jun 19 15:33:16 2014 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Thu Jun 19 16:09:31 2014 +0200
report: make "help" and "?" field implicit
Making "help" and "?" implicit also simplifies code since the dm_report_init caller (lvm/dmsetup) doesn't need to check on dm_report_init return whether "help" or "?" was hit while parsing fields/sort keys in libdevmapper.
The libdevmapper now sets internal "RH_ALREADY_REPORTED" flag after it reports the "help" or "?" implicit field. Then libdevmapper itself checks for this flag in dm_report_object and if found, the actual reporting is skipped (because the "help" implicit field was reported instead of the actual report).
--- WHATS_NEW_DM | 1 + libdm/libdm-report.c | 84 +++++++++++++++++++++++++++++++++---------------- tools/reporter.c | 11 +------ 3 files changed, 58 insertions(+), 38 deletions(-)
WHATS_NEW_DM +1 -0
@@ -1,5 +1,6 @@ Version 1.02.88 - ================================= + Make "help" and "?" reporting fields implicit. Recognize implicit "selected" field if using dm_report_init_with_selection. Add support for implicit reporting fields which are predefined in libdm. Add DM_REPORT_FIELD_TYPE_PERCENT: separate number and percent fields.
libdm/libdm-report.c +56 -28
156 lines not on this page · raw message
tools/reporter.c +1 -10
@@ -354,17 +354,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv,if (!(report_handle =report_init (cmd, options, keys, &report_type, separator, aligned, buffered, headings, field_prefixes, quoted, - columns_as_rows, selection))) { -if ( (!strcasecmp (options,DM_REPORT_FIELD_RESERVED_NAME_HELP ) || - !strcmp (options,DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT )) || - (!strcasecmp (keys,DM_REPORT_FIELD_RESERVED_NAME_HELP ) || - !strcmp (keys,DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT )) || - (selection && - (!strcasecmp (selection,DM_REPORT_FIELD_RESERVED_NAME_HELP ) || - !strcmp (selection,DM_REPORT_FIELD_RESERVED_NAME_HELP_ALT ))) ) -return r; + columns_as_rows, selection))) return_ECMD_FAILED; - }/* Ensure options selected are compatible */ if (report_type &SEGS )