summaryrefslogtreecommitdiffstats
path: root/lib/format_text/export.c
diff options
context:
space:
mode:
authorPetr Rockai <prockai@redhat.com>2008-07-10 11:30:57 +0000
committerPetr Rockai <prockai@redhat.com>2008-07-10 11:30:57 +0000
commitbc437fededad674542cee626c9ede05163a568bd (patch)
tree80ac9572a34c0ad8e48225911869f1f32090d07c /lib/format_text/export.c
parent367a0ac052835b384b55660c830d75fcb9535c69 (diff)
downloadlvm2-bc437fededad674542cee626c9ede05163a568bd.tar.gz
lvm2-bc437fededad674542cee626c9ede05163a568bd.tar.xz
lvm2-bc437fededad674542cee626c9ede05163a568bd.zip
Add "flags" metadata field (akin to "status") for backward-compatible flags.
The "status" field is treated as it ever has been, unknown flags there are treated as fatal metadata errors. However, in the "flags" field, any unknown flags will be ignored and silently dropped. This improves backward-compatibility possibilities. (Any versions without support for this new "flag" field will drop the field altogether, which is same as ignoring all the flags there.)
Diffstat (limited to 'lib/format_text/export.c')
-rw-r--r--lib/format_text/export.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 9c138d4a..b6e818fe 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -321,6 +321,20 @@ static int _print_header(struct formatter *f,
return 1;
}
+static int _print_flag_config(struct formatter *f, int status, int type)
+{
+ char buffer[4096];
+ if (!print_flags(status, type | STATUS_FLAG, buffer, sizeof(buffer)))
+ return_0;
+ outf(f, "status = %s", buffer);
+
+ if (!print_flags(status, type, buffer, sizeof(buffer)))
+ return_0;
+ outf(f, "flags = %s", buffer);
+
+ return 1;
+}
+
static int _print_vg(struct formatter *f, struct volume_group *vg)
{
char buffer[4096];
@@ -332,9 +346,8 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
outf(f, "seqno = %u", vg->seqno);
- if (!print_flags(vg->status, VG_FLAGS, buffer, sizeof(buffer)))
+ if (!_print_flag_config(f, vg->status, VG_FLAGS))
return_0;
- outf(f, "status = %s", buffer);
if (!list_empty(&vg->tags)) {
if (!print_tags(&vg->tags, buffer, sizeof(buffer)))
@@ -408,9 +421,8 @@ static int _print_pvs(struct formatter *f, struct volume_group *vg)
return_0;
outnl(f);
- if (!print_flags(pv->status, PV_FLAGS, buffer, sizeof(buffer)))
+ if (!_print_flag_config(f, pv->status, PV_FLAGS))
return_0;
- outf(f, "status = %s", buffer);
if (!list_empty(&pv->tags)) {
if (!print_tags(&pv->tags, buffer, sizeof(buffer)))
@@ -520,9 +532,8 @@ static int _print_lv(struct formatter *f, struct logical_volume *lv)
outf(f, "id = \"%s\"", buffer);
- if (!print_flags(lv->status, LV_FLAGS, buffer, sizeof(buffer)))
+ if (!_print_flag_config(f, lv->status, LV_FLAGS))
return_0;
- outf(f, "status = %s", buffer);
if (!list_empty(&lv->tags)) {
if (!print_tags(&lv->tags, buffer, sizeof(buffer)))