]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Detail.c
Add a 'super-switch' so that different format superblocks can be used.
[thirdparty/mdadm.git] / Detail.c
index 59b091fe149119821288572c32fd6906a5904c7a..2f3fc7ff38827fbd74a15988d4d25b50b0adcd97 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -50,6 +50,7 @@ int Detail(char *dev, int brief, int test)
        int is_26 = get_linux_version() >= 2006000;
        int is_rebuilding = 0;
        int failed = 0;
+       struct superswitch *ss = NULL;
 
        void *super = NULL;
        int rv = test ? 4 : 1;
@@ -82,6 +83,8 @@ int Detail(char *dev, int brief, int test)
                close(fd);
                return rv;
        }
+       ss = super_by_version(array.major_version);
+
        if (fstat(fd, &stb) != 0 && !S_ISBLK(stb.st_mode))
                stb.st_rdev = 0;
        rv = 0;
@@ -103,10 +106,10 @@ int Detail(char *dev, int brief, int test)
                                 * to get more info
                                 */
                                int fd2 = open(dv, O_RDONLY);
-                               if (fd2 >=0 &&
-                                   load_super0(fd2, &super, NULL) == 0) {
+                               if (fd2 >=0 && ss &&
+                                   ss->load_super(fd2, &super, NULL) == 0) {
                                        struct mdinfo info;
-                                       getinfo_super0(&info, super);
+                                       ss->getinfo_super(&info, super);
                                        if (info.array.ctime != array.ctime ||
                                            info.array.level != array.level) {
                                                free(super);
@@ -202,8 +205,8 @@ int Detail(char *dev, int brief, int test)
                }
                free_mdstat(ms);
 
-               if (super)
-                       detail_super0(super);
+               if (super && ss)
+                       ss->detail_super(super);
 
                printf("    Number   Major   Minor   RaidDevice State\n");
        }
@@ -275,8 +278,8 @@ int Detail(char *dev, int brief, int test)
                if (!brief) printf("\n");
        }
        if (spares && brief) printf(" spares=%d", spares);
-       if (super && brief)
-               brief_detail_super0(super);
+       if (super && brief && ss)
+               ss->brief_detail_super(super);
 
        if (brief && devices) printf("\n   devices=%s", devices);
        if (brief) printf("\n");