diff options
author | Alasdair G Kergon <agk@redhat.com> | 2015-08-13 22:30:39 +0100 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2015-08-13 22:30:39 +0100 |
commit | 043fb32c4b67d1456a77ab7caf0d077f419fae88 (patch) | |
tree | 21b752686448ae51c0b71fafc15b91aa3a918ba4 /libdm | |
parent | b3cd5d294503fcfa4b826456e17071a909d739e1 (diff) | |
download | lvm2-043fb32c4b67d1456a77ab7caf0d077f419fae88.tar.gz |
dmsetup: Restructure arg handling.
Introduce enums and global variables to record cleanly which command we
are processing and eliminate the historically inconsistent use of the
shifted argv[0] and fix assorted bugs discovered along the way.
Add dm_report_is_empty() to indicate there is no data awaiting output
and use this to suppress dmsetup report headings when no data is output
so we don't get a stray line saying 'Help' at the end of reporting help.
Define a report type (as the interface requires) so -o all selects
the right fields in splitname. (A fix for stats list will follow.)
Exit immediately if no device is supplied to dmsetup wipe_table instead
of hitting errors later and failing.
Adjust the command name printed in usage/help output to match command
invoked (most of the time).
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/.exported_symbols.DM_1_02_105 | 1 | ||||
-rw-r--r-- | libdm/libdevmapper.h | 5 | ||||
-rw-r--r-- | libdm/libdm-report.c | 5 |
3 files changed, 11 insertions, 0 deletions
diff --git a/libdm/.exported_symbols.DM_1_02_105 b/libdm/.exported_symbols.DM_1_02_105 new file mode 100644 index 000000000..9b701f147 --- /dev/null +++ b/libdm/.exported_symbols.DM_1_02_105 @@ -0,0 +1 @@ +dm_report_is_empty diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index 192fd0f87..303ed673c 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -2396,6 +2396,11 @@ int dm_report_object_is_selected(struct dm_report *rh, void *object, int do_outp */ int dm_report_compact_fields(struct dm_report *rh); +/* + * Returns 1 if there is no data waiting to be output. + */ +int dm_report_is_empty(struct dm_report *rh); + int dm_report_output(struct dm_report *rh); /* diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c index 17a7e13b2..84b129449 100644 --- a/libdm/libdm-report.c +++ b/libdm/libdm-report.c @@ -4305,6 +4305,11 @@ static int _output_as_columns(struct dm_report *rh) return 0; } +int dm_report_is_empty(struct dm_report *rh) +{ + return dm_list_empty(&rh->rows) ? 1 : 0; +} + int dm_report_output(struct dm_report *rh) { if (dm_list_empty(&rh->rows)) |