]> sourceware.org Git - lvm2.git/commitdiff
metadata: use outfc for comments
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 16 Jul 2014 21:57:43 +0000 (23:57 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 17 Jul 2014 14:17:44 +0000 (16:17 +0200)
Few unecessary comments were written to on-disc metadata.
Use outfc() to have comments only in archived files.
(may also save couple bytes in ringbuffer).

TODO: needed validation against newline char...

lib/format_text/export.c
lib/striped/striped.c

index 319e5ea5e5e08e68d2f4674ec2b063ac52b94a1c..aa0d905efdd4ddc5d4e79df6faf43d37241e7874 100644 (file)
@@ -329,6 +329,7 @@ static int _print_header(struct formatter *f,
 {
        char *buf;
        time_t t;
+       char com[PATH_MAX];
 
        t = time(NULL);
 
@@ -344,9 +345,10 @@ static int _print_header(struct formatter *f,
        }
        outf(f, "description = \"%s\"", dm_escape_double_quotes(buf, desc));
        outnl(f);
-       outf(f, "creation_host = \"%s\"\t# %s %s %s %s %s", _utsname.nodename,
-            _utsname.sysname, _utsname.nodename, _utsname.release,
-            _utsname.version, _utsname.machine);
+       (void) dm_snprintf(com, sizeof(com), "# %s %s %s %s %s",
+                          _utsname.sysname, _utsname.nodename, _utsname.release,
+                          _utsname.version, _utsname.machine);
+       outfc(f, com, "creation_host = \"%s\"", _utsname.nodename);
        outf(f, "creation_time = %lu\t# %s", t, ctime(&t));
 
        return 1;
@@ -396,7 +398,7 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
        outf(f, "seqno = %u", vg->seqno);
 
        if (vg->fid && vg->fid->fmt)
-               outf(f, "format = \"%s\" # informational", vg->fid->fmt->name);
+               outfc(f, "# informational", "format = \"%s\"", vg->fid->fmt->name);
 
        if (!_print_flag_config(f, vg->status, VG_FLAGS))
                return_0;
index 3b0846780dba9ad0120cc91e32a85888bec74b27..dfd45181fb5ac531e8748fff36ffa095ff47b1db 100644 (file)
@@ -94,8 +94,8 @@ static int _striped_text_import(struct lv_segment *seg, const struct dm_config_n
 static int _striped_text_export(const struct lv_segment *seg, struct formatter *f)
 {
 
-       outf(f, "stripe_count = %u%s", seg->area_count,
-            (seg->area_count == 1) ? "\t# linear" : "");
+       outfc(f, (seg->area_count == 1) ? "# linear" : NULL,
+             "stripe_count = %u", seg->area_count);
 
        if (seg->area_count > 1)
                outsize(f, (uint64_t) seg->stripe_size,
This page took 0.042713 seconds and 5 git commands to generate.