summaryrefslogtreecommitdiffstats
path: root/Detail.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2008-12-08 16:59:18 -0700
committerDan Williams <dan.j.williams@intel.com>2008-12-08 16:59:18 -0700
commit4cce4069597491f5714fd81605f212ad2da62e06 (patch)
treeda92c65cc25139409f3f23c7b0f5d1ec243dd754 /Detail.c
parent88c32bb1ec5d0c12eb557c4f46832fa4e1076784 (diff)
downloadmdadm-4cce4069597491f5714fd81605f212ad2da62e06.tar.gz
mdadm-4cce4069597491f5714fd81605f212ad2da62e06.tar.xz
mdadm-4cce4069597491f5714fd81605f212ad2da62e06.zip
introduce --detail-platform to display platform raid capabilities
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>
Diffstat (limited to 'Detail.c')
-rw-r--r--Detail.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/Detail.c b/Detail.c
index 5ff8cd1..0d6bcf5 100644
--- 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;
+}