summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Ledford <dledford@redhat.com>2008-10-28 11:42:57 -0400
committerDoug Ledford <dledford@redhat.com>2008-10-28 11:42:57 -0400
commitce1a9e3cfca9342080fe66a1352acd1671a49261 (patch)
tree1d01926b574794fa419f12c7a0c739ab39a52787
parentc1f11bd8bbb8aa48ec3f22587fbf710f438ff954 (diff)
downloadmdadm-ce1a9e3cfca9342080fe66a1352acd1671a49261.tar.gz
mdadm-ce1a9e3cfca9342080fe66a1352acd1671a49261.tar.xz
mdadm-ce1a9e3cfca9342080fe66a1352acd1671a49261.zip
Fix bad metadata formatting
Certain operations (Detail.c mainly) would print out the metadata of an array in a format that the scan operation in super0.c and super1.c would later reject as unknown when it was found in the mdadm.conf file. Use a consistent format, but also modify the super0 and super1 match methods to accept the other format without complaint. Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r--Detail.c6
-rw-r--r--super0.c5
-rw-r--r--super1.c3
3 files changed, 10 insertions, 4 deletions
diff --git a/Detail.c b/Detail.c
index ab2f84e..1937fbe 100644
--- a/Detail.c
+++ b/Detail.c
@@ -138,7 +138,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
if (sra && sra->array.major_version < 0)
printf("MD_METADATA=%s\n", sra->text_version);
else
- printf("MD_METADATA=%02d.%02d\n",
+ printf("MD_METADATA=%d.%02d\n",
array.major_version, array.minor_version);
if (st && st->sb)
@@ -153,7 +153,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
if (sra && sra->array.major_version < 0)
printf(" metadata=%s", sra->text_version);
else
- printf(" metadata=%02d.%02d",
+ printf(" metadata=%d.%02d",
array.major_version, array.minor_version);
} else {
mdu_bitmap_file_t bmf;
@@ -175,7 +175,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
if (sra && sra->array.major_version < 0)
printf(" Version : %s\n", sra->text_version);
else
- printf(" Version : %02d.%02d\n",
+ printf(" Version : %d.%02d\n",
array.major_version, array.minor_version);
atime = array.ctime;
diff --git a/super0.c b/super0.c
index 7e81482..42d8659 100644
--- a/super0.c
+++ b/super0.c
@@ -93,7 +93,7 @@ static void examine_super0(struct supertype *st, char *homehost)
char *c;
printf(" Magic : %08x\n", sb->md_magic);
- printf(" Version : %02d.%02d.%02d\n", sb->major_version, sb->minor_version,
+ printf(" Version : %d.%02d.%02d\n", sb->major_version, sb->minor_version,
sb->patch_version);
if (sb->minor_version >= 90) {
printf(" UUID : %08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
@@ -847,6 +847,9 @@ static struct supertype *match_metadata_desc0(char *arg)
st->minor_version = 90;
st->max_devs = MD_SB_DISKS;
st->sb = NULL;
+ /* Eliminate pointless leading 0 from some versions of mdadm -D */
+ if (strncmp(arg, "00.", 3) == 0)
+ arg++;
if (strcmp(arg, "0") == 0 ||
strcmp(arg, "0.90") == 0 ||
strcmp(arg, "0.91") == 0 ||
diff --git a/super1.c b/super1.c
index e1d0219..a81ee6f 100644
--- a/super1.c
+++ b/super1.c
@@ -1186,6 +1186,9 @@ static struct supertype *match_metadata_desc1(char *arg)
st->ss = &super1;
st->max_devs = 384;
st->sb = NULL;
+ /* Eliminate pointless leading 0 from some versions of mdadm -D */
+ if (strncmp(arg, "01.", 3) == 0)
+ arg++;
if (strcmp(arg, "1.0") == 0) {
st->minor_version = 0;
return st;