summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sbin/mdconfig/mdconfig.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 2064adf..6ff7701 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -29,7 +29,6 @@
#include <sys/stat.h>
int list(const int);
-void mdmaybeload(void);
int query(const int, const int);
void usage(void);
@@ -224,7 +223,9 @@ main(int argc, char **argv)
}
mdio.md_version = MDIOVERSION;
- mdmaybeload();
+ if (!kld_isloaded("g_md") && kld_load("geom_md") == -1)
+ err(1, "failed to load geom_md module");
+
fd = open("/dev/" MDCTL_NAME, O_RDWR, 0);
if (fd < 0)
err(1, "open(/dev/%s)", MDCTL_NAME);
@@ -340,21 +341,3 @@ query(const int fd, const int unit)
return (0);
}
-
-void
-mdmaybeload(void)
-{
- char name1[64], name2[64];
-
- snprintf(name1, sizeof(name1), "g_%s", MD_NAME);
- snprintf(name2, sizeof(name2), "geom_%s", MD_NAME);
- if (modfind(name1) == -1) {
- /* Not present in kernel, try loading it. */
- if (kldload(name2) == -1 || modfind(name1) == -1) {
- if (errno != EEXIST) {
- errx(EXIT_FAILURE,
- "%s module not available!", name2);
- }
- }
- }
-}
OpenPOWER on IntegriCloud