diff options
author | ru <ru@FreeBSD.org> | 2005-02-12 12:04:10 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-02-12 12:04:10 +0000 |
commit | 7bd12fe3ee76ea39a086c73aca00b09e6f9c0ec5 (patch) | |
tree | 8ac9d72a0d143fef049a3a008e50287ce26b8672 /sys/dev/sr/if_sr.c | |
parent | 3fbcda2e525db1b507832e69c86fa892de860d91 (diff) | |
download | FreeBSD-src-7bd12fe3ee76ea39a086c73aca00b09e6f9c0ec5.zip FreeBSD-src-7bd12fe3ee76ea39a086c73aca00b09e6f9c0ec5.tar.gz |
Two problems here:
1. Dependency on netgraph module was broken (wrong version).
2. Netgraph node type was never destroyed on unload. This
was masked by problem #1.
Fixed both by using NETGRAPH_INIT(). Now netgraph node type
is created on module load, as in the rest of netgraph modules.
Diffstat (limited to 'sys/dev/sr/if_sr.c')
-rw-r--r-- | sys/dev/sr/if_sr.c | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/sys/dev/sr/if_sr.c b/sys/dev/sr/if_sr.c index 033b339..088181a 100644 --- a/sys/dev/sr/if_sr.c +++ b/sys/dev/sr/if_sr.c @@ -223,8 +223,6 @@ int etc0vals[] = { devclass_t sr_devclass; #ifndef NETGRAPH MODULE_DEPEND(if_sr, sppp, 1, 1, 1); -#else -MODULE_DEPEND(ng_sync_sr, netgraph, 1, 1, 1); #endif static void srintr(void *arg); @@ -262,7 +260,6 @@ static void sr_modemck(struct sr_softc *x); #ifdef NETGRAPH static void ngsr_watchdog_frame(void * arg); -static void ngsr_init(void* ignored); static ng_constructor_t ngsr_constructor; static ng_rcvmsg_t ngsr_rcvmsg; @@ -284,8 +281,7 @@ static struct ng_type typestruct = { .rcvdata = ngsr_rcvdata, .disconnect = ngsr_disconnect, }; - -static int ngsr_done_init = 0; +NETGRAPH_INIT(sync_sr, &typestruct); #endif /* NETGRAPH */ /* @@ -432,10 +428,6 @@ sr_attach(device_t device) bpfattach(ifp, DLT_PPP, PPP_HEADER_LEN); #else /* NETGRAPH */ - /* - * we have found a node, make sure our 'type' is availabe. - */ - if (ngsr_done_init == 0) ngsr_init(NULL); if (ng_make_node_common(&typestruct, &sc->node) != 0) goto errexit; sprintf(sc->nodename, "%s%d", NG_SR_NODE_TYPE, sc->unit); @@ -2944,18 +2936,6 @@ ngsr_disconnect(hook_p hook) } return (0); } - -/* - * called during bootup - * or LKM loading to put this type into the list of known modules - */ -static void -ngsr_init(void *ignored) -{ - if (ng_newtype(&typestruct)) - printf("ngsr install failed\n"); - ngsr_done_init = 1; -} #endif /* NETGRAPH */ /* |