summaryrefslogtreecommitdiffstats
path: root/usr.sbin/moused/moused.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2006-02-18 11:26:36 +0000
committerdes <des@FreeBSD.org>2006-02-18 11:26:36 +0000
commit2c7a1f6f05e5d1fb55546688f2aaab48ecfd5cdc (patch)
tree4032e0738a3e7e87b522d0a0246324fd622506c9 /usr.sbin/moused/moused.c
parent748c235cfd99c801088fb73c735a91b031cac89b (diff)
downloadFreeBSD-src-2c7a1f6f05e5d1fb55546688f2aaab48ecfd5cdc.zip
FreeBSD-src-2c7a1f6f05e5d1fb55546688f2aaab48ecfd5cdc.tar.gz
Replace the guts of usbmodule() with calls to the new kld(3) functions.
Diffstat (limited to 'usr.sbin/moused/moused.c')
-rw-r--r--usr.sbin/moused/moused.c35
1 files changed, 1 insertions, 34 deletions
diff --git a/usr.sbin/moused/moused.c b/usr.sbin/moused/moused.c
index 0ab9939..e1be3b2 100644
--- a/usr.sbin/moused/moused.c
+++ b/usr.sbin/moused/moused.c
@@ -49,8 +49,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/consio.h>
-#include <sys/linker.h>
-#include <sys/module.h>
#include <sys/mouse.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -901,38 +899,7 @@ main(int argc, char *argv[])
static int
usbmodule(void)
{
- struct kld_file_stat fstat;
- struct module_stat mstat;
- int fileid, modid;
- int loaded;
-
- for (loaded = 0, fileid = kldnext(0); !loaded && fileid > 0;
- fileid = kldnext(fileid)) {
- fstat.version = sizeof(fstat);
- if (kldstat(fileid, &fstat) < 0)
- continue;
- if (strncmp(fstat.name, "uhub/ums", 8) == 0) {
- loaded = 1;
- break;
- }
- for (modid = kldfirstmod(fileid); modid > 0;
- modid = modfnext(modid)) {
- mstat.version = sizeof(mstat);
- if (modstat(modid, &mstat) < 0)
- continue;
- if (strncmp(mstat.name, "uhub/ums", 8) == 0) {
- loaded = 1;
- break;
- }
- }
- }
- if (!loaded) {
- if (kldload("ums") != -1)
- return 1;
- if (errno != EEXIST)
- logerr(1, "unable to load USB mouse driver");
- }
- return 0;
+ return (kld_isloaded("uhub/ums") || kld_load("ums") != -1);
}
static void
OpenPOWER on IntegriCloud