From: Dan Williams Date: Tue, 20 Jan 2009 08:36:51 +0000 (-0700) Subject: Create: warn when a metadata format's platform components are missing X-Git-Tag: mdadm-3.0-devel3~43 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fmdadm.git;a=commitdiff_plain;h=5615172f1d9daba1d5927758322f7addda803159 Create: warn when a metadata format's platform components are missing If the metadata handler can not find its platform support components then there is no way for it to verify that the raid configuration will be supported by the option-rom. Provide a generic method for metadata handlers to warn the user that the array they are about to create may not work as intended with a given platform. Signed-off-by: Dan Williams --- diff --git a/Create.c b/Create.c index a7275d3d..f63afa83 100644 --- a/Create.c +++ b/Create.c @@ -404,6 +404,14 @@ int Create(struct supertype *st, char *mddev, warn = 1; } + if (st->ss->detail_platform && st->ss->detail_platform(0, 1) != 0) { + if (runstop != 1 || verbose >= 0) + fprintf(stderr, Name ": %s unable to enumerate platform support\n" + " array may not be compatible with hardware/firmware\n", + st->ss->name); + warn = 1; + } + if (warn) { if (runstop!= 1) { if (!ask("Continue creating array? ")) { diff --git a/Detail.c b/Detail.c index 0d6bcf5e..9be9cfd8 100644 --- a/Detail.c +++ b/Detail.c @@ -540,7 +540,7 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose) int err = 1; if (ss && ss->detail_platform) - err = ss->detail_platform(verbose); + err = ss->detail_platform(verbose, 0); else if (ss) { if (verbose) fprintf(stderr, Name ": %s metadata is platform independent\n", @@ -566,7 +566,7 @@ int Detail_Platform(struct superswitch *ss, int scan, int verbose) fprintf(stderr, Name ": %s metadata is platform independent\n", meta->name ? : "[no name]"); } else - err |= meta->detail_platform(verbose); + err |= meta->detail_platform(verbose, 0); } return err; diff --git a/mdadm.h b/mdadm.h index 3ee27907..7c8c2f12 100644 --- a/mdadm.h +++ b/mdadm.h @@ -443,7 +443,7 @@ extern struct superswitch { void (*export_detail_super)(struct supertype *st); /* Optional: platform hardware / firmware details */ - int (*detail_platform)(int verbose); + int (*detail_platform)(int verbose, int enumerate_only); /* Used: * to get uuid to storing in bitmap metadata diff --git a/super-intel.c b/super-intel.c index 9f8cea63..0a7c34a2 100644 --- a/super-intel.c +++ b/super-intel.c @@ -916,7 +916,7 @@ static int imsm_enumerate_ports(const char *hba_path, int port_count, int host_b return err; } -static int detail_platform_imsm(int verbose) +static int detail_platform_imsm(int verbose, int enumerate_only) { /* There are two components to imsm platform support, the ahci SATA * controller and the option-rom. To find the SATA controller we @@ -937,6 +937,12 @@ static int detail_platform_imsm(int verbose) int host_base = 0; int port_count = 0; + if (enumerate_only) { + if (check_env("IMSM_NO_PLATFORM") || find_imsm_orom()) + return 0; + return 2; + } + list = find_driver_devices("pci", "ahci"); for (hba = list; hba; hba = hba->next) if (devpath_to_vendor(hba->path) == 0x8086)