1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

dmsetup --unquoted

This commit is contained in:
Alasdair Kergon 2008-06-24 20:16:47 +00:00
parent 15db00b53e
commit f1839ac87c
4 changed files with 22 additions and 5 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.27 - Version 1.02.27 -
=============================== ===============================
Add --unquoted to dmsetup.
Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro. Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro.
Fix inverted no_flush debug message. Fix inverted no_flush debug message.
Remove --enable-jobs from configure. (Set at runtime instead.) Remove --enable-jobs from configure. (Set at runtime instead.)

View File

@ -740,6 +740,7 @@ struct dm_report_field_type {
#define DM_REPORT_OUTPUT_BUFFERED 0x00000002 #define DM_REPORT_OUTPUT_BUFFERED 0x00000002
#define DM_REPORT_OUTPUT_HEADINGS 0x00000004 #define DM_REPORT_OUTPUT_HEADINGS 0x00000004
#define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX 0x00000008 #define DM_REPORT_OUTPUT_FIELD_NAME_PREFIX 0x00000008
#define DM_REPORT_OUTPUT_FIELD_UNQUOTED 0x00000010
struct dm_report *dm_report_init(uint32_t *report_types, struct dm_report *dm_report_init(uint32_t *report_types,
const struct dm_report_object_type *types, const struct dm_report_object_type *types,

View File

@ -845,7 +845,13 @@ int dm_report_output(struct dm_report *rh)
free(field_id); free(field_id);
if (!dm_pool_grow_object(rh->mem, "=\'", 2)) { if (!dm_pool_grow_object(rh->mem, "=", 1)) {
log_error("dm_report: Unable to extend output line");
goto bad;
}
if (!(rh->flags & DM_REPORT_OUTPUT_FIELD_UNQUOTED) &&
!dm_pool_grow_object(rh->mem, "\'", 1)) {
log_error("dm_report: Unable to extend output line"); log_error("dm_report: Unable to extend output line");
goto bad; goto bad;
} }
@ -885,7 +891,8 @@ int dm_report_output(struct dm_report *rh)
} }
} }
if (rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) if ((rh->flags & DM_REPORT_OUTPUT_FIELD_NAME_PREFIX) &&
!(rh->flags & DM_REPORT_OUTPUT_FIELD_UNQUOTED))
if (!dm_pool_grow_object(rh->mem, "\'", 1)) { if (!dm_pool_grow_object(rh->mem, "\'", 1)) {
log_error("dm_report: Unable to extend output line"); log_error("dm_report: Unable to extend output line");
goto bad; goto bad;

View File

@ -130,6 +130,7 @@ enum {
TREE_ARG, TREE_ARG,
UID_ARG, UID_ARG,
UNBUFFERED_ARG, UNBUFFERED_ARG,
UNQUOTED_ARG,
UUID_ARG, UUID_ARG,
VERBOSE_ARG, VERBOSE_ARG,
VERSION_ARG, VERSION_ARG,
@ -1975,7 +1976,7 @@ static int _report_init(struct command *c)
char *options = (char *) default_report_options; char *options = (char *) default_report_options;
const char *keys = ""; const char *keys = "";
const char *separator = " "; const char *separator = " ";
int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0; int aligned = 1, headings = 1, buffered = 1, field_prefixes = 0, quoted = 1;
uint32_t flags = 0; uint32_t flags = 0;
size_t len = 0; size_t len = 0;
int r = 0; int r = 0;
@ -1990,6 +1991,9 @@ static int _report_init(struct command *c)
if (_switches[UNBUFFERED_ARG]) if (_switches[UNBUFFERED_ARG])
buffered = 0; buffered = 0;
if (_switches[UNQUOTED_ARG])
quoted = 0;
if (_switches[NAMEPREFIXES_ARG]) { if (_switches[NAMEPREFIXES_ARG]) {
aligned = 0; aligned = 0;
field_prefixes = 1; field_prefixes = 1;
@ -2040,6 +2044,9 @@ static int _report_init(struct command *c)
if (field_prefixes) if (field_prefixes)
flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX; flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
if (!quoted)
flags |= DM_REPORT_OUTPUT_FIELD_UNQUOTED;
if (!(_report = dm_report_init(&_report_type, if (!(_report = dm_report_init(&_report_type,
_report_types, _report_fields, _report_types, _report_fields,
options, separator, flags, keys, NULL))) options, separator, flags, keys, NULL)))
@ -2492,6 +2499,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
{"uid", 1, &ind, UID_ARG}, {"uid", 1, &ind, UID_ARG},
{"uuid", 1, &ind, UUID_ARG}, {"uuid", 1, &ind, UUID_ARG},
{"unbuffered", 0, &ind, UNBUFFERED_ARG}, {"unbuffered", 0, &ind, UNBUFFERED_ARG},
{"unquoted", 0, &ind, UNQUOTED_ARG},
{"verbose", 1, &ind, VERBOSE_ARG}, {"verbose", 1, &ind, VERBOSE_ARG},
{"version", 0, &ind, VERSION_ARG}, {"version", 0, &ind, VERSION_ARG},
{0, 0, 0, 0} {0, 0, 0, 0}
@ -2646,8 +2654,8 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
} }
if ((ind == TREE_ARG)) if ((ind == TREE_ARG))
_switches[TREE_ARG]++; _switches[TREE_ARG]++;
if ((ind == UNBUFFERED_ARG)) if ((ind == UNQUOTED_ARG))
_switches[UNBUFFERED_ARG]++; _switches[UNQUOTED_ARG]++;
if ((ind == VERSION_ARG)) if ((ind == VERSION_ARG))
_switches[VERSION_ARG]++; _switches[VERSION_ARG]++;
} }