]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Detail.c
super_by_fd: return subarray info explicitly.
[thirdparty/mdadm.git] / Detail.c
index eb51a3ecee279a328c5c0fb8d42ab00601ece2e9..0cc1bcf6637bdd8a15ac23c6dfbce5cad480dc05 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -49,6 +49,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
        int is_rebuilding = 0;
        int failed = 0;
        struct supertype *st;
+       char *subarray = NULL;
        int max_disks = MD_SB_DISKS; /* just a default */
        struct mdinfo info;
        struct mdinfo *sra;
@@ -88,7 +89,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                return rv;
        }
        sra = sysfs_read(fd, 0, GET_VERSION);
-       st = super_by_fd(fd);
+       st = super_by_fd(fd, &subarray);
 
        if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
                stb.st_rdev = 0;
@@ -139,6 +140,8 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                if (st->sb)
                        st->ss->free_super(st);
 
+               if (subarray)
+                       strcpy(st->subarray, subarray);
                err = st->ss->load_super(st, fd2, NULL);
                close(fd2);
                if (err)
@@ -581,6 +584,7 @@ This is pretty boring
        free(disks);
 out:
        close(fd);
+       free(subarray);
        return rv;
 }