diff options
author | pjd <pjd@FreeBSD.org> | 2006-02-18 11:40:24 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2006-02-18 11:40:24 +0000 |
commit | c4fa5b3bb16679551162e8ad341ca03f00caf10e (patch) | |
tree | e20f64ce339bc94b4c99eb4deb4997843c0df8e1 /sbin | |
parent | 8fe6e13e40a507758f4d01bb35d85353992d9a32 (diff) | |
download | FreeBSD-src-c4fa5b3bb16679551162e8ad341ca03f00caf10e.zip FreeBSD-src-c4fa5b3bb16679551162e8ad341ca03f00caf10e.tar.gz |
Use kld(3) for loading geom_md.ko.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 23 |
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); - } - } - } -} |