diff options
| author | Peter Wemm <peter@FreeBSD.org> | 2001-01-31 07:58:58 +0000 |
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 2001-01-31 07:58:58 +0000 |
| commit | 2b12097485448804f5315a84fccc19a39d7d896a (patch) | |
| tree | 9265f95b4e5e9a5d183b143ea48741ecdb0c7050 /sys/net/if_loop.c | |
| parent | 0adb9b96bd93545f2fbaf8e82556d6f7300045ea (diff) | |
Notes
Diffstat (limited to 'sys/net/if_loop.c')
| -rw-r--r-- | sys/net/if_loop.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/sys/net/if_loop.c b/sys/net/if_loop.c index 105b8dd1e95b..3c75a3455e33 100644 --- a/sys/net/if_loop.c +++ b/sys/net/if_loop.c @@ -48,6 +48,7 @@ #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/mbuf.h> +#include <sys/module.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/sysctl.h> @@ -89,9 +90,6 @@ int loioctl __P((struct ifnet *, u_long, caddr_t)); static void lortrequest __P((int, struct rtentry *, struct sockaddr *)); -static void loopattach __P((void *)); -PSEUDO_SET(loopattach, if_loop); - int looutput __P((struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct rtentry *rt)); @@ -174,19 +172,33 @@ sysctl_net_nloop(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_net, OID_AUTO, nloop, CTLTYPE_INT | CTLFLAG_RW, 0, 0, sysctl_net_nloop, "I", ""); -/* ARGSUSED */ -static void -loopattach(dummy) - void *dummy; -{ +static int +loop_modevent(module_t mod, int type, void *data) +{ int i; - TUNABLE_INT_FETCH("net.nloop", 1, nloop); - if (nloop < 1) /* sanity check */ - nloop = 1; - for (i = 0; i < nloop; i++) - locreate(i); -} + switch (type) { + case MOD_LOAD: + TUNABLE_INT_FETCH("net.nloop", 1, nloop); + if (nloop < 1) /* sanity check */ + nloop = 1; + for (i = 0; i < nloop; i++) + locreate(i); + break; + case MOD_UNLOAD: + printf("loop module unload - not possible for this module type\n"); + return EINVAL; + } + return 0; +} + +static moduledata_t loop_mod = { + "loop", + loop_modevent, + 0 +}; + +DECLARE_MODULE(loop, loop_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); int looutput(ifp, m, dst, rt) |
