summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-02-12 12:04:10 +0000
committerru <ru@FreeBSD.org>2005-02-12 12:04:10 +0000
commit7bd12fe3ee76ea39a086c73aca00b09e6f9c0ec5 (patch)
tree8ac9d72a0d143fef049a3a008e50287ce26b8672
parent3fbcda2e525db1b507832e69c86fa892de860d91 (diff)
downloadFreeBSD-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.
-rw-r--r--sys/dev/ar/if_ar.c22
-rw-r--r--sys/dev/sr/if_sr.c22
2 files changed, 2 insertions, 42 deletions
diff --git a/sys/dev/ar/if_ar.c b/sys/dev/ar/if_ar.c
index 70abc1d..14c4a79 100644
--- a/sys/dev/ar/if_ar.c
+++ b/sys/dev/ar/if_ar.c
@@ -182,8 +182,6 @@ static int irqtable[16] = {
#ifndef NETGRAPH
MODULE_DEPEND(if_ar, sppp, 1, 1, 1);
-#else
-MODULE_DEPEND(ng_sync_ar, netgraph, 1, 1, 1);
#endif
static void arintr(void *arg);
@@ -215,7 +213,6 @@ static void ar_timer_intr(struct ar_hardc *hc, int scano, u_char isr);
#ifdef NETGRAPH
static void ngar_watchdog_frame(void * arg);
-static void ngar_init(void* ignored);
static ng_constructor_t ngar_constructor;
static ng_rcvmsg_t ngar_rcvmsg;
@@ -237,8 +234,7 @@ static struct ng_type typestruct = {
.rcvdata = ngar_rcvdata,
.disconnect = ngar_disconnect,
};
-
-static int ngar_done_init = 0;
+NETGRAPH_INIT(sync_ar, &typestruct);
#endif /* NETGRAPH */
int
@@ -321,10 +317,6 @@ ar_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 (ngar_done_init == 0) ngar_init(NULL);
if (ng_make_node_common(&typestruct, &sc->node) != 0)
return (1);
sprintf(sc->nodename, "%s%d", NG_AR_NODE_TYPE, sc->unit);
@@ -2344,18 +2336,6 @@ ngar_disconnect(hook_p hook)
}
return (0);
}
-
-/*
- * called during bootup
- * or LKM loading to put this type into the list of known modules
- */
-static void
-ngar_init(void *ignored)
-{
- if (ng_newtype(&typestruct))
- printf("ngar install failed\n");
- ngar_done_init = 1;
-}
#endif /* NETGRAPH */
/*
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 */
/*
OpenPOWER on IntegriCloud