]> sourceware.org Git - lvm2.git/commitdiff
dmsetup --unquoted
authorAlasdair Kergon <agk@redhat.com>
Tue, 24 Jun 2008 20:16:47 +0000 (20:16 +0000)
committerAlasdair Kergon <agk@redhat.com>
Tue, 24 Jun 2008 20:16:47 +0000 (20:16 +0000)
WHATS_NEW_DM
libdm/libdevmapper.h
libdm/libdm-report.c
tools/dmsetup.c

index 799515470369c0881c0dd13de81be0bd71c9ee51..3a58ceb27dff09de34aedd7ba6d8fe14acac8476 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.27 -
 ===============================
+  Add --unquoted to dmsetup.
   Avoid compiler warning about cast in dmsetup.c's OFFSET_OF macro.
   Fix inverted no_flush debug message.
   Remove --enable-jobs from configure. (Set at runtime instead.)
index 6988ccdedeba430a3ad611b6488010b901d1a648..93d594a980fe8a8991b36cfa9c6dc91a2c0fe92a 100644 (file)
@@ -740,6 +740,7 @@ struct dm_report_field_type {
 #define DM_REPORT_OUTPUT_BUFFERED              0x00000002
 #define DM_REPORT_OUTPUT_HEADINGS              0x00000004
 #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,
                                 const struct dm_report_object_type *types,
index d6ae27db983c37b39c032368e8ebce3608b4708d..8f8bc1f671df7de42188db8a3b89aad0f137b179 100644 (file)
@@ -845,7 +845,13 @@ int dm_report_output(struct dm_report *rh)
 
                                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");
                                        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)) {
                                        log_error("dm_report: Unable to extend output line");
                                        goto bad;
index b242f1ca155ad20faabc276c29ac6eed884ad80b..48c29e3696366460f83861b1e17b647cbd07255a 100644 (file)
@@ -130,6 +130,7 @@ enum {
        TREE_ARG,
        UID_ARG,
        UNBUFFERED_ARG,
+       UNQUOTED_ARG,
        UUID_ARG,
        VERBOSE_ARG,
        VERSION_ARG,
@@ -1975,7 +1976,7 @@ static int _report_init(struct command *c)
        char *options = (char *) default_report_options;
        const char *keys = "";
        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;
        size_t len = 0;
        int r = 0;
@@ -1990,6 +1991,9 @@ static int _report_init(struct command *c)
        if (_switches[UNBUFFERED_ARG])
                buffered = 0;
 
+       if (_switches[UNQUOTED_ARG])
+               quoted = 0;
+
        if (_switches[NAMEPREFIXES_ARG]) {
                aligned = 0;
                field_prefixes = 1;
@@ -2040,6 +2044,9 @@ static int _report_init(struct command *c)
        if (field_prefixes)
                flags |= DM_REPORT_OUTPUT_FIELD_NAME_PREFIX;
 
+       if (!quoted)
+               flags |= DM_REPORT_OUTPUT_FIELD_UNQUOTED;
+
        if (!(_report = dm_report_init(&_report_type,
                                       _report_types, _report_fields,
                                       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},
                {"uuid", 1, &ind, UUID_ARG},
                {"unbuffered", 0, &ind, UNBUFFERED_ARG},
+               {"unquoted", 0, &ind, UNQUOTED_ARG},
                {"verbose", 1, &ind, VERBOSE_ARG},
                {"version", 0, &ind, VERSION_ARG},
                {0, 0, 0, 0}
@@ -2646,8 +2654,8 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
                }
                if ((ind == TREE_ARG))
                        _switches[TREE_ARG]++;
-               if ((ind == UNBUFFERED_ARG))
-                       _switches[UNBUFFERED_ARG]++;
+               if ((ind == UNQUOTED_ARG))
+                       _switches[UNQUOTED_ARG]++;
                if ((ind == VERSION_ARG))
                        _switches[VERSION_ARG]++;
        }
This page took 0.050515 seconds and 5 git commands to generate.