From: Dan Williams Date: Mon, 8 Dec 2008 23:59:18 +0000 (-0700) Subject: introduce --detail-platform to display platform raid capabilities X-Git-Tag: mdadm-3.0-devel3~56^2~7 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=4cce4069597491f5714fd81605f212ad2da62e06 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 --- diff --git a/Detail.c b/Detail.c index 5ff8cd13..0d6bcf5e 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; +} diff --git a/ReadMe.c b/ReadMe.c index 13f52202..ea4d2913 100644 --- 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 539d499f..b474bc1c 100644 --- 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 4101c5b6..a0d6097e 100644 --- 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 05b79baf..eef9dee5 100644 --- 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); diff --git a/super-ddf.c b/super-ddf.c index 3c97bb67..51f97d3b 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -3426,4 +3426,5 @@ struct superswitch super_ddf = { .prepare_update = ddf_prepare_update, .activate_spare = ddf_activate_spare, #endif + .name = "ddf", }; diff --git a/super-intel.c b/super-intel.c index abc32063..d690cf2b 100644 --- a/super-intel.c +++ b/super-intel.c @@ -3808,6 +3808,7 @@ struct superswitch super_imsm = { .container_content = container_content_imsm, .external = 1, + .name = "imsm", #ifndef MDASSEMBLE /* for mdmon */ diff --git a/super0.c b/super0.c index ab4232b0..bd681f44 100644 --- 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", }; diff --git a/super1.c b/super1.c index 9446948a..f2097753 100644 --- a/super1.c +++ b/super1.c @@ -1574,4 +1574,5 @@ struct superswitch super1 = { #else .swapuuid = 1, #endif + .name = "1.0", };