diff options
author | pjd <pjd@FreeBSD.org> | 2005-11-11 11:31:23 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2005-11-11 11:31:23 +0000 |
commit | 679cff6ef7b052a28621079e0148a60ab7568357 (patch) | |
tree | adbb79f2bb84163c0101eba4499d186b0f814d5d /sbin/mdconfig | |
parent | 618c8789688d1bd81a105118d081c7e779f06a59 (diff) | |
download | FreeBSD-src-679cff6ef7b052a28621079e0148a60ab7568357.zip FreeBSD-src-679cff6ef7b052a28621079e0148a60ab7568357.tar.gz |
Rename GEOM class kernel module g_md.ko to geom_md.ko for consistency
with the rest.
mdconfig.c: Simplify mdmaybeload() function.
mdioctl.h: Removed (now unused) #define.
loader.conf: Sort GEOM classes properly.
OK'ed by: phk
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index e3ca148..03747aa 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -334,32 +334,17 @@ query(const int fd, const int unit) void mdmaybeload(void) { - struct module_stat mstat; - int fileid, modid; - const char *name; - char *cp; + char name1[64], name2[64]; - name = MD_MODNAME; - /* scan files in kernel */ - mstat.version = sizeof(struct module_stat); - for (fileid = kldnext(0); fileid > 0; fileid = kldnext(fileid)) { - /* scan modules in file */ - for (modid = kldfirstmod(fileid); modid > 0; - modid = modfnext(modid)) { - if (modstat(modid, &mstat) < 0) - continue; - /* strip bus name if present */ - if ((cp = strchr(mstat.name, '/')) != NULL) { - cp++; - } else { - cp = mstat.name; - } - /* already loaded? */ - if (!strcmp(name, cp)) - return; - } - } - /* not present, we should try to load it */ - kldload(name); + 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); + } + } + } } - |