aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdconfig/mdconfig.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2006-02-18 11:40:24 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2006-02-18 11:40:24 +0000
commita921cb31300e380def23ba9db9d924490cec7084 (patch)
treee20f64ce339bc94b4c99eb4deb4997843c0df8e1 /sbin/mdconfig/mdconfig.c
parentaa5cfd042036c4c96467e7d441763b905c3ea21d (diff)
downloadsrc-a921cb31300e380def23ba9db9d924490cec7084.tar.gz
src-a921cb31300e380def23ba9db9d924490cec7084.zip
Use kld(3) for loading geom_md.ko.
Notes
Notes: svn path=/head/; revision=155807
Diffstat (limited to 'sbin/mdconfig/mdconfig.c')
-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 2064adf50f74..6ff770150727 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);
- }
- }
- }
-}