]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
introduce --detail-platform to display platform raid capabilities
authorDan Williams <dan.j.williams@intel.com>
Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)
committerDan Williams <dan.j.williams@intel.com>
Mon, 8 Dec 2008 23:59:18 +0000 (16:59 -0700)
Metadata formats like imsm work in concert with platform firmware and
hardware, so provide a way for mdadm to display this info to the user.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Detail.c
ReadMe.c
mdadm.8
mdadm.c
mdadm.h
super-ddf.c
super-intel.c
super0.c
super1.c

index 5ff8cd138fd759d6ae2e1ecd1b180d7a7eab1404..0d6bcf5ee7909ce1d1fb31e165076b7553c3c19c 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -530,3 +530,44 @@ out:
        close(fd);
        return rv;
 }
+
+int Detail_Platform(struct superswitch *ss, int scan, int verbose)
+{
+       /* display platform capabilities for the given metadata format
+        * 'scan' in this context means iterate over all metadata types
+        */
+       int i;
+       int err = 1;
+
+       if (ss && ss->detail_platform)
+               err = ss->detail_platform(verbose);
+       else if (ss) {
+               if (verbose)
+                       fprintf(stderr, Name ": %s metadata is platform independent\n",
+                               ss->name ? : "[no name]");
+       } else if (!scan) {
+               if (verbose)
+                       fprintf(stderr, Name ": specify a metadata type or --scan\n");
+       }
+
+       if (!scan)
+               return err;
+
+       for (i = 0; superlist[i]; i++) {
+               struct superswitch *meta = superlist[i];
+
+               if (meta == ss)
+                       continue;
+               if (verbose)
+                       fprintf(stderr, Name ": checking metadata %s\n",
+                               meta->name ? : "[no name]");
+               if (!meta->detail_platform) {
+                       if (verbose)
+                               fprintf(stderr, Name ": %s metadata is platform independent\n",
+                                       meta->name ? : "[no name]");
+               } else
+                       err |= meta->detail_platform(verbose);
+       }
+
+       return err;
+}
index 13f522025f05a7d6772816afa3a2db968f9f4c75..ea4d29134dcc44812d75ae799b86b65166bc75a7 100644 (file)
--- a/ReadMe.c
+++ b/ReadMe.c
@@ -107,6 +107,7 @@ struct option long_options[] = {
     {"query",    0, 0, 'Q'},
     {"examine-bitmap", 0, 0, 'X'},
     {"auto-detect", 0, 0, AutoDetect},
+    {"detail-platform", 0, 0, DetailPlatform},
 
     /* synonyms */
     {"monitor",   0, 0, 'F'},
@@ -466,6 +467,7 @@ char Help_misc[] =
 "  --query       -Q   : Display general information about how a\n"
 "                       device relates to the md driver\n"
 "  --detail      -D   : Display details of an array\n"
+"  --detail-platform  : Display hardware/firmware details\n"
 "  --examine     -E   : Examine superblock on an array component\n"
 "  --examine-bitmap -X: Display contents of a bitmap file\n"
 "  --zero-superblock  : erase the MD superblock from a device.\n"
diff --git a/mdadm.8 b/mdadm.8
index 539d499f467f1cc5ac02dadd11b5c3de175377ed..b474bc1c890f69f58dba87e425d45af923dd2afa 100644 (file)
--- a/mdadm.8
+++ b/mdadm.8
@@ -51,7 +51,7 @@ each device is a path to one common physical storage device.
 is also not true RAID, and it only involves one device.  It
 provides a layer over a true device that can be used to inject faults.
 
-B CONTAINER
+.B CONTAINER
 is different again.  A
 .B CONTAINER
 is a collection of devices that are
@@ -364,9 +364,13 @@ creating a DDF array a
 .B CONTAINER
 will be created, and normal arrays can be created in that container.
 .IP imsm
-Use the Intel Matrix Storage Manager metadata format.  This creates a
+Use the Intel(R) Matrix Storage Manager metadata format.  This creates a
 .B CONTAINER
-which is managed in a similar manner to DDF.
+which is managed in a similar manner to DDF, and is supported by an
+option-rom on some platforms:
+.IP
+.B http://www.intel.com/design/chipsets/matrixstorage_sb.htm
+.PP
 .RE
 
 .TP
@@ -1008,6 +1012,11 @@ Information about what is discovered is presented.
 .BR \-D ", " \-\-detail
 Print detail of one or more md devices.
 
+.TP
+.BR \-\-detail\-platform
+Print detail of the platform's raid capabilities (firmware / hardware
+topology) for a given metadata format.
+
 .TP
 .BR \-Y ", " \-\-export
 When used with
@@ -1561,6 +1570,26 @@ The array has multiple failed devices such that it is unusable.
 There was an error while trying to get information about the device.
 .RE
 
+.TP
+.B \-\-detail\-platform
+Print detail of the platform's raid capabilities (firmware / hardware
+topology).  If the metadata is specified with
+.B \-e
+or
+.B \-\-metadata=
+then the return status will be:
+.RS
+.TP
+0
+metadata successfully enumerated its platform components on this system
+.TP
+1
+metadata is platform independent
+.TP
+2
+metadata failed to find its platform components on this system
+.RE
+
 .TP
 .B \-\-examine
 The device should be a component of an md array.
diff --git a/mdadm.c b/mdadm.c
index 4101c5b68de74528d6ca972ecce93a9b7ee9de02..a0d6097e7fbb8b3d5e08a84a9d2e47ca802f0aaf 100644 (file)
--- a/mdadm.c
+++ b/mdadm.c
@@ -217,6 +217,7 @@ int main(int argc, char *argv[])
                case 'w':
                case 'W':
                case Waitclean:
+               case DetailPlatform:
                case 'K': if (!mode) newmode = MISC; break;
                }
                if (mode && newmode == mode) {
@@ -769,6 +770,7 @@ int main(int argc, char *argv[])
                case O(MISC,'w'):
                case O(MISC,'W'):
                case O(MISC, Waitclean):
+               case O(MISC, DetailPlatform):
                        if (devmode && devmode != opt &&
                            (devmode == 'E' || (opt == 'E' && devmode != 'Q'))) {
                                fprintf(stderr, Name ": --examine/-E cannot be given with -%c\n",
@@ -1211,6 +1213,8 @@ int main(int argc, char *argv[])
                        rv = Examine(devlist, scan?(verbose>1?0:verbose+1):brief,
                                     export, scan,
                                     SparcAdjust, ss, homehost);
+               } else if (devmode == DetailPlatform) {
+                       rv = Detail_Platform(ss ? ss->ss : NULL, ss ? scan : 1, verbose);
                } else {
                        if (devlist == NULL) {
                                if ((devmode=='D' || devmode == Waitclean) && scan) {
diff --git a/mdadm.h b/mdadm.h
index 05b79bafa9497843a59b308a3b227bd7a3f7ba1e..eef9dee54cb91cdd11884f58a89cb6b670e07387 100644 (file)
--- a/mdadm.h
+++ b/mdadm.h
@@ -225,6 +225,7 @@ enum special_options {
        Symlinks,
        AutoDetect,
        Waitclean,
+       DetailPlatform,
 };
 
 /* structures read from config file */
@@ -441,6 +442,9 @@ extern struct superswitch {
        void (*brief_detail_super)(struct supertype *st);
        void (*export_detail_super)(struct supertype *st);
 
+       /* Optional: platform hardware / firmware details */
+       int (*detail_platform)(int verbose);
+
        /* Used:
         *   to get uuid to storing in bitmap metadata
         *   and 'reshape' backup-data metadata
@@ -584,6 +588,7 @@ extern struct superswitch {
 
        int swapuuid; /* true if uuid is bigending rather than hostendian */
        int external;
+       const char *name; /* canonical metadata name */
 } super0, super1, super_ddf, *superlist[];
 
 extern struct superswitch super_imsm;
@@ -722,6 +727,7 @@ extern int Create(struct supertype *st, char *mddev,
                  char *bitmap_file, int bitmap_chunk, int write_behind, int delay, int autof);
 
 extern int Detail(char *dev, int brief, int export, int test, char *homehost);
+extern int Detail_Platform(struct superswitch *ss, int scan, int verbose);
 extern int Query(char *dev);
 extern int Examine(mddev_dev_t devlist, int brief, int export, int scan,
                   int SparcAdjust, struct supertype *forcest, char *homehost);
index 3c97bb678b70161ca34eebc5228b0d4e80677058..51f97d3b84ec6cecb38bfadc0e734221af8947fb 100644 (file)
@@ -3426,4 +3426,5 @@ struct superswitch super_ddf = {
        .prepare_update = ddf_prepare_update,
        .activate_spare = ddf_activate_spare,
 #endif
+       .name = "ddf",
 };
index abc320632b0dcc065e2374fc7b0f04b6cd2a424d..d690cf2be3a27281b375a97357589b7f908c95f6 100644 (file)
@@ -3808,6 +3808,7 @@ struct superswitch super_imsm = {
        .container_content = container_content_imsm,
 
        .external       = 1,
+       .name = "imsm",
 
 #ifndef MDASSEMBLE
 /* for mdmon */
index ab4232b0b5b34d10624e33060a28434e0f68db67..bd681f444915d760de6873a339292a8361d3f043 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -1110,4 +1110,5 @@ struct superswitch super0 = {
        .locate_bitmap = locate_bitmap0,
        .write_bitmap = write_bitmap0,
        .free_super = free_super0,
+       .name = "0.90",
 };
index 9446948ab3cde218f0e3b487a8db599aae03fd26..f209775351ae480255b6533a5e15742b5bdfac62 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1574,4 +1574,5 @@ struct superswitch super1 = {
 #else
        .swapuuid = 1,
 #endif
+       .name = "1.0",
 };