diff options
author | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2005-11-11 11:31:23 +0000 |
---|---|---|
committer | Pawel Jakub Dawidek <pjd@FreeBSD.org> | 2005-11-11 11:31:23 +0000 |
commit | d941425873c0c6c6b503a04941c09b2947b6674d (patch) | |
tree | adbb79f2bb84163c0101eba4499d186b0f814d5d /sbin/mdconfig/mdconfig.c | |
parent | d314617e8a83aafab325ef3aaf7694af5f6994c0 (diff) | |
download | src-d941425873c0c6c6b503a04941c09b2947b6674d.tar.gz src-d941425873c0c6c6b503a04941c09b2947b6674d.zip |
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
Notes
Notes:
svn path=/head/; revision=152309
Diffstat (limited to 'sbin/mdconfig/mdconfig.c')
-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 e3ca148d7fa9..03747aa13058 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); + } + } + } } - |