mechanical i4b cleanups
Brooks Davis
brooks at one-eyed-alien.net
Sat Feb 26 00:46:13 GMT 2005
Below are some fairly mechanical patches I did 6-9 months ago to drag
some of i4b's drivers in the direction of a modern implementation. I
don't have the ability to test them and I don't have time to work on
them. Perhaps someone here does.
The patches are also at:
http://people.freebsd.org/~brooks/patches/i4b.diff
-- Brooks
diff -ru freebsd/sys/i4b/capi/iavc/iavc_isa.c cleanup/sys/i4b/capi/iavc/iavc_isa.c
--- freebsd/sys/i4b/capi/iavc/iavc_isa.c Sat Jan 8 10:40:04 2005
+++ cleanup/sys/i4b/capi/iavc/iavc_isa.c Sat Jan 8 21:41:51 2005
@@ -28,6 +28,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
diff -ru freebsd/sys/i4b/capi/iavc/iavc_pci.c cleanup/sys/i4b/capi/iavc/iavc_pci.c
--- freebsd/sys/i4b/capi/iavc/iavc_pci.c Sat Jan 8 10:40:04 2005
+++ cleanup/sys/i4b/capi/iavc/iavc_pci.c Sat Jan 8 21:41:51 2005
@@ -32,6 +32,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
diff -ru freebsd/sys/i4b/driver/i4b_ctl.c cleanup/sys/i4b/driver/i4b_ctl.c
--- freebsd/sys/i4b/driver/i4b_ctl.c Sat Jan 8 10:40:05 2005
+++ cleanup/sys/i4b/driver/i4b_ctl.c Sat Jan 8 21:41:52 2005
@@ -37,6 +37,7 @@
#include <sys/param.h>
#include <sys/ioccom.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/socket.h>
@@ -69,7 +70,28 @@
};
static void i4bctlattach(void *);
-PSEUDO_SET(i4bctlattach, i4b_i4bctldrv);
+
+static int i4bctl_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4bctlattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4bctl module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4bctl_mod = {
+ "i4bctl",
+ i4bctl_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4bctl, i4bctl_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
/*---------------------------------------------------------------------------*
* interface attach routine
diff -ru freebsd/sys/i4b/driver/i4b_ing.c cleanup/sys/i4b/driver/i4b_ing.c
--- freebsd/sys/i4b/driver/i4b_ing.c Sat Jan 8 10:40:05 2005
+++ cleanup/sys/i4b/driver/i4b_ing.c Sat Jan 8 21:41:52 2005
@@ -38,8 +38,10 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
+#include <sys/module.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/malloc.h>
@@ -65,9 +67,6 @@
/* initialized by L4 */
-static drvr_link_t ing_drvr_linktab[NI4BING];
-static isdn_link_t *isdn_linktab[NI4BING];
-
struct ing_softc {
int sc_unit; /* unit number */
int sc_state; /* state of the interface */
@@ -103,7 +102,9 @@
u_int packets_out; /* packets out towards downstream */
u_int32_t flags;
-} ing_softc[NI4BING];
+ drvr_link_t ing_drvr_linktab;
+ isdn_link_t *isdn_linktab;
+};
enum ing_states {
ST_IDLE, /* initialized, ready, idle */
@@ -111,11 +112,37 @@
ST_CONNECTED /* connected to remote */
};
-static void i4bingattach(void *);
+static struct ing_softc *ing_softc;
+
+static drvr_link_t *ing_ret_linktab(int unit);
+static void ing_set_linktab(int unit, isdn_link_t *ilt);
+
+static void i4bingattach(void);
+
+static int i4bing_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4bingattach();
+ break;
+ case MOD_UNLOAD:
+ printf("i4bing module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4bing_mod = {
+ "i4bing",
+ i4bing_modevent,
+ NULL
+};
-PSEUDO_SET(i4bingattach, i4b_ing);
+DECLARE_MODULE(i4bing, i4bing_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
-static void ing_init_linktab(int unit);
+static void ing_init_softc(int unit, struct ing_softc *sc);
+static void ing_init_linktab(int unit, drvr_link_t *lt);
static void ing_tx_queue_empty(int unit);
/* ========= NETGRAPH ============= */
@@ -219,19 +246,31 @@
* interface attach routine at kernel boot time
*---------------------------------------------------------------------------*/
static void
-i4bingattach(void *dummy)
+i4bingattach(void)
{
- struct ing_softc *sc = ing_softc;
+ struct ing_softc *sc;
int i;
- int ret;
+ int n_ing = NI4BING;
- printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n", NI4BING);
+ sc = ing_softc = malloc(sizeof(struct ing_softc) * n_ing,
+ M_I4B, M_WAITOK);
+
+ printf("i4bing: %d i4b NetGraph ISDN B-channel device(s) attached\n",
+ n_ing);
- for(i=0; i < NI4BING; sc++, i++)
- {
- sc->sc_unit = i;
+ for(i=0; i < n_ing; sc++, i++)
+ ing_init_softc(i, sc);
+
+ ing_ret_linktab_p = ing_ret_linktab;
+ ing_set_linktab_p = ing_set_linktab;
+}
+
+static void
+ing_init_softc(int unit, struct ing_softc *sc)
+{
+ int ret;
- ing_init_linktab(i);
+ ing_init_linktab(unit, &sc->ing_drvr_linktab);
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
@@ -259,7 +298,7 @@
sc->sc_dialresp = DSTAT_NONE; /* no response */
sc->sc_lastdialresp = DSTAT_NONE;
-
+
/* setup a netgraph node */
if ((ret = ng_make_node_common(&typestruct, &sc->node)))
@@ -274,7 +313,7 @@
{
printf("ing: ng_name node, ret = %d\n!", ret);
NG_NODE_UNREF(sc->node);
- break;
+ return;
}
NG_NODE_SET_PRIVATE(sc->node, sc);
@@ -285,7 +324,6 @@
mtx_init(&sc->xmitq.ifq_mtx, "i4b_ing_xmitq", NULL, MTX_DEF);
if(!mtx_initialized(&sc->xmitq_hipri.ifq_mtx))
mtx_init(&sc->xmitq_hipri.ifq_mtx, "i4b_ing_hipri", NULL, MTX_DEF);
- }
}
#ifdef I4BINGACCT
@@ -300,8 +338,9 @@
/* get # of bytes in and out from the HSCX driver */
- (*isdn_linktab[unit]->bch_stat)
- (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+ (ing_softc[unit].isdn_linktab->bch_stat)
+ (ing_softc[unit].isdn_linktab->unit,
+ ing_softc[unit].isdn_linktab->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
@@ -460,7 +499,7 @@
register struct mbuf *m;
int error;
- if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
+ if((m = *ing_softc[unit].isdn_linktab->rx_mbuf) == NULL)
return;
#if I4BINGACCT
@@ -506,14 +545,16 @@
x = 1;
- if(! IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL))
+ if(! IF_HANDOFF(ing_softc[unit].isdn_linktab->tx_queue, m, NULL))
{
NDBGL4(L4_INGDBG, "ing%d: tx queue full!", unit);
}
}
if(x)
- (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
+ (*ing_softc[unit].isdn_linktab->bch_tx_start)(
+ ing_softc[unit].isdn_linktab->unit,
+ ing_softc[unit].isdn_linktab->channel);
}
/*---------------------------------------------------------------------------*
@@ -530,35 +571,35 @@
/*---------------------------------------------------------------------------*
* return this drivers linktab address
*---------------------------------------------------------------------------*/
-drvr_link_t *
+static drvr_link_t *
ing_ret_linktab(int unit)
{
- return(&ing_drvr_linktab[unit]);
+ return(&ing_softc[unit].ing_drvr_linktab);
}
/*---------------------------------------------------------------------------*
* setup the isdn_linktab for this driver
*---------------------------------------------------------------------------*/
-void
+static void
ing_set_linktab(int unit, isdn_link_t *ilt)
{
- isdn_linktab[unit] = ilt;
+ ing_softc[unit].isdn_linktab = ilt;
}
/*---------------------------------------------------------------------------*
* initialize this drivers linktab
*---------------------------------------------------------------------------*/
static void
-ing_init_linktab(int unit)
+ing_init_linktab(int unit, drvr_link_t *lt)
{
- ing_drvr_linktab[unit].unit = unit;
- ing_drvr_linktab[unit].bch_rx_data_ready = ing_rx_data_rdy;
- ing_drvr_linktab[unit].bch_tx_queue_empty = ing_tx_queue_empty;
- ing_drvr_linktab[unit].bch_activity = ing_activity;
- ing_drvr_linktab[unit].line_connected = ing_connect;
- ing_drvr_linktab[unit].line_disconnected = ing_disconnect;
- ing_drvr_linktab[unit].dial_response = ing_dialresponse;
- ing_drvr_linktab[unit].updown_ind = ing_updown;
+ lt->unit = unit;
+ lt->bch_rx_data_ready = ing_rx_data_rdy;
+ lt->bch_tx_queue_empty = ing_tx_queue_empty;
+ lt->bch_activity = ing_activity;
+ lt->line_connected = ing_connect;
+ lt->line_disconnected = ing_disconnect;
+ lt->dial_response = ing_dialresponse;
+ lt->updown_ind = ing_updown;
}
/*===========================================================================*
diff -ru freebsd/sys/i4b/driver/i4b_ipr.c cleanup/sys/i4b/driver/i4b_ipr.c
--- freebsd/sys/i4b/driver/i4b_ipr.c Sat Jan 8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_ipr.c Sat Jan 8 21:41:52 2005
@@ -61,12 +61,14 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/bus.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <sys/ioccom.h>
#include <sys/sockio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <net/if.h>
#include <net/if_types.h>
#include <net/netisr.h>
@@ -120,9 +122,6 @@
/* initialized by L4 */
-static drvr_link_t ipr_drvr_linktab[NI4BIPR];
-static isdn_link_t *isdn_linktab[NI4BIPR];
-
struct ipr_softc {
struct ifnet sc_if; /* network-visible interface */
int sc_state; /* state of the interface */
@@ -158,7 +157,10 @@
#endif
#endif
-} ipr_softc[NI4BIPR];
+ drvr_link_t ipr_drvr_linktab;
+ isdn_link_t *isdn_linktab;
+};
+static struct ipr_softc *ipr_softc;
enum ipr_states {
ST_IDLE, /* initialized, ready, idle */
@@ -168,7 +170,8 @@
};
static void i4biprattach(void *);
-PSEUDO_SET(i4biprattach, i4b_ipr);
+drvr_link_t * ipr_ret_linktab(int unit);
+void ipr_set_linktab(int unit, isdn_link_t *ilt);
static int i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
static void iprwatchdog(struct ifnet *ifp);
@@ -181,22 +184,47 @@
* DEVICE DRIVER ROUTINES
*===========================================================================*/
+static int i4bipr_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4biprattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4bipr module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4bipr_mod = {
+ "i4bipr",
+ i4bipr_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4bipr, i4bipr_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
/*---------------------------------------------------------------------------*
* interface attach routine at kernel boot time
*---------------------------------------------------------------------------*/
static void
i4biprattach(void *dummy)
{
- struct ipr_softc *sc = ipr_softc;
+ struct ipr_softc *sc;
int i;
+ int n_ipr = NI4BIPR;
+
+ sc = ipr_softc = malloc(sizeof(struct ipr_softc), M_I4B, M_WAITOK);
#ifdef IPR_VJ
- printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached (VJ header compression)\n", NI4BIPR);
+ printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached (VJ header compression)\n", n_ipr);
#else
- printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", NI4BIPR);
+ printf("i4bipr: %d IP over raw HDLC ISDN device(s) attached\n", n_ipr);
#endif
- for(i=0; i < NI4BIPR; sc++, i++)
+ for(i=0; i < n_ipr; sc++, i++)
{
ipr_init_linktab(i);
@@ -271,6 +299,9 @@
bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
}
+
+ ipr_ret_linktab_p = ipr_ret_linktab;
+ ipr_set_linktab_p = ipr_set_linktab;
}
/*---------------------------------------------------------------------------*
@@ -521,8 +552,9 @@
/* get # of bytes in and out from the HSCX driver */
- (*isdn_linktab[unit]->bch_stat)
- (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+ (*ipr_softc[unit].isdn_linktab->bch_stat)(
+ ipr_softc[unit].isdn_linktab->unit,
+ ipr_softc[unit].isdn_linktab->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
@@ -729,7 +761,7 @@
int len, c;
#endif
- if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
+ if((m = *ipr_softc[unit].isdn_linktab->rx_mbuf) == NULL)
return;
m->m_pkthdr.rcvif = &sc->sc_if;
@@ -952,8 +984,8 @@
#endif
x = 1;
- IF_LOCK(isdn_linktab[unit]->tx_queue);
- if(_IF_QFULL(isdn_linktab[unit]->tx_queue))
+ IF_LOCK(ipr_softc[unit].isdn_linktab->tx_queue);
+ if(_IF_QFULL(ipr_softc[unit].isdn_linktab->tx_queue))
{
NDBGL4(L4_IPRDBG, "ipr%d: tx queue full!", unit);
m_freem(m);
@@ -964,14 +996,16 @@
sc->sc_if.if_opackets++;
- _IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
+ _IF_ENQUEUE(ipr_softc[unit].isdn_linktab->tx_queue, m);
}
- IF_UNLOCK(isdn_linktab[unit]->tx_queue);
+ IF_UNLOCK(ipr_softc[unit].isdn_linktab->tx_queue);
}
if(x)
- (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
+ (*ipr_softc[unit].isdn_linktab->bch_tx_start)(
+ ipr_softc[unit].isdn_linktab->unit,
+ ipr_softc[unit].isdn_linktab->channel);
}
/*---------------------------------------------------------------------------*
@@ -991,7 +1025,7 @@
drvr_link_t *
ipr_ret_linktab(int unit)
{
- return(&ipr_drvr_linktab[unit]);
+ return(&ipr_softc[unit].ipr_drvr_linktab);
}
/*---------------------------------------------------------------------------*
@@ -1000,7 +1034,7 @@
void
ipr_set_linktab(int unit, isdn_link_t *ilt)
{
- isdn_linktab[unit] = ilt;
+ ipr_softc[unit].isdn_linktab = ilt;
}
/*---------------------------------------------------------------------------*
@@ -1009,14 +1043,14 @@
static void
ipr_init_linktab(int unit)
{
- ipr_drvr_linktab[unit].unit = unit;
- ipr_drvr_linktab[unit].bch_rx_data_ready = ipr_rx_data_rdy;
- ipr_drvr_linktab[unit].bch_tx_queue_empty = ipr_tx_queue_empty;
- ipr_drvr_linktab[unit].bch_activity = ipr_activity;
- ipr_drvr_linktab[unit].line_connected = ipr_connect;
- ipr_drvr_linktab[unit].line_disconnected = ipr_disconnect;
- ipr_drvr_linktab[unit].dial_response = ipr_dialresponse;
- ipr_drvr_linktab[unit].updown_ind = ipr_updown;
+ ipr_softc[unit].ipr_drvr_linktab.unit = unit;
+ ipr_softc[unit].ipr_drvr_linktab.bch_rx_data_ready = ipr_rx_data_rdy;
+ ipr_softc[unit].ipr_drvr_linktab.bch_tx_queue_empty = ipr_tx_queue_empty;
+ ipr_softc[unit].ipr_drvr_linktab.bch_activity = ipr_activity;
+ ipr_softc[unit].ipr_drvr_linktab.line_connected = ipr_connect;
+ ipr_softc[unit].ipr_drvr_linktab.line_disconnected = ipr_disconnect;
+ ipr_softc[unit].ipr_drvr_linktab.dial_response = ipr_dialresponse;
+ ipr_softc[unit].ipr_drvr_linktab.updown_ind = ipr_updown;
}
/*===========================================================================*/
diff -ru freebsd/sys/i4b/driver/i4b_isppp.c cleanup/sys/i4b/driver/i4b_isppp.c
--- freebsd/sys/i4b/driver/i4b_isppp.c Sat Jan 8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_isppp.c Sat Jan 8 21:41:52 2005
@@ -52,6 +52,7 @@
#include <sys/ioccom.h>
#include <sys/sockio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <net/if.h>
#include <net/if_types.h>
@@ -72,7 +73,6 @@
#define ISPPP_FMT "isp%d: "
#define ISPPP_ARG(sc) ((sc)->sc_if.if_dunit)
-#define PDEVSTATIC static
#define IFP2UNIT(ifp) (ifp)->if_dunit
# define CALLOUT_INIT(chan) callout_handle_init(chan)
@@ -80,8 +80,7 @@
# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg, chan)
# define IOCTL_CMD_T u_long
-PDEVSTATIC void i4bispppattach(void *);
-PSEUDO_SET(i4bispppattach, i4b_isppp);
+static void i4bispppattach(void *);
#define I4BISPPPACCT 1 /* enable accounting messages */
#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */
@@ -119,6 +118,10 @@
struct callout_handle sc_ch;
} i4bisppp_softc[NI4BISPPP];
+extern time_t (*i4bisppp_idletime_p)(int);
+
+static drvr_link_t *i4bisppp_ret_linktab(int unit);
+static void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
static void i4bisppp_init_linktab(int unit);
static int i4bisppp_ioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data);
@@ -154,10 +157,35 @@
* DEVICE DRIVER ROUTINES
*===========================================================================*/
+static int i4bisppp_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4bisppp_ret_linktab_p = i4bisppp_ret_linktab;
+ i4bisppp_set_linktab_p = i4bisppp_set_linktab;
+ i4bisppp_idletime_p = i4bisppp_idletime;
+ i4bispppattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4bisppp module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4bisppp_mod = {
+ "i4bisppp",
+ i4bisppp_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4bisppp, i4bisppp_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
/*---------------------------------------------------------------------------*
* interface attach routine at kernel boot time
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
+static void
i4bispppattach(void *dummy)
{
struct i4bisppp_softc *sc = i4bisppp_softc;
@@ -649,7 +677,7 @@
/*---------------------------------------------------------------------------*
* return this drivers linktab address
*---------------------------------------------------------------------------*/
-drvr_link_t *
+static drvr_link_t *
i4bisppp_ret_linktab(int unit)
{
return(&i4bisppp_drvr_linktab[unit]);
@@ -658,7 +686,7 @@
/*---------------------------------------------------------------------------*
* setup the isdn_linktab for this driver
*---------------------------------------------------------------------------*/
-void
+static void
i4bisppp_set_linktab(int unit, isdn_link_t *ilt)
{
isdn_linktab[unit] = ilt;
diff -ru freebsd/sys/i4b/driver/i4b_rbch.c cleanup/sys/i4b/driver/i4b_rbch.c
--- freebsd/sys/i4b/driver/i4b_rbch.c Sat Jan 8 10:40:06 2005
+++ cleanup/sys/i4b/driver/i4b_rbch.c Sat Jan 8 21:41:53 2005
@@ -39,8 +39,10 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
+#include <sys/bus.h>
#include <sys/uio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/filio.h>
@@ -61,13 +63,10 @@
#include <sys/ioccom.h>
#include <sys/poll.h>
-static drvr_link_t rbch_drvr_linktab[NI4BRBCH];
-static isdn_link_t *isdn_linktab[NI4BRBCH];
-
#define I4BRBCHACCT 1 /* enable accounting messages */
#define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */
-static struct rbch_softc {
+struct rbch_softc {
int sc_unit; /* unit number */
int sc_devstate; /* state of driver */
@@ -95,13 +94,19 @@
int sc_loutb; /* last # of bytes tx'd */
int sc_fn; /* flag, first null acct */
#endif
-} rbch_softc[NI4BRBCH];
+
+ drvr_link_t rbch_drvr_linktab;
+ isdn_link_t *isdn_linktab;
+};
+static struct rbch_softc *rbch_softc;
static void rbch_rx_data_rdy(int unit);
static void rbch_tx_queue_empty(int unit);
static void rbch_connect(int unit, void *cdp);
static void rbch_disconnect(int unit, void *cdp);
static void rbch_init_linktab(int unit);
+static drvr_link_t * rbch_ret_linktab(int unit);
+static void rbch_set_linktab(int unit, isdn_link_t *ilt);
static void rbch_clrq(int unit);
static d_open_t i4brbchopen;
@@ -111,6 +116,7 @@
static d_ioctl_t i4brbchioctl;
static d_poll_t i4brbchpoll;
+static int n_rbch = NI4BRBCH;
static struct cdevsw i4brbch_cdevsw = {
.d_version = D_VERSION,
@@ -125,11 +131,33 @@
};
static void i4brbchattach(void *);
-PSEUDO_SET(i4brbchattach, i4b_rbch);
/*===========================================================================*
* DEVICE DRIVER ROUTINES
*===========================================================================*/
+static int i4brbch_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ rbch_ret_linktab_p = rbch_ret_linktab;
+ rbch_set_linktab_p = rbch_set_linktab;
+ i4brbchattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4brbch module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4brbch_mod = {
+ "i4brbch",
+ i4brbch_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4brbch, i4brbch_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
/*---------------------------------------------------------------------------*
* interface attach routine
@@ -139,9 +167,12 @@
{
int i;
- printf("i4brbch: %d raw B channel access device(s) attached\n", NI4BRBCH);
+ rbch_softc = malloc(sizeof(struct rbch_softc) * n_rbch, M_I4B,
+ M_WAITOK);
+
+ printf("i4brbch: %d raw B channel access device(s) attached\n", n_rbch);
- for(i=0; i < NI4BRBCH; i++)
+ for(i=0; i < n_rbch; i++)
{
make_dev(&i4brbch_cdevsw, i,
UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i);
@@ -171,7 +202,7 @@
{
int unit = minor(dev);
- if(unit >= NI4BRBCH)
+ if(unit >= n_rbch)
return(ENXIO);
if(rbch_softc[unit].sc_devstate & ST_ISOPEN)
@@ -243,7 +274,7 @@
if(sc->sc_bprot == BPROT_RHDLC)
iqp = &sc->sc_hdlcq;
else
- iqp = isdn_linktab[unit]->rx_queue;
+ iqp = rbch_softc[unit].isdn_linktab->rx_queue;
if(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN)) {
CRIT_END;
@@ -269,7 +300,7 @@
if(sc->sc_bprot == BPROT_RHDLC)
iqp = &sc->sc_hdlcq;
else
- iqp = isdn_linktab[unit]->rx_queue;
+ iqp = rbch_softc[unit].isdn_linktab->rx_queue;
while(IF_QEMPTY(iqp) && (sc->sc_devstate & ST_ISOPEN))
{
@@ -277,7 +308,7 @@
NDBGL4(L4_RBCHDBG, "unit %d, wait read data", unit);
- if((error = tsleep( &isdn_linktab[unit]->rx_queue,
+ if((error = tsleep( &rbch_softc[unit].isdn_linktab->rx_queue,
I4BPRI | PCATCH,
"rrbch", 0 )) != 0)
{
@@ -340,7 +371,7 @@
CRIT_END;
return(EWOULDBLOCK);
}
- if(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) {
+ if(_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue) && (sc->sc_devstate & ST_ISOPEN)) {
CRIT_END;
return(EWOULDBLOCK);
}
@@ -373,13 +404,13 @@
tsleep( &rbch_softc[unit], I4BPRI | PCATCH, "xrbch", (hz*1));
}
- while(_IF_QFULL(isdn_linktab[unit]->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
+ while(_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue) && (sc->sc_devstate & ST_ISOPEN))
{
sc->sc_devstate |= ST_WRWAITEMPTY;
NDBGL4(L4_RBCHDBG, "unit %d, write queue full", unit);
- if ((error = tsleep( &isdn_linktab[unit]->tx_queue,
+ if ((error = tsleep( &rbch_softc[unit].isdn_linktab->tx_queue,
I4BPRI | PCATCH,
"wrbch", 0)) != 0) {
sc->sc_devstate &= ~ST_WRWAITEMPTY;
@@ -419,9 +450,11 @@
error = uiomove(m->m_data, m->m_len, uio);
- (void) IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL);
+ (void) IF_HANDOFF(rbch_softc[unit].isdn_linktab->tx_queue, m, NULL);
- (*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
+ (*rbch_softc[unit].isdn_linktab->bch_tx_start)(
+ rbch_softc[unit].isdn_linktab->unit,
+ rbch_softc[unit].isdn_linktab->channel);
}
CRIT_END;
@@ -554,7 +587,7 @@
if((events & (POLLOUT|POLLWRNORM)) &&
(sc->sc_devstate & ST_CONNECTED) &&
- !_IF_QFULL(isdn_linktab[unit]->tx_queue))
+ !_IF_QFULL(rbch_softc[unit].isdn_linktab->tx_queue))
{
revents |= (events & (POLLOUT|POLLWRNORM));
}
@@ -569,7 +602,7 @@
if(sc->sc_bprot == BPROT_RHDLC)
iqp = &sc->sc_hdlcq;
else
- iqp = isdn_linktab[unit]->rx_queue;
+ iqp = rbch_softc[unit].isdn_linktab->rx_queue;
if(!IF_QEMPTY(iqp))
revents |= (events & (POLLIN|POLLRDNORM));
@@ -594,8 +627,9 @@
/* get # of bytes in and out from the HSCX driver */
- (*isdn_linktab[unit]->bch_stat)
- (isdn_linktab[unit]->unit, isdn_linktab[unit]->channel, &bs);
+ (*rbch_softc[unit].isdn_linktab->bch_stat)(
+ rbch_softc[unit].isdn_linktab->unit,
+ rbch_softc[unit].isdn_linktab->channel, &bs);
sc->sc_ioutb += bs.outbytes;
sc->sc_iinb += bs.inbytes;
@@ -718,7 +752,7 @@
{
register struct mbuf *m;
- if((m = *isdn_linktab[unit]->rx_mbuf) == NULL)
+ if((m = *rbch_softc[unit].isdn_linktab->rx_mbuf) == NULL)
return;
m->m_pkthdr.len = m->m_len;
@@ -733,7 +767,7 @@
{
NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
rbch_softc[unit].sc_devstate &= ~ST_RDWAITDATA;
- wakeup( &isdn_linktab[unit]->rx_queue);
+ wakeup( &rbch_softc[unit].isdn_linktab->rx_queue);
}
else
{
@@ -754,7 +788,7 @@
{
NDBGL4(L4_RBCHDBG, "unit %d, wakeup", unit);
rbch_softc[unit].sc_devstate &= ~ST_WRWAITEMPTY;
- wakeup( &isdn_linktab[unit]->tx_queue);
+ wakeup(&rbch_softc[unit].isdn_linktab->tx_queue);
}
else
{
@@ -791,20 +825,20 @@
/*---------------------------------------------------------------------------*
* return this drivers linktab address
*---------------------------------------------------------------------------*/
-drvr_link_t *
+static drvr_link_t *
rbch_ret_linktab(int unit)
{
rbch_init_linktab(unit);
- return(&rbch_drvr_linktab[unit]);
+ return(&rbch_softc[unit].rbch_drvr_linktab);
}
/*---------------------------------------------------------------------------*
* setup the isdn_linktab for this driver
*---------------------------------------------------------------------------*/
-void
+static void
rbch_set_linktab(int unit, isdn_link_t *ilt)
{
- isdn_linktab[unit] = ilt;
+ rbch_softc[unit].isdn_linktab = ilt;
}
/*---------------------------------------------------------------------------*
@@ -813,14 +847,14 @@
static void
rbch_init_linktab(int unit)
{
- rbch_drvr_linktab[unit].unit = unit;
- rbch_drvr_linktab[unit].bch_rx_data_ready = rbch_rx_data_rdy;
- rbch_drvr_linktab[unit].bch_tx_queue_empty = rbch_tx_queue_empty;
- rbch_drvr_linktab[unit].bch_activity = rbch_activity;
- rbch_drvr_linktab[unit].line_connected = rbch_connect;
- rbch_drvr_linktab[unit].line_disconnected = rbch_disconnect;
- rbch_drvr_linktab[unit].dial_response = rbch_dialresponse;
- rbch_drvr_linktab[unit].updown_ind = rbch_updown;
+ rbch_softc[unit].rbch_drvr_linktab.unit = unit;
+ rbch_softc[unit].rbch_drvr_linktab.bch_rx_data_ready = rbch_rx_data_rdy;
+ rbch_softc[unit].rbch_drvr_linktab.bch_tx_queue_empty = rbch_tx_queue_empty;
+ rbch_softc[unit].rbch_drvr_linktab.bch_activity = rbch_activity;
+ rbch_softc[unit].rbch_drvr_linktab.line_connected = rbch_connect;
+ rbch_softc[unit].rbch_drvr_linktab.line_disconnected = rbch_disconnect;
+ rbch_softc[unit].rbch_drvr_linktab.dial_response = rbch_dialresponse;
+ rbch_softc[unit].rbch_drvr_linktab.updown_ind = rbch_updown;
}
/*===========================================================================*/
diff -ru freebsd/sys/i4b/driver/i4b_tel.c cleanup/sys/i4b/driver/i4b_tel.c
--- freebsd/sys/i4b/driver/i4b_tel.c Sat Jan 8 10:40:07 2005
+++ cleanup/sys/i4b/driver/i4b_tel.c Sat Jan 8 21:41:53 2005
@@ -43,8 +43,10 @@
#include <sys/ioccom.h>
#include <sys/poll.h>
#include <sys/conf.h>
+#include <sys/bus.h>
#include <sys/uio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -109,13 +111,16 @@
} tel_sc_t;
-static tel_sc_t tel_sc[NI4BTEL][NOFUNCS];
+static int n_tel = NI4BTEL;
+static tel_sc_t *tel_sc;
/* forward decl */
static void tel_rx_data_rdy(int unit);
static void tel_tx_queue_empty(int unit);
static void tel_init_linktab(int unit);
+static drvr_link_t *tel_ret_linktab(int unit);
+static void tel_set_linktab(int unit, isdn_link_t *ilt);
static void tel_connect(int unit, void *cdp);
static void tel_disconnect(int unit, void *cdp);
static void tel_tone(tel_sc_t *sc);
@@ -148,12 +153,34 @@
static void i4btelattach(void *);
-PSEUDO_SET(i4btelattach, i4b_tel);
-
/*===========================================================================*
* DEVICE DRIVER ROUTINES
*===========================================================================*/
+static int i4btel_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ tel_ret_linktab_p = tel_ret_linktab;
+ tel_set_linktab_p = tel_set_linktab;
+ i4btelattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4btel module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4btel_mod = {
+ "i4btel",
+ i4btel_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4btel, i4btel_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -162,17 +189,19 @@
{
int i, j;
- printf("i4btel: %d ISDN telephony interface device(s) attached\n", NI4BTEL);
+ printf("i4btel: %d ISDN telephony interface device(s) attached\n", n_tel);
+
+ tel_sc = malloc(sizeof(tel_sc_t)*n_tel*NOFUNCS, M_I4B, M_WAITOK);
- for(i=0; i < NI4BTEL; i++)
+ for(i=0; i < n_tel; i++)
{
for(j=0; j < NOFUNCS; j++)
{
- tel_sc[i][j].devstate = ST_IDLE;
- tel_sc[i][j].audiofmt = CVT_NONE;
- tel_sc[i][j].rcvttab = 0;
- tel_sc[i][j].wcvttab = 0;
- tel_sc[i][j].result = 0;
+ tel_sc[i + n_tel * j].devstate = ST_IDLE;
+ tel_sc[i + n_tel * j].audiofmt = CVT_NONE;
+ tel_sc[i + n_tel * j].rcvttab = 0;
+ tel_sc[i + n_tel * j].wcvttab = 0;
+ tel_sc[i + n_tel * j].result = 0;
switch(j)
{
@@ -204,10 +233,10 @@
tel_sc_t *sc;
- if(unit >= NI4BTEL)
+ if(unit >= n_tel)
return(ENXIO);
- sc = &tel_sc[unit][func];
+ sc = &tel_sc[unit + n_tel*func];
if(sc->devstate & ST_ISOPEN)
return(EBUSY);
@@ -234,10 +263,10 @@
int error = 0;
int x;
- if(unit > NI4BTEL)
+ if(unit > n_tel)
return(ENXIO);
- sc = &tel_sc[unit][func];
+ sc = &tel_sc[unit + n_tel * func];
x = splimp();
sc->devstate &= ~ST_TONE;
@@ -277,7 +306,7 @@
struct mbuf *m;
int s;
- tel_sc_t *sc = &tel_sc[unit][func];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * func];
if(func == FUNCTEL)
{
@@ -400,7 +429,7 @@
int s;
int error = 0;
- tel_sc_t *sc = &tel_sc[unit][func];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * func];
if(!(sc->devstate & ST_ISOPEN))
return(EIO);
@@ -531,7 +560,7 @@
struct mbuf *m;
int s;
int error = 0;
- tel_sc_t *sc = &tel_sc[unit][func];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * func];
if(!(sc->devstate & ST_ISOPEN))
{
@@ -691,7 +720,7 @@
int unit = UNIT(dev);
int func = FUNC(dev);
- tel_sc_t *sc = &tel_sc[unit][func];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * func];
s = splhigh();
@@ -770,7 +799,7 @@
static void
tel_connect(int unit, void *cdp)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
/* audio device */
@@ -780,7 +809,7 @@
/* dialer device */
- sc = &tel_sc[unit][FUNCDIAL];
+ sc = &tel_sc[unit + n_tel * FUNCDIAL];
if(sc->devstate & ST_ISOPEN)
{
@@ -804,7 +833,7 @@
{
/* call_desc_t *cd = (call_desc_t *)cdp; */
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
/* audio device */
@@ -824,7 +853,7 @@
/* dialer device */
- sc = &tel_sc[unit][FUNCDIAL];
+ sc = &tel_sc[unit + n_tel * FUNCDIAL];
if(sc->devstate & ST_ISOPEN)
{
@@ -851,7 +880,7 @@
static void
tel_dialresponse(int unit, int status, cause_t cause)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCDIAL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCDIAL];
NDBGL4(L4_TELDBG, "i4btel%d, status=%d, cause=0x%4x", unit, status, cause);
@@ -885,7 +914,7 @@
static void
tel_rx_data_rdy(int unit)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
if(sc->devstate & ST_RDWAITDATA)
{
@@ -903,7 +932,7 @@
static void
tel_tx_queue_empty(int unit)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
if(sc->devstate & ST_WRWAITEMPTY)
{
@@ -924,17 +953,17 @@
static void
tel_activity(int unit, int rxtx)
{
- if(tel_sc[unit][FUNCTEL].cdp)
- tel_sc[unit][FUNCTEL].cdp->last_active_time = SECOND;
+ if(tel_sc[unit + n_tel * FUNCTEL].cdp)
+ tel_sc[unit + n_tel * FUNCTEL].cdp->last_active_time = SECOND;
}
/*---------------------------------------------------------------------------*
* return this drivers linktab address
*---------------------------------------------------------------------------*/
-drvr_link_t *
+static drvr_link_t *
tel_ret_linktab(int unit)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
tel_init_linktab(unit);
return(&sc->drvr_linktab);
@@ -943,10 +972,10 @@
/*---------------------------------------------------------------------------*
* setup the isdn_linktab for this driver
*---------------------------------------------------------------------------*/
-void
+static void
tel_set_linktab(int unit, isdn_link_t *ilt)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
sc->isdn_linktab = ilt;
}
@@ -956,7 +985,7 @@
static void
tel_init_linktab(int unit)
{
- tel_sc_t *sc = &tel_sc[unit][FUNCTEL];
+ tel_sc_t *sc = &tel_sc[unit + n_tel * FUNCTEL];
sc->drvr_linktab.unit = unit;
sc->drvr_linktab.bch_rx_data_ready = tel_rx_data_rdy;
diff -ru freebsd/sys/i4b/driver/i4b_trace.c cleanup/sys/i4b/driver/i4b_trace.c
--- freebsd/sys/i4b/driver/i4b_trace.c Sat Jan 8 10:40:07 2005
+++ cleanup/sys/i4b/driver/i4b_trace.c Sat Jan 8 21:41:53 2005
@@ -42,8 +42,10 @@
#include <sys/systm.h>
#include <sys/ioccom.h>
#include <sys/conf.h>
+#include <sys/bus.h>
#include <sys/uio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <net/if.h>
@@ -56,18 +58,23 @@
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
-static struct ifqueue trace_queue[NI4BTRC];
-
-static int device_state[NI4BTRC];
+struct trc_softc {
+ struct ifqueue trace_queue;
+ int device_state;
#define ST_IDLE 0x00
#define ST_ISOPEN 0x01
#define ST_WAITDATA 0x02
+};
+
+static struct trc_softc *trc_softc;
static int analyzemode = 0;
static int rxunit = -1;
static int txunit = -1;
static int outunit = -1;
+static int n_trc = NI4BTRC;
+
static d_open_t i4btrcopen;
static d_close_t i4btrcclose;
static d_read_t i4btrcread;
@@ -87,10 +94,31 @@
};
static void i4btrcattach(void *);
-PSEUDO_SET(i4btrcattach, i4b_trace);
int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf);
+static int i4btrc_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4btrcattach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4btrc module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4btrc_mod = {
+ "i4btrc",
+ i4btrc_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4btrc, i4btrc_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
+
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
@@ -99,18 +127,21 @@
{
int i;
- printf("i4btrc: %d ISDN trace device(s) attached\n", NI4BTRC);
+ printf("i4btrc: %d ISDN trace device(s) attached\n", n_trc);
+
+ trc_softc = malloc(sizeof(struct trc_softc) * n_trc, M_I4B, M_WAITOK);
- for(i=0; i < NI4BTRC; i++)
+ for(i=0; i < n_trc; i++)
{
make_dev(&i4btrc_cdevsw, i,
UID_ROOT, GID_WHEEL, 0600, "i4btrc%d", i);
- trace_queue[i].ifq_maxlen = IFQ_MAXLEN;
+ trc_softc[i].trace_queue.ifq_maxlen = IFQ_MAXLEN;
- if(!mtx_initialized(&trace_queue[i].ifq_mtx))
- mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", NULL, MTX_DEF);
+ if(!mtx_initialized(&trc_softc[i].trace_queue.ifq_mtx))
+ mtx_init(&trc_softc[i].trace_queue.ifq_mtx,
+ "i4b_trace", NULL, MTX_DEF);
- device_state[i] = ST_IDLE;
+ trc_softc[i].device_state = ST_IDLE;
}
}
@@ -157,9 +188,9 @@
/* check valid unit no */
- if((unit = hdr->unit) >= NI4BTRC)
+ if((unit = hdr->unit) >= n_trc)
{
- printf("i4b_trace: get_trace_data_from_l1 - unit > NI4BTRC!\n");
+ printf("i4b_trace: get_trace_data_from_l1 - unit > n_trc!\n");
return(0);
}
@@ -182,14 +213,14 @@
unit = outunit;
}
- IF_LOCK(&trace_queue[unit]);
+ IF_LOCK(&trc_softc[unit].trace_queue);
- if(_IF_QFULL(&trace_queue[unit]))
+ if(_IF_QFULL(&trc_softc[unit].trace_queue))
{
struct mbuf *m1;
x = SPLI4B();
- _IF_DEQUEUE(&trace_queue[unit], m1);
+ _IF_DEQUEUE(&trc_softc[unit].trace_queue, m1);
splx(x);
i4b_Bfreembuf(m1);
@@ -206,13 +237,13 @@
x = SPLI4B();
- _IF_ENQUEUE(&trace_queue[unit], m);
- IF_UNLOCK(&trace_queue[unit]);
+ _IF_ENQUEUE(&trc_softc[unit].trace_queue, m);
+ IF_UNLOCK(&trc_softc[unit].trace_queue);
- if(device_state[unit] & ST_WAITDATA)
+ if(trc_softc[unit].device_state & ST_WAITDATA)
{
- device_state[unit] &= ~ST_WAITDATA;
- wakeup( &trace_queue[unit]);
+ trc_softc[unit].device_state &= ~ST_WAITDATA;
+ wakeup( &trc_softc[unit].trace_queue);
}
splx(x);
@@ -229,10 +260,10 @@
int x;
int unit = minor(dev);
- if(unit >= NI4BTRC)
+ if(unit >= n_trc)
return(ENXIO);
- if(device_state[unit] & ST_ISOPEN)
+ if(trc_softc[unit].device_state & ST_ISOPEN)
return(EBUSY);
if(analyzemode && (unit == outunit || unit == rxunit || unit == txunit))
@@ -240,7 +271,7 @@
x = SPLI4B();
- device_state[unit] = ST_ISOPEN;
+ trc_softc[unit].device_state = ST_ISOPEN;
splx(x);
@@ -287,7 +318,7 @@
}
x = SPLI4B();
- device_state[unit] = ST_IDLE;
+ trc_softc[unit].device_state = ST_IDLE;
splx(x);
return(0);
@@ -304,31 +335,32 @@
int error = 0;
int unit = minor(dev);
- if(!(device_state[unit] & ST_ISOPEN))
+ if(!(trc_softc[unit].device_state & ST_ISOPEN))
return(EIO);
x = SPLI4B();
- IF_LOCK(&trace_queue[unit]);
+ IF_LOCK(&trc_softc[unit].trace_queue);
- while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN))
+ while(IF_QEMPTY(&trc_softc[unit].trace_queue) &&
+ (trc_softc[unit].device_state & ST_ISOPEN))
{
- device_state[unit] |= ST_WAITDATA;
+ trc_softc[unit].device_state |= ST_WAITDATA;
- if((error = msleep( &trace_queue[unit],
- &trace_queue[unit].ifq_mtx,
+ if((error = msleep( &trc_softc[unit].trace_queue,
+ &trc_softc[unit].trace_queue.ifq_mtx,
I4BPRI | PCATCH,
"bitrc", 0 )) != 0)
{
- device_state[unit] &= ~ST_WAITDATA;
- IF_UNLOCK(&trace_queue[unit]);
+ trc_softc[unit].device_state &= ~ST_WAITDATA;
+ IF_UNLOCK(&trc_softc[unit].trace_queue);
splx(x);
return(error);
}
}
- _IF_DEQUEUE(&trace_queue[unit], m);
- IF_UNLOCK(&trace_queue[unit]);
+ _IF_DEQUEUE(&trc_softc[unit].trace_queue, m);
+ IF_UNLOCK(&trc_softc[unit].trace_queue);
if(m && m->m_len)
error = uiomove(m->m_data, m->m_len, uio);
@@ -387,12 +419,12 @@
case I4B_TRC_SETA:
tsa = (i4b_trace_setupa_t *)data;
- if(tsa->rxunit >= 0 && tsa->rxunit < NI4BTRC)
+ if(tsa->rxunit >= 0 && tsa->rxunit < n_trc)
rxunit = tsa->rxunit;
else
error = EINVAL;
- if(tsa->txunit >= 0 && tsa->txunit < NI4BTRC)
+ if(tsa->txunit >= 0 && tsa->txunit < n_trc)
txunit = tsa->txunit;
else
error = EINVAL;
diff -ru freebsd/sys/i4b/include/i4b_global.h cleanup/sys/i4b/include/i4b_global.h
--- freebsd/sys/i4b/include/i4b_global.h Sat Jan 8 10:40:07 2005
+++ cleanup/sys/i4b/include/i4b_global.h Sat Jan 8 21:41:53 2005
@@ -37,40 +37,6 @@
#ifndef _I4B_GLOBAL_H_
#define _I4B_GLOBAL_H_
-/*---------------------------------------------------------------------------*
- * hiding OS differences in the kernel
- *---------------------------------------------------------------------------*/
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 5
-/*
- * Deprecated LKM interface.
- */
-#include <sys/module.h>
-#define PSEUDO_SET(sym, name) \
- static int name ## _modevent(module_t mod, int type, void *data) \
- { \
- void (*initfunc)(void *) = (void (*)(void *))data; \
- switch (type) { \
- case MOD_LOAD: \
- /* printf(#name " module load\n"); */ \
- initfunc(NULL); \
- break; \
- case MOD_UNLOAD: \
- printf(#name " module unload - not possible for this module type\n"); \
- return EINVAL; \
- default: \
- return EOPNOTSUPP; \
- } \
- return 0; \
- } \
- static moduledata_t name ## _mod = { \
- #name, \
- name ## _modevent, \
- (void *)sym \
- }; \
- DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_ANY)
-#endif
-
/*---------------*/
/* time handling */
/*---------------*/
@@ -126,5 +92,7 @@
#define CMR_SETTRACE 2 /* set D-channel and B-channel trace */
#define CMR_GCST 3 /* get chipset statistics */
#define CMR_CCST 4 /* clear chipset statistics */
+
+MALLOC_DECLARE(M_I4B);
#endif /* _I4B_GLOBAL_H_ */
diff -ru freebsd/sys/i4b/include/i4b_l3l4.h cleanup/sys/i4b/include/i4b_l3l4.h
--- freebsd/sys/i4b/include/i4b_l3l4.h Sat Jan 8 10:40:08 2005
+++ cleanup/sys/i4b/include/i4b_l3l4.h Sat Jan 8 21:41:54 2005
@@ -96,28 +96,28 @@
/* global linktab functions for RBCH userland driver */
-drvr_link_t *rbch_ret_linktab(int unit);
-void rbch_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*rbch_ret_linktab_p)(int);
+extern void (*rbch_set_linktab_p)(int, isdn_link_t *);
/* global linktab functions for IPR network driver */
-drvr_link_t *ipr_ret_linktab(int unit);
-void ipr_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*ipr_ret_linktab_p)(int);
+extern void (*ipr_set_linktab_p)(int, isdn_link_t *);
/* global linktab functions for TEL userland driver */
-drvr_link_t *tel_ret_linktab(int unit);
-void tel_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*tel_ret_linktab_p)(int);
+extern void (*tel_set_linktab_p)(int, isdn_link_t *);
/* global linktab functions for ISPPP userland driver */
-drvr_link_t *i4bisppp_ret_linktab(int unit);
-void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*i4bisppp_ret_linktab_p)(int);
+extern void (*i4bisppp_set_linktab_p)(int, isdn_link_t *);
/* global linktab functions for ING network driver */
-drvr_link_t *ing_ret_linktab(int unit);
-void ing_set_linktab(int unit, isdn_link_t *ilt);
+extern drvr_link_t *(*ing_ret_linktab_p)(int);
+extern void (*ing_set_linktab_p)(int, isdn_link_t *);
/*---------------------------------------------------------------------------*
diff -ru freebsd/sys/i4b/layer1/i4b_l1dmux.c cleanup/sys/i4b/layer1/i4b_l1dmux.c
--- freebsd/sys/i4b/layer1/i4b_l1dmux.c Sat Jan 8 10:40:09 2005
+++ cleanup/sys/i4b/layer1/i4b_l1dmux.c Sat Jan 8 21:41:54 2005
@@ -36,6 +36,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/malloc.h>
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
diff -ru freebsd/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c cleanup/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c
--- freebsd/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c Sat Jan 8 10:40:12 2005
+++ cleanup/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c Sat Jan 8 21:41:55 2005
@@ -41,10 +41,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpi/i4b_ifpi_pci.c,v 1.17 2005/01/06 22:18:19 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c cleanup/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c
--- freebsd/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c Sat Jan 8 10:40:13 2005
+++ cleanup/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c Sat Jan 8 21:41:57 2005
@@ -40,10 +40,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpi2/i4b_ifpi2_pci.c,v 1.17 2005/01/06 22:18:19 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c cleanup/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c
--- freebsd/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c Sat Jan 8 10:40:14 2005
+++ cleanup/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c Sat Jan 8 21:41:57 2005
@@ -40,10 +40,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/ifpnp/i4b_ifpnp_avm.c,v 1.12 2005/01/06 22:18:19 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c cleanup/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c
--- freebsd/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c Sat Jan 8 10:40:16 2005
+++ cleanup/sys/i4b/layer1/ihfc/i4b_ihfc_pnp.c Sat Jan 8 21:41:59 2005
@@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/socket.h>
#include <net/if.h>
diff -ru freebsd/sys/i4b/layer1/itjc/i4b_itjc_isac.c cleanup/sys/i4b/layer1/itjc/i4b_itjc_isac.c
--- freebsd/sys/i4b/layer1/itjc/i4b_itjc_isac.c Sat Jan 8 10:40:25 2005
+++ cleanup/sys/i4b/layer1/itjc/i4b_itjc_isac.c Sat Jan 8 21:42:03 2005
@@ -34,8 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_isac.c,v 1.5 2005/01/06 22:18:20 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
diff -ru freebsd/sys/i4b/layer1/itjc/i4b_itjc_pci.c cleanup/sys/i4b/layer1/itjc/i4b_itjc_pci.c
--- freebsd/sys/i4b/layer1/itjc/i4b_itjc_pci.c Sat Jan 8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/itjc/i4b_itjc_pci.c Sat Jan 8 21:42:04 2005
@@ -40,10 +40,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/itjc/i4b_itjc_pci.c,v 1.14 2005/01/06 22:18:20 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_bchan.c cleanup/sys/i4b/layer1/iwic/i4b_iwic_bchan.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_bchan.c Sat Jan 8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_bchan.c Sat Jan 8 21:42:04 2005
@@ -35,8 +35,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_bchan.c,v 1.14 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_dchan.c cleanup/sys/i4b/layer1/iwic/i4b_iwic_dchan.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_dchan.c Sat Jan 8 10:40:31 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_dchan.c Sat Jan 8 21:42:05 2005
@@ -34,8 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_dchan.c,v 1.8 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_fsm.c cleanup/sys/i4b/layer1/iwic/i4b_iwic_fsm.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_fsm.c Sat Jan 8 10:40:32 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_fsm.c Sat Jan 8 21:42:05 2005
@@ -34,8 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_fsm.c,v 1.8 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_l1if.c cleanup/sys/i4b/layer1/iwic/i4b_iwic_l1if.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_l1if.c Sat Jan 8 10:40:33 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_l1if.c Sat Jan 8 21:42:05 2005
@@ -34,8 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_l1if.c,v 1.9 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/socket.h>
diff -ru freebsd/sys/i4b/layer1/iwic/i4b_iwic_pci.c cleanup/sys/i4b/layer1/iwic/i4b_iwic_pci.c
--- freebsd/sys/i4b/layer1/iwic/i4b_iwic_pci.c Sat Jan 8 10:40:33 2005
+++ cleanup/sys/i4b/layer1/iwic/i4b_iwic_pci.c Sat Jan 8 21:42:05 2005
@@ -34,10 +34,9 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer1/iwic/i4b_iwic_pci.c,v 1.13 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/socket.h>
#include <net/if.h>
diff -ru freebsd/sys/i4b/layer4/i4b_i4bdrv.c cleanup/sys/i4b/layer4/i4b_i4bdrv.c
--- freebsd/sys/i4b/layer4/i4b_i4bdrv.c Sat Jan 8 10:40:48 2005
+++ cleanup/sys/i4b/layer4/i4b_i4bdrv.c Sat Jan 8 21:42:08 2005
@@ -34,13 +34,12 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer4/i4b_i4bdrv.c,v 1.43 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/ioccom.h>
#include <sys/malloc.h>
#include <sys/uio.h>
#include <sys/kernel.h>
+#include <sys/module.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/mbuf.h>
@@ -62,6 +61,12 @@
struct selinfo select_rd_info;
+drvr_link_t *(*rbch_ret_linktab_p)(int);
+drvr_link_t *(*ipr_ret_linktab_p)(int);
+drvr_link_t *(*tel_ret_linktab_p)(int);
+drvr_link_t *(*i4bisppp_ret_linktab_p)(int);
+drvr_link_t *(*ing_ret_linktab_p)(int);
+
static struct ifqueue i4b_rdqueue;
static int openflag = 0;
static int selflag = 0;
@@ -73,6 +78,7 @@
static d_ioctl_t i4bioctl;
static d_poll_t i4bpoll;
+MALLOC_DEFINE(M_I4B, "I4B", "Memory for isdb4bsd");
static struct cdevsw i4b_cdevsw = {
.d_version = D_VERSION,
@@ -86,7 +92,28 @@
};
static void i4battach(void *);
-PSEUDO_SET(i4battach, i4b_i4bdrv);
+
+static int i4b_modevent(module_t mod, int type, void *data)
+{
+ switch(type) {
+ case MOD_LOAD:
+ i4battach(NULL);
+ break;
+ case MOD_UNLOAD:
+ printf("i4b module unload - not possiable for this module type\b");
+ return (EINVAL);
+ }
+
+ return (0);
+}
+
+static moduledata_t i4b_mod = {
+ "i4b",
+ i4b_modevent,
+ NULL
+};
+
+DECLARE_MODULE(i4b, i4b_mod, SI_SUB_PSEUDO, SI_ORDER_ANY);
/*---------------------------------------------------------------------------*
* interface attach routine
@@ -423,35 +450,25 @@
switch(mdrsp->driver)
{
-#if NI4BIPR > 0
case BDRV_IPR:
- dlt = ipr_ret_linktab(mdrsp->driver_unit);
+ if (ipr_ret_linktab_p != NULL)
+ dlt = ipr_ret_linktab_p(mdrsp->driver_unit);
break;
-#endif
-#if NI4BISPPP > 0
case BDRV_ISPPP:
- dlt = i4bisppp_ret_linktab(mdrsp->driver_unit);
+ if (i4bisppp_ret_linktab_p != NULL)
+ dlt = i4bisppp_ret_linktab_p(mdrsp->driver_unit);
break;
-#endif
-#if NI4BTEL > 0
case BDRV_TEL:
- dlt = tel_ret_linktab(mdrsp->driver_unit);
- break;
-#endif
-
-#if NIBC > 0
- case BDRV_IBC:
- dlt = ibc_ret_linktab(mdrsp->driver_unit);
+ if (tel_ret_linktab_p != NULL)
+ dlt = tel_ret_linktab_p(mdrsp->driver_unit);
break;
-#endif
-#if NI4BING > 0
case BDRV_ING:
- dlt = ing_ret_linktab(mdrsp->driver_unit);
+ if (ing_ret_linktab_p != NULL)
+ dlt = ing_ret_linktab_p(mdrsp->driver_unit);
break;
-#endif
}
if(dlt != NULL)
@@ -543,14 +560,12 @@
mui = (msg_updown_ind_t *)data;
-#if NI4BIPR > 0
if(mui->driver == BDRV_IPR)
{
drvr_link_t *dlt;
- dlt = ipr_ret_linktab(mui->driver_unit);
+ dlt = ipr_ret_linktab_p(mui->driver_unit);
(*dlt->updown_ind)(mui->driver_unit, mui->updown);
}
-#endif
break;
}
diff -ru freebsd/sys/i4b/layer4/i4b_l4.c cleanup/sys/i4b/layer4/i4b_l4.c
--- freebsd/sys/i4b/layer4/i4b_l4.c Sat Jan 8 10:40:49 2005
+++ cleanup/sys/i4b/layer4/i4b_l4.c Sat Jan 8 21:42:08 2005
@@ -34,8 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: src/sys/i4b/layer4/i4b_l4.c,v 1.19 2005/01/06 22:18:21 imp Exp $");
-#include "opt_i4b.h"
-
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
@@ -63,9 +61,13 @@
static void i4b_l4_setup_timeout_var_unit(call_desc_t *cd);
static time_t i4b_get_idletime(call_desc_t *cd);
-#if NI4BISPPP > 0
-extern time_t i4bisppp_idletime(int);
-#endif
+time_t (*i4bisppp_idletime_p)(int);
+
+void (*rbch_set_linktab_p)(int, isdn_link_t *);
+void (*ipr_set_linktab_p)(int, isdn_link_t *);
+void (*tel_set_linktab_p)(int, isdn_link_t *);
+void (*i4bisppp_set_linktab_p)(int, isdn_link_t *);
+void (*ing_set_linktab_p)(int, isdn_link_t *);
/*---------------------------------------------------------------------------*
* send MSG_PDEACT_IND message to userland
@@ -621,41 +623,30 @@
switch(cd->driver)
{
-#if NI4BRBCH > 0
case BDRV_RBCH:
- cd->dlt = rbch_ret_linktab(cd->driver_unit);
+ if (rbch_ret_linktab_p != NULL)
+ cd->dlt = rbch_ret_linktab_p(cd->driver_unit);
break;
-#endif
-#if NI4BTEL > 0
case BDRV_TEL:
- cd->dlt = tel_ret_linktab(cd->driver_unit);
+ if (tel_ret_linktab_p != NULL)
+ cd->dlt = tel_ret_linktab_p(cd->driver_unit);
break;
-#endif
-#if NI4BIPR > 0
case BDRV_IPR:
- cd->dlt = ipr_ret_linktab(cd->driver_unit);
+ if (ipr_ret_linktab_p != NULL)
+ cd->dlt = ipr_ret_linktab_p(cd->driver_unit);
break;
-#endif
-#if NI4BISPPP > 0
case BDRV_ISPPP:
- cd->dlt = i4bisppp_ret_linktab(cd->driver_unit);
- break;
-#endif
-
-#if NIBC > 0
- case BDRV_IBC:
- cd->dlt = ibc_ret_linktab(cd->driver_unit);
+ if (i4bisppp_ret_linktab_p != NULL)
+ cd->dlt = i4bisppp_ret_linktab_p(cd->driver_unit);
break;
-#endif
-#if NI4BING > 0
case BDRV_ING:
- cd->dlt = ing_ret_linktab(cd->driver_unit);
+ if (ing_ret_linktab_p != NULL)
+ cd->dlt = ing_ret_linktab_p(cd->driver_unit);
break;
-#endif
default:
cd->dlt = NULL;
@@ -675,41 +666,30 @@
switch(cd->driver)
{
-#if NI4BRBCH > 0
case BDRV_RBCH:
- rbch_set_linktab(cd->driver_unit, cd->ilt);
+ if (rbch_set_linktab_p != NULL)
+ rbch_set_linktab_p(cd->driver_unit, cd->ilt);
break;
-#endif
-#if NI4BTEL > 0
case BDRV_TEL:
- tel_set_linktab(cd->driver_unit, cd->ilt);
+ if (tel_set_linktab_p != NULL)
+ tel_set_linktab_p(cd->driver_unit, cd->ilt);
break;
-#endif
-#if NI4BIPR > 0
case BDRV_IPR:
- ipr_set_linktab(cd->driver_unit, cd->ilt);
+ if (ipr_set_linktab_p != NULL)
+ ipr_set_linktab_p(cd->driver_unit, cd->ilt);
break;
-#endif
-#if NI4BISPPP > 0
case BDRV_ISPPP:
- i4bisppp_set_linktab(cd->driver_unit, cd->ilt);
- break;
-#endif
-
-#if NIBC > 0
- case BDRV_IBC:
- ibc_set_linktab(cd->driver_unit, cd->ilt);
+ if (i4bisppp_set_linktab_p != NULL)
+ i4bisppp_set_linktab_p(cd->driver_unit, cd->ilt);
break;
-#endif
-#if NI4BING > 0
case BDRV_ING:
- ing_set_linktab(cd->driver_unit, cd->ilt);
+ if (ing_set_linktab_p != NULL)
+ ing_set_linktab_p(cd->driver_unit, cd->ilt);
break;
-#endif
default:
return(0);
@@ -794,11 +774,12 @@
i4b_get_idletime(call_desc_t *cd)
{
switch (cd->driver) {
-#if NI4BISPPP > 0
case BDRV_ISPPP:
- return i4bisppp_idletime(cd->driver_unit);
+ if (i4bisppp_idletime_p != NULL)
+ return i4bisppp_idletime_p(cd->driver_unit);
+ else
+ return (0);
break;
-#endif
default:
return cd->last_active_time;
break;
diff -ru freebsd/sys/i4b/layer4/i4b_l4timer.c cleanup/sys/i4b/layer4/i4b_l4timer.c
--- freebsd/sys/i4b/layer4/i4b_l4timer.c Sat Jan 8 10:40:51 2005
+++ cleanup/sys/i4b/layer4/i4b_l4timer.c Sat Jan 8 21:42:09 2005
@@ -36,6 +36,7 @@
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
+#include <sys/malloc.h>
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
--
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-isdn/attachments/20050225/f6d6c3ae/attachment.bin
More information about the freebsd-isdn
mailing list