Doug Ledford: Fix bad metadata formatting
Martin F. Krafft
madduck at alioth.debian.org
Tue Nov 11 11:27:54 UTC 2008
Module: mdadm
Branch: upstream
Commit: d7ee65c960fa8a6886df7416307f57545ddc4460
URL: http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=d7ee65c960fa8a6886df7416307f57545ddc4460
Author: Doug Ledford <dledford at redhat.com>
Date: Wed Oct 29 15:05:35 2008 -0400
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 at redhat.com>
Signed-off-by: NeilBrown <neilb at suse.de>
---
Detail.c | 6 +++---
super0.c | 5 ++++-
super1.c | 3 +++
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Detail.c b/Detail.c
index 25b91b1..9ba8af1 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)
@@ -154,7 +154,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);
/* Only try GET_BITMAP_FILE for 0.90.01 and later */
@@ -183,7 +183,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 71dc39c..90fdf23 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,
@@ -846,6 +846,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, "default") == 0 ||
diff --git a/super1.c b/super1.c
index 62a3ab9..1eb88aa 100644
--- a/super1.c
+++ b/super1.c
@@ -1203,6 +1203,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;
More information about the pkg-mdadm-commits
mailing list