]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Use common code to report MD_UUID for --detail --export
authorNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:12:28 +0000 (16:12 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 18 Sep 2008 06:12:28 +0000 (16:12 +1000)
As we need to be able to extract a UUID from any superblock
for matching, use that as the MD_UUID as it will probably be
used for array matching too.

Detail.c
super0.c
super1.c

index ae00bb493373c46292927fd64d3743c472ec2833..4647360c189a9d18231544830f46072323714890 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -169,9 +169,17 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                                printf("MD_METADATA=%02d.%02d\n",
                                       array.major_version, array.minor_version);
                }
+               
+               if (st && st->sb) {
+                       struct mdinfo info;
+                       char nbuf[64];
+                       st->ss->getinfo_super(st, &info);
+                       fname_from_uuid(st, &info, nbuf, ':');
+                       printf("MD_UUID=%s\n", nbuf+5);
 
-               if (st && st->sb)
-                       st->ss->export_detail_super(st);
+                       if (st->ss->export_detail_super)
+                               st->ss->export_detail_super(st);
+               }
                goto out;
        }
 
index 4f58954e45daec0e730a8b1d951d6353e278b8f5..24ea009a9354fa314058a8b0743f35abcd29d1fc 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -301,18 +301,6 @@ static void brief_detail_super0(struct supertype *st)
        else
                printf("%08x", sb->set_uuid0);
 }
-
-static void export_detail_super0(struct supertype *st)
-{
-       mdp_super_t *sb = st->sb;
-       printf("MD_UUID=");
-       if (sb->minor_version >= 90)
-               printf("%08x:%08x:%08x:%08x", sb->set_uuid0, sb->set_uuid1,
-                      sb->set_uuid2, sb->set_uuid3);
-       else
-               printf("%08x", sb->set_uuid0);
-       printf("\n");
-}
 #endif
 
 static int match_home0(struct supertype *st, char *homehost)
@@ -1091,7 +1079,6 @@ struct superswitch super0 = {
        .export_examine_super = export_examine_super0,
        .detail_super = detail_super0,
        .brief_detail_super = brief_detail_super0,
-       .export_detail_super = export_detail_super0,
        .write_init_super = write_init_super0,
        .validate_geometry = validate_geometry0,
        .add_to_super = add_to_super0,
index e71b96961d9a4c0b46a8820de48b0f1fe04a7f01..b7cd962a7e375de6c0c7667749ccf60acaffc88e 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -456,12 +456,6 @@ static void export_detail_super1(struct supertype *st)
                }
        if (len)
                printf("MD_NAME=%.*s\n", len, sb->set_name);
-       printf("MD_UUID=");
-       for (i=0; i<16; i++) {
-               if ((i&3)==0 && i != 0) printf(":");
-               printf("%02x", sb->set_uuid[i]);
-       }
-       printf("\n");
 }
 
 #endif