From 30ef4c738a8175f0b84081d77ce26dd542780ae1 Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Tue, 24 Jun 2008 21:21:04 +0000 Subject: [PATCH] Add --unquoted to reporting tools. --- WHATS_NEW | 22 ++++++++++------------ lib/config/defaults.h | 1 + lib/report/report.c | 6 +++++- lib/report/report.h | 3 ++- tools/args.h | 1 + tools/commands.h | 10 +++++++--- tools/reporter.c | 8 ++++++-- 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index dc56ef125..4c59c07d2 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,17 +1,15 @@ Version 2.02.39 - ================================ - Suppress invalid 'sb_offset' compiler warning with uninitialzed_var(). - Add uninitialzed_var() macro to suppress invalid compiler warnings. - Suppress 'sb_offset' compiler warning by using enum for md minor sb version. - lvm2_run: Don't return uninitialized "ret" for _memlock_inc or _memlock_dec. - Avoid link failure when configuring without --enable-cmdlib. - Avoid link failure when configuring without --enable-readline. - Make clvmd return immediately if other nodes are down in an openais cluster. - Make clvmd return immediately if other nodes are down in a gulm cluster. - Improve/Fix read ahead 'auto' calculation for stripe_size - Fix lvchange output for -r auto setting if auto is already set - Add testcase for read ahead - Fix ambiguous use of identifier 'error_message_produced'. + Add --unquoted to reporting tools. + Add and use uninitialized_var() macro to suppress invalid compiler warnings. + Introduce enum for md minor sb version to suppress compiler warning. + Avoid undefined return value after _memlock manipulation in lvm2_run. + Avoid link failure if configured without --enable-cmdlib or --enable-readline. + Make clvmd return at once if other nodes down in a gulm or openais cluster. + Fix and improve readahead 'auto' calculation for stripe_size. + Fix lvchange output for -r auto setting if auto is already set. + Add test case for readahead. + Fix ambiguous use of identifier error_message_produced. Begin syncing configure.in for merge/unification with device-mapper. Fix add_mirror_images not to dereference uninitialized log_lv upon failure. Don't call openlog for every debug line output by clvmd. diff --git a/lib/config/defaults.h b/lib/config/defaults.h index 4be02f909..b55fa71dc 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -103,6 +103,7 @@ #define DEFAULT_REP_BUFFERED 1 #define DEFAULT_REP_HEADINGS 1 #define DEFAULT_REP_PREFIXES 0 +#define DEFAULT_REP_QUOTED 1 #define DEFAULT_REP_SEPARATOR " " #define DEFAULT_LVS_COLS "lv_name,vg_name,lv_attr,lv_size,origin,snap_percent,move_pv,mirror_log,copy_percent,convert_lv" diff --git a/lib/report/report.c b/lib/report/report.c index f2ffd9827..46e268328 100644 --- a/lib/report/report.c +++ b/lib/report/report.c @@ -1077,7 +1077,8 @@ static struct dm_report_field_type _fields[] = { 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 aligned, int buffered, int headings, int field_prefixes, + int quoted) { uint32_t report_flags = 0; void *rh; @@ -1094,6 +1095,9 @@ void *report_init(struct cmd_context *cmd, const char *format, const char *keys, if (field_prefixes) report_flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX; + if (!quoted) + report_flags |= DM_REPORT_OUTPUT_FIELD_UNQUOTED; + rh = dm_report_init(report_type, _report_types, _fields, format, separator, report_flags, keys, cmd); diff --git a/lib/report/report.h b/lib/report/report.h index 40eac504b..d2bf89218 100644 --- a/lib/report/report.h +++ b/lib/report/report.h @@ -28,7 +28,8 @@ typedef int (*field_report_fn) (struct report_handle * dh, struct field * field, 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 aligned, int buffered, int headings, int field_prefixes, + int quoted); void report_free(void *handle); int report_object(void *handle, struct volume_group *vg, struct logical_volume *lv, struct physical_volume *pv, diff --git a/tools/args.h b/tools/args.h index 220659c94..ff6b886f7 100644 --- a/tools/args.h +++ b/tools/args.h @@ -54,6 +54,7 @@ arg(config_ARG, '\0', "config", string_arg, 0) arg(trustcache_ARG, '\0', "trustcache", NULL, 0) arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0) arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0) +arg(unquoted_ARG, '\0', "unquoted", NULL, 0) /* Allow some variations */ arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0) diff --git a/tools/commands.h b/tools/commands.h index ebb0bd200..12e771126 100644 --- a/tools/commands.h +++ b/tools/commands.h @@ -377,6 +377,7 @@ xx(lvs, "\t[--trustcache]\n" "\t[--unbuffered]\n" "\t[--units hsbkmgtHKMGT]\n" + "\t[--unquoted]\n" "\t[-v|--verbose]\n" "\t[--version]" "\n" "\t[LogicalVolume[Path] [LogicalVolume[Path]...]]\n", @@ -384,7 +385,7 @@ xx(lvs, aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, - units_ARG) + units_ARG, unquoted_ARG) xx(lvscan, "List all logical volumes in all volume groups", @@ -586,6 +587,7 @@ xx(pvs, "\t[--trustcache]\n" "\t[--unbuffered]\n" "\t[--units hsbkmgtHKMGT]\n" + "\t[--unquoted]\n" "\t[-v|--verbose]\n" "\t[--version]\n" "\t[PhysicalVolume [PhysicalVolume...]]\n", @@ -593,7 +595,7 @@ xx(pvs, aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, segments_ARG, separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, - units_ARG) + units_ARG, unquoted_ARG) xx(pvscan, "List all physical volumes", @@ -902,13 +904,15 @@ xx(vgs, "\t[--trustcache]\n" "\t[--unbuffered]\n" "\t[--units hsbkmgtHKMGT]\n" + "\t[--unquoted]\n" "\t[-v|--verbose]\n" "\t[--version]\n" "\t[VolumeGroupName [VolumeGroupName...]]\n", aligned_ARG, all_ARG, ignorelockingfailure_ARG, nameprefixes_ARG, noheadings_ARG, nolocking_ARG, nosuffix_ARG, options_ARG, partial_ARG, - separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG) + separator_ARG, sort_ARG, trustcache_ARG, unbuffered_ARG, units_ARG, + unquoted_ARG) xx(vgscan, "Search for all volume groups", diff --git a/tools/reporter.c b/tools/reporter.c index 2da41d7e1..5f8d822a3 100644 --- a/tools/reporter.c +++ b/tools/reporter.c @@ -158,7 +158,7 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, char *str; const char *keys = NULL, *options = NULL, *separator; int r = ECMD_PROCESSED; - int aligned, buffered, headings, field_prefixes; + int aligned, buffered, headings, field_prefixes, quoted; unsigned args_are_pvs; aligned = find_config_tree_int(cmd, "report/aligned", @@ -171,6 +171,8 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, DEFAULT_REP_SEPARATOR); field_prefixes = find_config_tree_int(cmd, "report/prefixes", DEFAULT_REP_PREFIXES); + quoted = find_config_tree_int(cmd, "report/quoted", + DEFAULT_REP_QUOTED); args_are_pvs = (report_type == PVS || report_type == PVSEGS) ? 1 : 0; @@ -276,10 +278,12 @@ static int _report(struct cmd_context *cmd, int argc, char **argv, aligned = 0; field_prefixes = 1; } + if (arg_count(cmd, unquoted_ARG)) + quoted = 0; if (!(report_handle = report_init(cmd, options, keys, &report_type, separator, aligned, buffered, - headings, field_prefixes))) { + headings, field_prefixes, quoted))) { stack; return ECMD_FAILED; }