]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Detail.c
Assemble: allow members of containers to be assembled and auto-assembled.
[thirdparty/mdadm.git] / Detail.c
index c97172c7fa4459c695185908374315422576e03e..5ff8cd138fd759d6ae2e1ecd1b180d7a7eab1404 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -173,12 +173,23 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                if (st && st->sb) {
                        struct mdinfo info;
                        char nbuf[64];
+                       struct map_ent *mp, *map = NULL;
                        st->ss->getinfo_super(st, &info);
                        fname_from_uuid(st, &info, nbuf, ':');
                        printf("MD_UUID=%s\n", nbuf+5);
+                       mp = map_by_uuid(&map, info.uuid);
+                       if (mp && mp->path &&
+                           strncmp(mp->path, "/dev/md/", 8) == 0)
+                               printf("MD_DEVNAME=%s\n", mp->path+8);
 
                        if (st->ss->export_detail_super)
                                st->ss->export_detail_super(st);
+               } else {
+                       struct map_ent *mp, *map = NULL;
+                       mp = map_by_devnum(&map, fd2devnum(fd));
+                       if (mp && mp->path &&
+                           strncmp(mp->path, "/dev/md/", 8) == 0)
+                               printf("MD_DEVNAME=%s\n", mp->path+8);
                }
                goto out;
        }
@@ -216,7 +227,7 @@ int Detail(char *dev, int brief, int export, int test, char *homehost)
                struct mdstat_ent *ms = mdstat_read(0, 0);
                struct mdstat_ent *e;
                int devnum = array.md_minor;
-               if (major(stb.st_rdev) != MD_MAJOR)
+               if (major(stb.st_rdev) == get_mdp_major())
                        devnum = -1 - devnum;
 
                for (e=ms; e; e=e->next)