summaryrefslogtreecommitdiffstats
path: root/sys/i4b
diff options
context:
space:
mode:
authorhm <hm@FreeBSD.org>2002-03-17 09:33:15 +0000
committerhm <hm@FreeBSD.org>2002-03-17 09:33:15 +0000
commit3e7af4a9665cdd7b30f61045cc0ae4c494d0c7a8 (patch)
tree9694b7441ca7325a9386dc72ccc1f07e0faad12d /sys/i4b
parente86597e456382f7bf7d244ea3d1d3f90cdbfa171 (diff)
downloadFreeBSD-src-3e7af4a9665cdd7b30f61045cc0ae4c494d0c7a8.zip
FreeBSD-src-3e7af4a9665cdd7b30f61045cc0ae4c494d0c7a8.tar.gz
Clean up the i4b kernel part: remove unmaintained #if(def)s for NetBSD,
OpenBSD and BSD/OS and respective code, remove pre $FreeBSD CVS id's, remove #if(def)s and respective code for FreeBSD versions < 5 .
Diffstat (limited to 'sys/i4b')
-rw-r--r--sys/i4b/capi/capi_l4if.c2
-rw-r--r--sys/i4b/capi/iavc/iavc_isa.c4
-rw-r--r--sys/i4b/capi/iavc/iavc_lli.c5
-rw-r--r--sys/i4b/capi/iavc/iavc_pci.c2
-rw-r--r--sys/i4b/driver/i4b_ctl.c142
-rw-r--r--sys/i4b/driver/i4b_ing.c23
-rw-r--r--sys/i4b/driver/i4b_ipr.c241
-rw-r--r--sys/i4b/driver/i4b_isppp.c115
-rw-r--r--sys/i4b/driver/i4b_rbch.c254
-rw-r--r--sys/i4b/driver/i4b_tel.c149
-rw-r--r--sys/i4b/driver/i4b_trace.c126
-rw-r--r--sys/i4b/include/i4b_cause.h6
-rw-r--r--sys/i4b/include/i4b_debug.h4
-rw-r--r--sys/i4b/include/i4b_global.h76
-rw-r--r--sys/i4b/include/i4b_ioctl.h6
-rw-r--r--sys/i4b/include/i4b_isdnq931.h6
-rw-r--r--sys/i4b/include/i4b_l1l2.h11
-rw-r--r--sys/i4b/include/i4b_l2l3.h7
-rw-r--r--sys/i4b/include/i4b_l3l4.h27
-rw-r--r--sys/i4b/include/i4b_mbuf.h6
-rw-r--r--sys/i4b/include/i4b_rbch_ioctl.h6
-rw-r--r--sys/i4b/include/i4b_tel_ioctl.h4
-rw-r--r--sys/i4b/include/i4b_trace.h6
-rw-r--r--sys/i4b/layer1/isic/i4b_bchan.c8
-rw-r--r--sys/i4b/layer1/isic/i4b_hscx.c16
-rw-r--r--sys/i4b/layer2/i4b_iframe.c21
-rw-r--r--sys/i4b/layer2/i4b_l2.c31
-rw-r--r--sys/i4b/layer2/i4b_l2.h14
-rw-r--r--sys/i4b/layer2/i4b_l2fsm.c20
-rw-r--r--sys/i4b/layer2/i4b_l2fsm.h7
-rw-r--r--sys/i4b/layer2/i4b_l2timer.c20
-rw-r--r--sys/i4b/layer2/i4b_lme.c21
-rw-r--r--sys/i4b/layer2/i4b_mbuf.c33
-rw-r--r--sys/i4b/layer2/i4b_sframe.c20
-rw-r--r--sys/i4b/layer2/i4b_tei.c45
-rw-r--r--sys/i4b/layer2/i4b_uframe.c20
-rw-r--r--sys/i4b/layer2/i4b_util.c20
-rw-r--r--sys/i4b/layer3/i4b_l3fsm.c22
-rw-r--r--sys/i4b/layer3/i4b_l3fsm.h6
-rw-r--r--sys/i4b/layer3/i4b_l3timer.c21
-rw-r--r--sys/i4b/layer3/i4b_l4if.c21
-rw-r--r--sys/i4b/layer3/i4b_q931.c24
-rw-r--r--sys/i4b/layer3/i4b_q932fac.c21
-rw-r--r--sys/i4b/layer3/i4b_q932fac.h6
-rw-r--r--sys/i4b/layer4/i4b_i4bdrv.c219
-rw-r--r--sys/i4b/layer4/i4b_l4.c42
-rw-r--r--sys/i4b/layer4/i4b_l4mgmt.c50
-rw-r--r--sys/i4b/layer4/i4b_l4timer.c15
48 files changed, 215 insertions, 1756 deletions
diff --git a/sys/i4b/capi/capi_l4if.c b/sys/i4b/capi/capi_l4if.c
index 5460ffb..ff17b6e 100644
--- a/sys/i4b/capi/capi_l4if.c
+++ b/sys/i4b/capi/capi_l4if.c
@@ -239,12 +239,10 @@ capi_ll_attach(capi_softc_t *sc)
sc->sc_bchan[i].tx_queue.ifq_maxlen = IFQ_MAXLEN;
sc->sc_bchan[i].rx_queue.ifq_maxlen = IFQ_MAXLEN;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&sc->sc_bchan[i].tx_queue.ifq_mtx))
mtx_init(&sc->sc_bchan[i].tx_queue.ifq_mtx, "i4b_capi_tx", MTX_DEF);
if(!mtx_initialized(&sc->sc_bchan[i].rx_queue.ifq_mtx))
mtx_init(&sc->sc_bchan[i].rx_queue.ifq_mtx, "i4b_capi_rx", MTX_DEF);
-#endif
sc->sc_bchan[i].txcount = 0;
sc->sc_bchan[i].rxcount = 0;
diff --git a/sys/i4b/capi/iavc/iavc_isa.c b/sys/i4b/capi/iavc/iavc_isa.c
index b4cfaba..84b7cae 100644
--- a/sys/i4b/capi/iavc/iavc_isa.c
+++ b/sys/i4b/capi/iavc/iavc_isa.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 2001, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -224,10 +224,8 @@ iavc_isa_attach(device_t dev)
memset(&sc->sc_txq, 0, sizeof(struct ifqueue));
sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&sc->sc_txq.ifq_mtx))
mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_isa", MTX_DEF);
-#endif
sc->sc_intr = FALSE;
sc->sc_state = IAVC_DOWN;
diff --git a/sys/i4b/capi/iavc/iavc_lli.c b/sys/i4b/capi/iavc/iavc_lli.c
index a8ffb5a..c7455b2 100644
--- a/sys/i4b/capi/iavc/iavc_lli.c
+++ b/sys/i4b/capi/iavc/iavc_lli.c
@@ -256,11 +256,8 @@ int iavc_send(capi_softc_t *capi_sc, struct mbuf *m)
}
if (_IF_QFULL(&sc->sc_txq)) {
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
+
_IF_DROP(&sc->sc_txq);
-#else
- IF_DROP(&sc->sc_txq);
-#endif
printf("iavc%d: tx overflow, message dropped\n", sc->sc_unit);
diff --git a/sys/i4b/capi/iavc/iavc_pci.c b/sys/i4b/capi/iavc/iavc_pci.c
index 12de906..c22be11 100644
--- a/sys/i4b/capi/iavc/iavc_pci.c
+++ b/sys/i4b/capi/iavc/iavc_pci.c
@@ -235,10 +235,8 @@ iavc_pci_attach(device_t dev)
memset(&sc->sc_txq, 0, sizeof(struct ifqueue));
sc->sc_txq.ifq_maxlen = sc->sc_capi.sc_nbch * 4;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&sc->sc_txq.ifq_mtx))
mtx_init(&sc->sc_txq.ifq_mtx, "i4b_ivac_pci", MTX_DEF);
-#endif
sc->sc_intr = FALSE;
sc->sc_state = IAVC_DOWN;
diff --git a/sys/i4b/driver/i4b_ctl.c b/sys/i4b/driver/i4b_ctl.c
index d74fa7e..79f015a 100644
--- a/sys/i4b/driver/i4b_ctl.c
+++ b/sys/i4b/driver/i4b_ctl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_ctl.c - i4b system control port driver
* ------------------------------------------
*
- * $Id: i4b_ctl.c,v 1.37 2000/05/31 08:04:43 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Wed May 31 09:59:01 2000]
+ * last edit-date: [Sun Mar 17 09:49:24 2002]
*
*---------------------------------------------------------------------------*/
@@ -44,43 +42,19 @@
#if NI4BCTL > 0
#include <sys/param.h>
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <sys/ioccom.h>
-#else
-#include <sys/ioctl.h>
-#endif
-
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/socket.h>
#include <net/if.h>
-#ifdef __FreeBSD__
-
-#if defined(__FreeBSD__) && __FreeBSD__ == 3
-#include "opt_devfs.h"
-#endif
-
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
-#endif /* __FreeBSD__ */
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#elif defined(__bsdi__)
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#else
-#include <machine/bus.h>
-#include <sys/device.h>
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
@@ -89,28 +63,20 @@
static int openflag = 0;
-#if BSD > 199306 && defined(__FreeBSD__)
static d_open_t i4bctlopen;
static d_close_t i4bctlclose;
static d_ioctl_t i4bctlioctl;
-
-#ifdef OS_USES_POLL
-static d_poll_t i4bctlpoll;
-#define POLLFIELD i4bctlpoll
-#else
-#define POLLFIELD noselect
-#endif
+static d_poll_t i4bctlpoll;
#define CDEV_MAJOR 55
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
static struct cdevsw i4bctl_cdevsw = {
/* open */ i4bctlopen,
/* close */ i4bctlclose,
/* read */ noread,
/* write */ nowrite,
/* ioctl */ i4bctlioctl,
- /* poll */ POLLFIELD,
+ /* poll */ i4bctlpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "i4bctl",
@@ -119,117 +85,35 @@ static struct cdevsw i4bctl_cdevsw = {
/* psize */ nopsize,
/* flags */ 0,
};
-#else
-static struct cdevsw i4bctl_cdevsw =
- { i4bctlopen, i4bctlclose, noread, nowrite,
- i4bctlioctl, nostop, nullreset, nodevtotty,
- POLLFIELD, nommap, NULL, "i4bctl", NULL, -1 };
-#endif
static void i4bctlattach(void *);
PSEUDO_SET(i4bctlattach, i4b_i4bctldrv);
-#define PDEVSTATIC static
-#endif /* __FreeBSD__ */
-
-#if defined(__FreeBSD__) && __FreeBSD__ == 3
-#ifdef DEVFS
-static void *devfs_token;
-#endif
-#endif
-
-#ifndef __FreeBSD__
-#define PDEVSTATIC /* */
-void i4bctlattach __P((void));
-int i4bctlopen __P((dev_t dev, int flag, int fmt, struct thread *td));
-int i4bctlclose __P((dev_t dev, int flag, int fmt, struct thread *td));
-#ifdef __bsdi__
-int i4bctlioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td));
-#else
-int i4bctlioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct thread *td));
-#endif
-#endif /* !FreeBSD */
-
-#if BSD > 199306 && defined(__FreeBSD__)
/*---------------------------------------------------------------------------*
* initialization at kernel load time
*---------------------------------------------------------------------------*/
static void
i4bctlinit(void *unused)
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
cdevsw_add(&i4bctl_cdevsw);
-#else
- dev_t dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev, &i4bctl_cdevsw, NULL);
-#endif
}
SYSINIT(i4bctldev, SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR, &i4bctlinit, NULL);
-#endif /* BSD > 199306 && defined(__FreeBSD__) */
-
-#ifdef __bsdi__
-int i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux);
-void dummy_i4bctlattach(struct device*, struct device *, void *);
-
-#define CDEV_MAJOR 64
-
-static struct cfdriver i4bctlcd =
- { NULL, "i4bctl", i4bctlmatch, dummy_i4bctlattach, DV_DULL,
- sizeof(struct cfdriver) };
-struct devsw i4bctlsw =
- { &i4bctlcd,
- i4bctlopen, i4bctlclose, noread, nowrite,
- i4bctlioctl, seltrue, nommap, nostrat,
- nodump, nopsize, 0, nostop
-};
-
-int
-i4bctlmatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- printf("i4bctlmatch: aux=0x%x\n", aux);
- return 1;
-}
-void
-dummy_i4bctlattach(struct device *parent, struct device *self, void *aux)
-{
- printf("dummy_i4bctlattach: aux=0x%x\n", aux);
-}
-#endif /* __bsdi__ */
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
-#ifdef __FreeBSD__
+static void
i4bctlattach(void *dummy)
-#else
-i4bctlattach()
-#endif
{
-#ifndef HACK_NO_PSEUDO_ATTACH_MSG
printf("i4bctl: ISDN system control port attached\n");
-#endif
-
-#if defined(__FreeBSD__)
-#if __FreeBSD__ == 3
-
-#ifdef DEVFS
- devfs_token = devfs_add_devswf(&i4bctl_cdevsw, 0, DV_CHR,
- UID_ROOT, GID_WHEEL, 0600,
- "i4bctl");
-#endif
-
-#else
make_dev(&i4bctl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4bctl");
-#endif
-#endif
}
/*---------------------------------------------------------------------------*
* i4bctlopen - device driver open routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bctlopen(dev_t dev, int flag, int fmt, struct thread *td)
{
if(minor(dev))
@@ -246,7 +130,7 @@ i4bctlopen(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* i4bctlclose - device driver close routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bctlclose(dev_t dev, int flag, int fmt, struct thread *td)
{
openflag = 0;
@@ -256,14 +140,8 @@ i4bctlclose(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* i4bctlioctl - device driver ioctl routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
-#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
-i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#elif defined(__bsdi__)
+static int
i4bctlioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#else
-i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
-#endif
{
#if DO_I4B_DEBUG
ctl_debug_t *cdbg;
@@ -354,8 +232,6 @@ i4bctlioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
#endif DO_I4B_DEBUG
}
-#if defined(__FreeBSD__) && defined(OS_USES_POLL)
-
/*---------------------------------------------------------------------------*
* i4bctlpoll - device driver poll routine
*---------------------------------------------------------------------------*/
@@ -365,6 +241,4 @@ i4bctlpoll (dev_t dev, int events, struct thread *td)
return (ENODEV);
}
-#endif
-
#endif /* NI4BCTL > 0 */
diff --git a/sys/i4b/driver/i4b_ing.c b/sys/i4b/driver/i4b_ing.c
index 843aff2..fd7d816 100644
--- a/sys/i4b/driver/i4b_ing.c
+++ b/sys/i4b/driver/i4b_ing.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_ing.c - isdn4bsd B-channel to netgraph driver
* -------------------------------------------------
*
- * $Id: i4b_ing.c,v 1.10 2000/04/27 11:35:00 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Nov 9 11:29:12 2000]
+ * last edit-date: [Sat Mar 9 14:09:53 2002]
*
*---------------------------------------------------------------------------*/
@@ -622,24 +620,17 @@ ng_ing_newhook(node_p node, hook_p hook, const char *name)
* The response should be in a malloc'd region that the caller can 'free'.
* A response is not required.
*---------------------------------------------------------------------------*/
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 500000
static int
ng_ing_rcvmsg(node_p node, item_p item, hook_p lasthook)
-#else
-static int
-ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
- struct ng_mesg **rptr)
-#endif
{
struct ing_softc *sc = NG_NODE_PRIVATE(node);
struct ng_mesg *resp = NULL;
int error = 0;
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 500000
struct ng_mesg *msg;
NGI_GET_MSG(item, msg);
-#endif
+
if(msg->header.typecookie == NGM_GENERIC_COOKIE)
{
switch(msg->header.cmd)
@@ -741,25 +732,19 @@ ng_ing_rcvmsg(node_p node, struct ng_mesg *msg, const char *retaddr,
/*---------------------------------------------------------------------------*
* get data from another node and transmit it out on a B-channel
*---------------------------------------------------------------------------*/
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 500000
static int
ng_ing_rcvdata(hook_p hook, item_p item)
-#else
-static int
-ng_ing_rcvdata(hook_p hook, struct mbuf *m, meta_p meta)
-#endif
{
struct ing_softc *sc = NG_NODE_PRIVATE(NG_HOOK_NODE(hook));
struct ifqueue *xmitq_p;
int s;
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 500000
struct mbuf *m;
meta_p meta;
NGI_GET_M(item, m);
NGI_GET_META(item, meta);
NG_FREE_ITEM(item);
-#endif
+
if(NG_HOOK_PRIVATE(hook) == NULL)
{
NG_FREE_M(m);
diff --git a/sys/i4b/driver/i4b_ipr.c b/sys/i4b/driver/i4b_ipr.c
index 8fae998..8023bb4 100644
--- a/sys/i4b/driver/i4b_ipr.c
+++ b/sys/i4b/driver/i4b_ipr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Oct 24 16:04:53 2001]
+ * last edit-date: [Sun Mar 17 09:32:58 2002]
*
*---------------------------------------------------------------------------*
*
@@ -60,42 +60,26 @@
#if NI4BIPR > 0
-#ifdef __FreeBSD__
#include "opt_i4b.h"
-#endif
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/errno.h>
-
-#if defined(__FreeBSD__)
#include <sys/ioccom.h>
#include <sys/sockio.h>
-#ifdef IPR_VJ
-#include <sys/malloc.h>
-#endif
-#else
-#include <sys/ioctl.h>
-#endif
-
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
#include <sys/kernel.h>
-
#include <net/if.h>
#include <net/if_types.h>
#include <net/netisr.h>
-
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/in_var.h>
#include <netinet/ip.h>
#ifdef IPR_VJ
+#include <sys/malloc.h>
#include <net/slcompress.h>
#define IPR_COMPRESS IFF_LINK0 /* compress TCP traffic */
#define IPR_AUTOCOMP IFF_LINK1 /* auto-enable TCP compression */
@@ -114,48 +98,21 @@
/* undef to uncompress in the mbuf itself */
#endif /* IPR_VJ */
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 400008
#include "bpf.h"
-#else
-#include "bpfilter.h"
-#endif
#if NBPFILTER > 0 || NBPF > 0
#include <sys/time.h>
#include <net/bpf.h>
#endif
-#ifdef __FreeBSD__
#include <machine/i4b_ioctl.h>
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
#include <i4b/layer4/i4b_l4.h>
-#ifndef __FreeBSD__
-#include <machine/cpu.h> /* For softnet */
-#endif
-
-#ifdef __FreeBSD__
-#define IPR_FMT "ipr%d: "
-#define IPR_ARG(sc) ((sc)->sc_if.if_unit)
-#define PDEVSTATIC static
-#elif defined(__bsdi__)
-#define IPR_FMT "ipr%d: "
-#define IPR_ARG(sc) ((sc)->sc_if.if_unit)
-#define PDEVSTATIC /* not static */
-#else
-#define IPR_FMT "%s: "
-#define IPR_ARG(sc) ((sc)->sc_if.if_xname)
-#define PDEVSTATIC /* not static */
-#endif
-
#define I4BIPRMTU 1500 /* regular MTU */
#define I4BIPRMAXMTU 2000 /* max MTU */
#define I4BIPRMINMTU 500 /* min MTU */
@@ -174,16 +131,12 @@ static isdn_link_t *isdn_linktab[NI4BIPR];
struct ipr_softc {
struct ifnet sc_if; /* network-visible interface */
int sc_state; /* state of the interface */
-
-#ifndef __FreeBSD__
- int sc_unit; /* unit number for Net/OpenBSD */
-#endif
-
call_desc_t *sc_cdp; /* ptr to call descriptor */
int sc_updown; /* soft state of interface */
struct ifqueue sc_fastq; /* interactive traffic */
int sc_dialresp; /* dialresponse */
int sc_lastdialresp;/* last dialresponse */
+ struct callout_handle sc_callout;
#if I4BIPRACCT
int sc_iinb; /* isdn driver # of inbytes */
@@ -195,16 +148,10 @@ struct ipr_softc {
int sc_fn; /* flag, first null acct */
#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- struct callout sc_callout;
-#endif
-#if defined(__FreeBSD__)
- struct callout_handle sc_callout;
-#endif
-
#ifdef I4BIPRADJFRXP
int sc_first_pkt; /* flag, first rxd packet */
#endif
+
#if IPR_LOG
int sc_log_first; /* log first n packets */
#endif
@@ -225,32 +172,11 @@ enum ipr_states {
ST_CONNECTED_A, /* connected to remote */
};
-#if defined(__FreeBSD__) || defined(__bsdi__)
-#define THE_UNIT sc->sc_if.if_unit
-#else
-#define THE_UNIT sc->sc_unit
-#endif
-
-#if defined __FreeBSD__ || defined __NetBSD__
-# define IOCTL_CMD_T u_long
-#else
-# define IOCTL_CMD_T int
-#endif
-
-#ifdef __FreeBSD__
-PDEVSTATIC void i4biprattach(void *);
+static void i4biprattach(void *);
PSEUDO_SET(i4biprattach, i4b_ipr);
-static int i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data);
-#else
-PDEVSTATIC void i4biprattach __P((void));
static int i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data);
-#endif
-#ifdef __bsdi__
-static int iprwatchdog(int unit);
-#else
static void iprwatchdog(struct ifnet *ifp);
-#endif
static void ipr_init_linktab(int unit);
static void ipr_tx_queue_empty(int unit);
static int i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst, struct rtentry *rtp);
@@ -263,12 +189,8 @@ static void iprclearqueues(struct ipr_softc *sc);
/*---------------------------------------------------------------------------*
* interface attach routine at kernel boot time
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
-#ifdef __FreeBSD__
+static void
i4biprattach(void *dummy)
-#else
-i4biprattach()
-#endif
{
struct ipr_softc *sc = ipr_softc;
int i;
@@ -286,18 +208,8 @@ i4biprattach()
NDBGL4(L4_DIALST, "setting dial state to ST_IDLE");
sc->sc_state = ST_IDLE;
-
-#ifdef __FreeBSD__
- sc->sc_if.if_name = "ipr";
- sc->sc_if.if_unit = i;
-#elif defined(__bsdi__)
sc->sc_if.if_name = "ipr";
sc->sc_if.if_unit = i;
-#else
- sprintf(sc->sc_if.if_xname, "ipr%d", i);
- sc->sc_if.if_softc = sc;
- sc->sc_unit = i;
-#endif
#ifdef IPR_VJ
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_SIMPLEX | IPR_AUTOCOMP;
@@ -305,10 +217,6 @@ i4biprattach()
sc->sc_if.if_flags = IFF_POINTOPOINT | IFF_SIMPLEX;
#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- callout_init(&sc->sc_callout);
-#endif
-
sc->sc_if.if_mtu = I4BIPRMTU;
sc->sc_if.if_type = IFT_ISDNBASIC;
sc->sc_if.if_ioctl = i4biprioctl;
@@ -317,10 +225,9 @@ i4biprattach()
sc->sc_if.if_snd.ifq_maxlen = I4BIPRMAXQLEN;
sc->sc_fastq.ifq_maxlen = I4BIPRMAXQLEN;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&sc->sc_fastq.ifq_mtx))
mtx_init(&sc->sc_fastq.ifq_mtx, "i4b_ipr_fastq", MTX_DEF);
-#endif
+
sc->sc_if.if_ipackets = 0;
sc->sc_if.if_ierrors = 0;
sc->sc_if.if_opackets = 0;
@@ -344,16 +251,13 @@ i4biprattach()
sc->sc_loutb = 0;
sc->sc_fn = 1;
#endif
+
#if IPR_LOG
sc->sc_log_first = IPR_LOG;
#endif
-#ifdef IPR_VJ
-#ifdef __FreeBSD__
+#ifdef IPR_VJ
sl_compress_init(&sc->sc_compr, -1);
-#else
- sl_compress_init(&sc->sc_compr);
-#endif
#ifdef IPR_VJ_USEBUFFER
if(!((sc->sc_cbuf =
@@ -370,11 +274,7 @@ i4biprattach()
if_attach(&sc->sc_if);
#if NBPFILTER > 0 || NBPF > 0
-#ifdef __FreeBSD__
bpfattach(&sc->sc_if, DLT_NULL, sizeof(u_int));
-#else
- bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_NULL, sizeof(u_int));
-#endif
#endif
}
}
@@ -394,19 +294,14 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
s = SPLI4B();
-#if defined(__FreeBSD__) || defined(__bsdi__)
unit = ifp->if_unit;
sc = &ipr_softc[unit];
-#else
- sc = ifp->if_softc;
- unit = sc->sc_unit;
-#endif
/* check for IP */
if(dst->sa_family != AF_INET)
{
- printf(IPR_FMT "af%d not supported\n", IPR_ARG(sc), dst->sa_family);
+ printf("ipr%d: af%d not supported\n", (sc)->sc_if.if_unit, dst->sa_family);
m_freem(m);
splx(s);
sc->sc_if.if_noproto++;
@@ -498,7 +393,6 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
/* check for space in choosen send queue */
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(! IF_HANDOFF(ifq, m, NULL))
{
NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit);
@@ -506,17 +400,6 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
sc->sc_if.if_oerrors++;
return(ENOBUFS);
}
-#else
- if(IF_QFULL(ifq))
- {
- NDBGL4(L4_IPRDBG, "ipr%d: send queue full!", unit);
- IF_DROP(ifq);
- m_freem(m);
- splx(s);
- sc->sc_if.if_oerrors++;
- return(ENOBUFS);
- }
-#endif
NDBGL4(L4_IPRDBG, "ipr%d: add packet to send queue!", unit);
@@ -530,20 +413,10 @@ i4biproutput(struct ifnet *ifp, struct mbuf *m, struct sockaddr *dst,
/*---------------------------------------------------------------------------*
* process ioctl
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
-static int
-i4biprioctl(struct ifnet *ifp, IOCTL_CMD_T cmd, caddr_t data)
-#else
static int
i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
-#endif
{
-#if defined(__FreeBSD__) || defined(__bsdi__)
struct ipr_softc *sc = &ipr_softc[ifp->if_unit];
-#else
- struct ipr_softc *sc = ifp->if_softc;
-#endif
-
struct ifreq *ifr = (struct ifreq *)data;
struct ifaddr *ifa = (struct ifaddr *)data;
int s;
@@ -569,11 +442,7 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
if(sc->sc_if.if_flags & IFF_RUNNING)
{
/* disconnect ISDN line */
-#if defined(__FreeBSD__) || defined(__bsdi__)
i4b_l4_drvrdisc(BDRV_IPR, ifp->if_unit);
-#else
- i4b_l4_drvrdisc(BDRV_IPR, sc->sc_unit);
-#endif
sc->sc_if.if_flags &= ~IFF_RUNNING;
}
@@ -592,7 +461,6 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
microtime(&sc->sc_if.if_lastchange);
break;
-#if !defined(__OpenBSD__)
case SIOCSIFMTU: /* set interface MTU */
if(ifr->ifr_mtu > I4BIPRMAXMTU)
error = EINVAL;
@@ -604,8 +472,6 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
microtime(&sc->sc_if.if_lastchange);
}
break;
-#endif /* __OPENBSD__ */
-
#if 0
/* not needed for FreeBSD, done in sl_compress_init() (-hm) */
@@ -617,24 +483,19 @@ i4biprioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
struct proc *p = curproc; /* XXX */
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 400005
if((error = suser(p)) != 0)
-#else
- if((error = suser(p->p_ucred, &p->p_acflag)) != 0)
-#endif
return (error);
sl_compress_setup(sc->sc_compr, *(int *)data);
}
break;
#endif
-#endif
+#endif /* #if 0 */
+
default:
error = EINVAL;
break;
}
-
splx(s);
-
return(error);
}
@@ -646,61 +507,21 @@ iprclearqueues(struct ipr_softc *sc)
{
int x;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
x = splimp();
IF_DRAIN(&sc->sc_fastq);
IF_DRAIN(&sc->sc_if.if_snd);
splx(x);
-#else
- struct mbuf *m;
-
- for(;;)
- {
- x = splimp();
- IF_DEQUEUE(&sc->sc_fastq, m);
- splx(x);
- if(m)
- m_freem(m);
- else
- break;
- }
-
- for(;;)
- {
- x = splimp();
- IF_DEQUEUE(&sc->sc_if.if_snd, m);
- splx(x);
- if(m)
- m_freem(m);
- else
- break;
- }
-#endif
}
#if I4BIPRACCT
/*---------------------------------------------------------------------------*
* watchdog routine
*---------------------------------------------------------------------------*/
-#ifdef __bsdi__
-static int
-iprwatchdog(int unit)
-{
-#else
static void
iprwatchdog(struct ifnet *ifp)
{
-#endif
-#ifdef __FreeBSD__
int unit = ifp->if_unit;
struct ipr_softc *sc = &ipr_softc[unit];
-#elif defined(__bsdi__)
- struct ipr_softc *sc = &ipr_softc[unit];
- struct ifnet *ifp = &ipr_softc[unit].sc_if;
-#else
- struct ipr_softc *sc = ifp->if_softc;
- int unit = sc->sc_unit;
-#endif
bchan_statistics_t bs;
/* get # of bytes in and out from the HSCX driver */
@@ -728,9 +549,6 @@ iprwatchdog(struct ifnet *ifp)
sc->sc_ioutb, sc->sc_iinb, ro, ri, sc->sc_outb, sc->sc_inb);
}
sc->sc_if.if_timer = I4BIPRACCTINTVL;
-#ifdef __bsdi__
- return 0;
-#endif
}
#endif /* I4BIPRACCT */
@@ -749,7 +567,7 @@ i4bipr_connect_startio(struct ipr_softc *sc)
if(sc->sc_state == ST_CONNECTED_W)
{
sc->sc_state = ST_CONNECTED_A;
- ipr_tx_queue_empty(THE_UNIT);
+ ipr_tx_queue_empty(sc->sc_if.if_unit);
}
splx(s);
@@ -847,6 +665,7 @@ ipr_disconnect(int unit, void *cdp)
#if I4BIPRACCT
sc->sc_if.if_timer = 0;
#endif
+
#if IPR_LOG
/* show next IPR_LOG packets again */
sc->sc_log_first = IPR_LOG;
@@ -907,6 +726,7 @@ ipr_rx_data_rdy(int unit)
{
register struct ipr_softc *sc = &ipr_softc[unit];
register struct mbuf *m;
+
#ifdef IPR_VJ
#ifdef IPR_VJ_USEBUFFER
u_char *cp = sc->sc_cbuf;
@@ -1047,6 +867,7 @@ error:
/* NB. do the accounting after decompression! */
sc->sc_inb += m->m_pkthdr.len;
#endif
+
#if IPR_LOG
if(sc->sc_log_first > 0)
{
@@ -1064,16 +885,10 @@ error:
mm.m_next = m;
mm.m_len = 4;
mm.m_data = (char *)&af;
-
-#ifdef __FreeBSD__
bpf_mtap(&sc->sc_if, &mm);
-#else
- bpf_mtap(sc->sc_if.if_bpf, &mm);
-#endif
}
#endif /* NBPFILTER > 0 || NBPF > 0 */
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(! IF_HANDOFF(&ipintrq, m, NULL))
{
NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit);
@@ -1084,21 +899,6 @@ error:
{
schednetisr(NETISR_IP);
}
-#else
- if(IF_QFULL(&ipintrq))
- {
- NDBGL4(L4_IPRDBG, "ipr%d: ipintrq full!", unit);
- IF_DROP(&ipintrq);
- sc->sc_if.if_ierrors++;
- sc->sc_if.if_iqdrops++;
- m_freem(m);
- }
- else
- {
- IF_ENQUEUE(&ipintrq, m);
- schednetisr(NETISR_IP);
- }
-#endif
}
/*---------------------------------------------------------------------------*
@@ -1145,12 +945,7 @@ ipr_tx_queue_empty(int unit)
mm.m_next = m;
mm.m_len = 4;
mm.m_data = (char *)&af;
-
-#ifdef __FreeBSD__
bpf_mtap(&sc->sc_if, &mm);
-#else
- bpf_mtap(sc->sc_if.if_bpf, &mm);
-#endif
}
#endif /* NBPFILTER */
@@ -1158,7 +953,7 @@ ipr_tx_queue_empty(int unit)
sc->sc_outb += m->m_pkthdr.len; /* size before compression */
#endif
-#ifdef IPR_VJ
+#ifdef IPR_VJ
if((ip = mtod(m, struct ip *))->ip_p == IPPROTO_TCP)
{
if(sc->sc_if.if_flags & IPR_COMPRESS)
diff --git a/sys/i4b/driver/i4b_isppp.c b/sys/i4b/driver/i4b_isppp.c
index 71c5acb..5a922e3 100644
--- a/sys/i4b/driver/i4b_isppp.c
+++ b/sys/i4b/driver/i4b_isppp.c
@@ -1,7 +1,7 @@
/*
* Copyright (c) 1997 Joerg Wunsch. All rights reserved.
*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -34,24 +34,17 @@
* the "cx" driver for Cronyx's HDLC-in-hardware device). This driver
* is only the glue between sppp and i4b.
*
- * $Id: i4b_isppp.c,v 1.44 2000/08/31 07:07:26 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Aug 31 09:02:27 2000]
+ * last edit-date: [Sat Mar 9 14:09:27 2002]
*
*---------------------------------------------------------------------------*/
-
-#ifndef __NetBSD__
-#endif
#include "i4bisppp.h"
-#ifndef __NetBSD__
#if NI4BISPPP == 0
# error "You need to define `device sppp <N>' with options ISPPP"
#endif
-#endif
#include <sys/param.h>
#include <sys/systm.h>
@@ -66,65 +59,33 @@
#include <net/if_types.h>
#include <net/if_sppp.h>
-
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 400008
#include "bpf.h"
-#else
-#include "bpfilter.h"
-#endif
+
#if NBPFILTER > 0 || NBPF > 0
#include <sys/time.h>
#include <net/bpf.h>
#endif
-#ifdef __FreeBSD__
#include <machine/i4b_ioctl.h>
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#include <i4b/i4b_debug.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
#include <i4b/layer4/i4b_l4.h>
-#ifdef __FreeBSD__
#define ISPPP_FMT "isp%d: "
#define ISPPP_ARG(sc) ((sc)->sc_if.if_unit)
#define PDEVSTATIC static
#define IFP2UNIT(ifp) (ifp)->if_unit
-# if __FreeBSD_version >= 300001
# define CALLOUT_INIT(chan) callout_handle_init(chan)
# define TIMEOUT(fun, arg, chan, tick) chan = timeout(fun, arg, tick)
# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg, chan)
# define IOCTL_CMD_T u_long
-# else
-# define CALLOUT_INIT(chan) do {} while(0)
-# define TIMEOUT(fun, arg, chan, tick) timeout(fun, arg, tick)
-# define UNTIMEOUT(fun, arg, chan) untimeout(fun, arg)
-# define IOCTL_CMD_T int
-# endif
-
-#elif defined __NetBSD__ || defined __OpenBSD__
-#define ISPPP_FMT "%s: "
-#define ISPPP_ARG(sc) ((sc)->sc_if.if_xname)
-#define PDEVSTATIC /* not static */
-#define IOCTL_CMD_T u_long
-#define IFP2UNIT(ifp) ((struct i4bisppp_softc *)ifp->if_softc)->sc_unit
-#else
-# error "What system are you using?"
-#endif
-#ifdef __FreeBSD__
PDEVSTATIC void i4bispppattach(void *);
PSEUDO_SET(i4bispppattach, i4b_isppp);
-#else
-PDEVSTATIC void i4bispppattach(void);
-#endif
#define I4BISPPPACCT 1 /* enable accounting messages */
#define I4BISPPPACCTINTVL 2 /* accounting msg interval in secs */
@@ -143,14 +104,10 @@ struct i4bisppp_softc {
struct ifnet scu_if;
struct sppp scu_sp;
} sc_if_un;
+
#define sc_if sc_if_un.scu_if
int sc_state; /* state of the interface */
-
-#ifndef __FreeBSD__
- int sc_unit; /* unit number for Net/OpenBSD */
-#endif
-
call_desc_t *sc_cdp; /* ptr to call descriptor */
#ifdef I4BISPPPACCT
@@ -163,10 +120,7 @@ struct i4bisppp_softc {
int sc_fn; /* flag, first null acct */
#endif
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
struct callout_handle sc_ch;
-#endif
-
} i4bisppp_softc[NI4BISPPP];
static void i4bisppp_init_linktab(int unit);
@@ -208,48 +162,25 @@ enum i4bisppp_states {
* interface attach routine at kernel boot time
*---------------------------------------------------------------------------*/
PDEVSTATIC void
-#ifdef __FreeBSD__
i4bispppattach(void *dummy)
-#else
-i4bispppattach()
-#endif
{
struct i4bisppp_softc *sc = i4bisppp_softc;
int i;
-#ifndef HACK_NO_PSEUDO_ATTACH_MSG
#ifdef SPPP_VJ
printf("i4bisppp: %d ISDN SyncPPP device(s) attached (VJ header compression)\n", NI4BISPPP);
#else
printf("i4bisppp: %d ISDN SyncPPP device(s) attached\n", NI4BISPPP);
#endif
-#endif
for(i = 0; i < NI4BISPPP; sc++, i++) {
i4bisppp_init_linktab(i);
sc->sc_if.if_softc = sc;
-
-#ifdef __FreeBSD__
sc->sc_if.if_name = "isp";
-#if defined(__FreeBSD_version) && __FreeBSD_version < 300001
- sc->sc_if.if_next = NULL;
-#endif
sc->sc_if.if_unit = i;
-#else
- sprintf(sc->sc_if.if_xname, "isp%d", i);
- sc->sc_unit = i;
-#endif
-
sc->sc_if.if_mtu = PP_MTU;
-
-#ifdef __NetBSD__
- sc->sc_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT |
- IFF_MULTICAST;
-#else
sc->sc_if.if_flags = IFF_SIMPLEX | IFF_POINTOPOINT;
-#endif
-
sc->sc_if.if_type = IFT_ISDNBASIC;
sc->sc_state = ST_IDLE;
@@ -294,21 +225,17 @@ i4bispppattach()
sc->sc_if_un.scu_sp.pp_chg = i4bisppp_state_changed;
sppp_attach(&sc->sc_if);
-#if defined(__FreeBSD_version) && ((__FreeBSD_version >= 500009) || (410000 <= __FreeBSD_version && __FreeBSD_version < 500000))
- /* do not call bpfattach in ether_ifattach */
+
+#if 0 /* ??? -hm */
ether_ifattach(&sc->sc_if, 0);
#else
if_attach(&sc->sc_if);
#endif
+ CALLOUT_INIT(&sc->sc_ch);
+
#if NBPFILTER > 0 || NBPF > 0
-#ifdef __FreeBSD__
bpfattach(&sc->sc_if, DLT_PPP, PPP_HDRLEN);
- CALLOUT_INIT(&sc->sc_ch);
-#endif /* __FreeBSD__ */
-#ifdef __NetBSD__
- bpfattach(&sc->sc_if.if_bpf, &sc->sc_if, DLT_PPP, sizeof(u_int));
-#endif
#endif
}
}
@@ -373,16 +300,9 @@ i4bisppp_start(struct ifnet *ifp)
{
#if NBPFILTER > 0 || NBPF > 0
-#ifdef __FreeBSD__
if (ifp->if_bpf)
bpf_mtap(ifp, m);
-#endif /* __FreeBSD__ */
-
-#ifdef __NetBSD__
- if (ifp->if_bpf)
- bpf_mtap(ifp->if_bpf, m);
-#endif
-#endif /* NBPFILTER > 0 || NBPF > 0 */
+#endif
microtime(&ifp->if_lastchange);
@@ -559,9 +479,9 @@ i4bisppp_connect(int unit, void *cdp)
#endif
sp->pp_up(sp); /* tell PPP we are ready */
-#ifndef __NetBSD__
+
sp->pp_last_sent = sp->pp_last_recv = SECOND;
-#endif
+
splx(s);
}
@@ -674,19 +594,10 @@ i4bisppp_rx_data_rdy(int unit)
#endif
#if NBPFILTER > 0 || NBPF > 0
-
-#ifdef __FreeBSD__
if(sc->sc_if.if_bpf)
bpf_mtap(&sc->sc_if, m);
-#endif /* __FreeBSD__ */
-
-#ifdef __NetBSD__
- if(sc->sc_if.if_bpf)
- bpf_mtap(sc->sc_if.if_bpf, m);
#endif
-#endif /* NBPFILTER > 0 || NBPF > 0 */
-
s = splimp();
sppp_input(&sc->sc_if, m);
@@ -716,15 +627,11 @@ i4bisppp_tx_queue_empty(int unit)
time_t
i4bisppp_idletime(int unit)
{
-#ifdef __NetBSD__
- return(i4bisppp_softc[unit].sc_cdp->last_active_time);
-#else
struct sppp *sp;
sp = (struct sppp *) &i4bisppp_softc[unit];
return((sp->pp_last_recv < sp->pp_last_sent) ?
sp->pp_last_sent : sp->pp_last_recv);
-#endif
}
/*---------------------------------------------------------------------------*
diff --git a/sys/i4b/driver/i4b_rbch.c b/sys/i4b/driver/i4b_rbch.c
index d701ec9..41c5536 100644
--- a/sys/i4b/driver/i4b_rbch.c
+++ b/sys/i4b/driver/i4b_rbch.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jan 12 14:32:16 2001]
+ * last edit-date: [Sun Mar 17 09:51:03 2002]
*
*---------------------------------------------------------------------------*/
@@ -39,45 +39,23 @@
#include <sys/param.h>
#include <sys/systm.h>
-
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/kernel.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
-#include <net/if.h>
+#include <sys/filio.h>
#include <sys/tty.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#if defined (__NetBSD__) || defined (__OpenBSD__)
-extern cc_t ttydefchars;
-#define termioschars(t) memcpy((t)->c_cc, &ttydefchars, sizeof((t)->c_cc))
-#endif
-
-#ifdef __FreeBSD__
+#include <net/if.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
-#endif /* __FreeBSD__ */
-
-#ifdef __NetBSD__
-#include <sys/filio.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_ioctl.h>
#include <machine/i4b_rbch_ioctl.h>
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_rbch_ioctl.h>
-#include <i4b/i4b_debug.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_mbuf.h>
@@ -85,21 +63,8 @@ extern cc_t ttydefchars;
#include <i4b/layer4/i4b_l4.h>
-#ifdef __bsdi__
-#include <sys/device.h>
-#endif
-
-#ifdef OS_USES_POLL
#include <sys/ioccom.h>
#include <sys/poll.h>
-#else
-#include <sys/fcntl.h>
-#include <sys/ioctl.h>
-#endif
-
-#if defined(__FreeBSD__)
-#include <sys/filio.h>
-#endif
static drvr_link_t rbch_drvr_linktab[NI4BRBCH];
static isdn_link_t *isdn_linktab[NI4BRBCH];
@@ -108,7 +73,6 @@ static isdn_link_t *isdn_linktab[NI4BRBCH];
#define I4BRBCHACCTINTVL 2 /* accounting msg interval in secs */
static struct rbch_softc {
-
int sc_unit; /* unit number */
int sc_devstate; /* state of driver */
@@ -120,9 +84,7 @@ static struct rbch_softc {
#define ST_NOBLOCK 0x10
int sc_bprot; /* B-ch protocol used */
-
call_desc_t *sc_cd; /* Call Descriptor */
-
struct termios it_in;
struct ifqueue sc_hdlcq; /* hdlc read queue */
@@ -131,13 +93,7 @@ static struct rbch_softc {
struct selinfo selp; /* select / poll */
#if I4BRBCHACCT
-#if defined(__FreeBSD__)
struct callout_handle sc_callout;
-#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- struct callout sc_callout;
-#endif
-
int sc_iinb; /* isdn driver # of inbytes */
int sc_ioutb; /* isdn driver # of outbytes */
int sc_linb; /* last # of bytes rx'd */
@@ -153,39 +109,12 @@ static void rbch_disconnect(int unit, void *cdp);
static void rbch_init_linktab(int unit);
static void rbch_clrq(int unit);
-#ifndef __FreeBSD__
-#define PDEVSTATIC /* - not static - */
-#define IOCTL_CMD_T u_long
-void i4brbchattach __P((void));
-int i4brbchopen __P((dev_t dev, int flag, int fmt, struct thread *td));
-int i4brbchclose __P((dev_t dev, int flag, int fmt, struct thread *td));
-int i4brbchread __P((dev_t dev, struct uio *uio, int ioflag));
-int i4brbchwrite __P((dev_t dev, struct uio *uio, int ioflag));
-int i4brbchioctl __P((dev_t dev, IOCTL_CMD_T cmd, caddr_t arg, int flag, struct thread *td));
-#ifdef OS_USES_POLL
-int i4brbchpoll __P((dev_t dev, int events, struct thread *td));
-#else
-PDEVSTATIC int i4brbchselect __P((dev_t dev, int rw, struct thread *td));
-#endif
-#endif
-
-#if BSD > 199306 && defined(__FreeBSD__)
-#define PDEVSTATIC static
-#define IOCTL_CMD_T u_long
-
-PDEVSTATIC d_open_t i4brbchopen;
-PDEVSTATIC d_close_t i4brbchclose;
-PDEVSTATIC d_read_t i4brbchread;
-PDEVSTATIC d_read_t i4brbchwrite;
-PDEVSTATIC d_ioctl_t i4brbchioctl;
-
-#ifdef OS_USES_POLL
-PDEVSTATIC d_poll_t i4brbchpoll;
-#define POLLFIELD i4brbchpoll
-#else
-PDEVSTATIC d_select_t i4brbchselect;
-#define POLLFIELD i4brbchselect
-#endif
+static d_open_t i4brbchopen;
+static d_close_t i4brbchclose;
+static d_read_t i4brbchread;
+static d_read_t i4brbchwrite;
+static d_ioctl_t i4brbchioctl;
+static d_poll_t i4brbchpoll;
#define CDEV_MAJOR 57
@@ -195,7 +124,7 @@ static struct cdevsw i4brbch_cdevsw = {
/* read */ i4brbchread,
/* write */ i4brbchwrite,
/* ioctl */ i4brbchioctl,
- /* poll */ POLLFIELD,
+ /* poll */ i4brbchpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "i4brbch",
@@ -224,76 +153,32 @@ i4brbchinit(void *unused)
SYSINIT(i4brbchdev, SI_SUB_DRIVERS,
SI_ORDER_MIDDLE+CDEV_MAJOR, &i4brbchinit, NULL);
-#endif /* BSD > 199306 && defined(__FreeBSD__) */
-
-#ifdef __bsdi__
-int i4brbchmatch(struct device *parent, struct cfdata *cf, void *aux);
-void dummy_i4brbchattach(struct device*, struct device *, void *);
-
-#define CDEV_MAJOR 61
-
-static struct cfdriver i4brbchcd =
- { NULL, "i4brbch", i4brbchmatch, dummy_i4brbchattach, DV_DULL,
- sizeof(struct cfdriver) };
-struct devsw i4brbchsw =
- { &i4brbchcd,
- i4brbchopen, i4brbchclose, i4brbchread, i4brbchwrite,
- i4brbchioctl, seltrue, nommap, nostrat,
- nodump, nopsize, 0, nostop
-};
-
-int
-i4brbchmatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- printf("i4brbchmatch: aux=0x%x\n", aux);
- return 1;
-}
-void
-dummy_i4brbchattach(struct device *parent, struct device *self, void *aux)
-{
- printf("dummy_i4brbchattach: aux=0x%x\n", aux);
-}
-#endif /* __bsdi__ */
-
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
-#ifdef __FreeBSD__
+static void
i4brbchattach(void *dummy)
-#else
-i4brbchattach()
-#endif
{
int i;
-#ifndef HACK_NO_PSEUDO_ATTACH_MSG
printf("i4brbch: %d raw B channel access device(s) attached\n", NI4BRBCH);
-#endif
for(i=0; i < NI4BRBCH; i++)
{
-#if defined(__FreeBSD__)
make_dev(&i4brbch_cdevsw, i,
UID_ROOT, GID_WHEEL, 0600, "i4brbch%d", i);
-#endif
#if I4BRBCHACCT
-#if defined(__FreeBSD__)
callout_handle_init(&rbch_softc[i].sc_callout);
-#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- callout_init(&rbch_softc[i].sc_callout);
-#endif
rbch_softc[i].sc_fn = 1;
#endif
rbch_softc[i].sc_unit = i;
rbch_softc[i].sc_devstate = ST_IDLE;
rbch_softc[i].sc_hdlcq.ifq_maxlen = I4BRBCHMAXQLEN;
-#if defined(__FreeBSD__) && __FreeBSD__ > 4
+
if(!mtx_initialized(&rbch_softc[i].sc_hdlcq.ifq_mtx))
mtx_init(&rbch_softc[i].sc_hdlcq.ifq_mtx, "i4b_rbch", MTX_DEF);
-#endif
+
rbch_softc[i].it_in.c_ispeed = rbch_softc[i].it_in.c_ospeed = 64000;
termioschars(&rbch_softc[i].it_in);
rbch_init_linktab(i);
@@ -303,7 +188,7 @@ i4brbchattach()
/*---------------------------------------------------------------------------*
* open rbch device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4brbchopen(dev_t dev, int flag, int fmt, struct thread *td)
{
int unit = minor(dev);
@@ -328,7 +213,7 @@ i4brbchopen(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* close rbch device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4brbchclose(dev_t dev, int flag, int fmt, struct thread *td)
{
int unit = minor(dev);
@@ -349,7 +234,7 @@ i4brbchclose(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* read from rbch device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4brbchread(dev_t dev, struct uio *uio, int ioflag)
{
struct mbuf *m;
@@ -451,7 +336,7 @@ i4brbchread(dev_t dev, struct uio *uio, int ioflag)
/*---------------------------------------------------------------------------*
* write to rbch device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
{
struct mbuf *m;
@@ -556,14 +441,8 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
error = uiomove(m->m_data, m->m_len, uio);
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
(void) IF_HANDOFF(isdn_linktab[unit]->tx_queue, m, NULL);
-#else
- if(IF_QFULL(isdn_linktab[unit]->tx_queue))
- m_freem(m);
- else
- IF_ENQUEUE(isdn_linktab[unit]->tx_queue, m);
-#endif
+
(*isdn_linktab[unit]->bch_tx_start)(isdn_linktab[unit]->unit, isdn_linktab[unit]->channel);
}
@@ -575,8 +454,8 @@ i4brbchwrite(dev_t dev, struct uio * uio, int ioflag)
/*---------------------------------------------------------------------------*
* rbch device ioctl handlibg
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct thread *td)
+static int
+i4brbchioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int error = 0;
int unit = minor(dev);
@@ -669,12 +548,10 @@ i4brbchioctl(dev_t dev, IOCTL_CMD_T cmd, caddr_t data, int flag, struct thread *
return(error);
}
-#ifdef OS_USES_POLL
-
/*---------------------------------------------------------------------------*
* device driver poll
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4brbchpoll(dev_t dev, int events, struct thread *td)
{
int revents = 0; /* Events we found */
@@ -727,66 +604,6 @@ i4brbchpoll(dev_t dev, int events, struct thread *td)
return(revents);
}
-#else /* OS_USES_POLL */
-
-/*---------------------------------------------------------------------------*
- * device driver select
- *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4brbchselect(dev_t dev, int rw, struct thread *td)
-{
- int unit = minor(dev);
- struct rbch_softc *sc = &rbch_softc[unit];
- int s;
-
- s = splhigh();
-
- if(!(sc->sc_devstate & ST_ISOPEN))
- {
- splx(s);
- NDBGL4(L4_RBCHDBG, "unit %d, not open anymore", unit);
- return(1);
- }
-
- if(sc->sc_devstate & ST_CONNECTED)
- {
- struct ifqueue *iqp;
-
- switch(rw)
- {
- case FREAD:
- if(sc->sc_bprot == BPROT_RHDLC)
- iqp = &sc->sc_hdlcq;
- else
- iqp = isdn_linktab[unit]->rx_queue;
-
- if(!IF_QEMPTY(iqp))
- {
- splx(s);
- return(1);
- }
- break;
-
- case FWRITE:
- if(!_IF_QFULL(isdn_linktab[unit]->rx_queue))
- {
- splx(s);
- return(1);
- }
- break;
-
- default:
- splx(s);
- return 0;
- }
- }
- selrecord(p, &sc->selp);
- splx(s);
- return(0);
-}
-
-#endif /* OS_USES_POLL */
-
#if I4BRBCHACCT
/*---------------------------------------------------------------------------*
* watchdog routine
@@ -928,22 +745,10 @@ rbch_rx_data_rdy(int unit)
m->m_pkthdr.len = m->m_len;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if (! IF_HANDOFF(&(rbch_softc[unit].sc_hdlcq), m, NULL))
{
NDBGL4(L4_RBCHDBG, "unit %d: hdlc rx queue full!", unit);
}
-#else
- if(IF_QFULL(&(rbch_softc[unit].sc_hdlcq)))
- {
- NDBGL4(L4_RBCHDBG, "unit %d: hdlc rx queue full!", unit);
- m_freem(m);
- }
- else
- {
- IF_ENQUEUE(&(rbch_softc[unit].sc_hdlcq), m);
- }
-#endif
}
if(rbch_softc[unit].sc_devstate & ST_RDWAITDATA)
@@ -1000,24 +805,9 @@ rbch_clrq(int unit)
{
CRIT_VAR;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
CRIT_BEG;
IF_DRAIN(&rbch_softc[unit].sc_hdlcq);
CRIT_END;
-#else
- struct mbuf *m;
- for(;;)
- {
- CRIT_BEG;
- IF_DEQUEUE(&rbch_softc[unit].sc_hdlcq, m);
- CRIT_END;
-
- if(m)
- m_freem(m);
- else
- break;
- }
-#endif
}
/*---------------------------------------------------------------------------*
diff --git a/sys/i4b/driver/i4b_tel.c b/sys/i4b/driver/i4b_tel.c
index 877b560..92cf3f7 100644
--- a/sys/i4b/driver/i4b_tel.c
+++ b/sys/i4b/driver/i4b_tel.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:24:50 2001]
+ * last edit-date: [Sun Mar 17 09:52:06 2002]
*
*---------------------------------------------------------------------------*/
@@ -41,10 +41,8 @@
#include <sys/param.h>
#include <sys/systm.h>
-
#include <sys/ioccom.h>
#include <sys/poll.h>
-
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/kernel.h>
@@ -134,21 +132,12 @@ static unsigned char u2a_tab[];
static unsigned char bitreverse[];
static u_char sinetab[];
-#define PDEVSTATIC static
-
-PDEVSTATIC d_open_t i4btelopen;
-PDEVSTATIC d_close_t i4btelclose;
-PDEVSTATIC d_read_t i4btelread;
-PDEVSTATIC d_read_t i4btelwrite;
-PDEVSTATIC d_ioctl_t i4btelioctl;
-
-#ifdef OS_USES_POLL
-PDEVSTATIC d_poll_t i4btelpoll;
-#define POLLFIELD i4btelpoll
-#else
-PDEVSTATIC d_select_t i4btelsel;
-#define POLLFIELD i4btelsel
-#endif
+static d_open_t i4btelopen;
+static d_close_t i4btelclose;
+static d_read_t i4btelread;
+static d_read_t i4btelwrite;
+static d_ioctl_t i4btelioctl;
+static d_poll_t i4btelpoll;
#define CDEV_MAJOR 56
@@ -158,7 +147,7 @@ static struct cdevsw i4btel_cdevsw = {
/* read */ i4btelread,
/* write */ i4btelwrite,
/* ioctl */ i4btelioctl,
- /* poll */ POLLFIELD,
+ /* poll */ i4btelpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "i4btel",
@@ -168,8 +157,8 @@ static struct cdevsw i4btel_cdevsw = {
/* flags */ 0,
};
-PDEVSTATIC void i4btelinit(void *unused);
-PDEVSTATIC void i4btelattach(void *);
+static void i4btelinit(void *unused);
+static void i4btelattach(void *);
PSEUDO_SET(i4btelattach, i4b_tel);
@@ -180,7 +169,7 @@ PSEUDO_SET(i4btelattach, i4b_tel);
/*---------------------------------------------------------------------------*
* initialization at kernel load time
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
+static void
i4btelinit(void *unused)
{
cdevsw_add(&i4btel_cdevsw);
@@ -192,7 +181,7 @@ SYSINIT(i4bteldev, SI_SUB_DRIVERS,
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
+static void
i4btelattach(void *dummy)
{
int i, j;
@@ -231,7 +220,7 @@ i4btelattach(void *dummy)
/*---------------------------------------------------------------------------*
* open tel device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelopen(dev_t dev, int flag, int fmt, struct thread *td)
{
int unit = UNIT(dev);
@@ -260,7 +249,7 @@ i4btelopen(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* close tel device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelclose(dev_t dev, int flag, int fmt, struct thread *td)
{
int unit = UNIT(dev);
@@ -303,7 +292,7 @@ i4btelclose(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* i4btelioctl - device driver ioctl routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
{
int unit = UNIT(dev);
@@ -425,7 +414,7 @@ i4btelioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
/*---------------------------------------------------------------------------*
* read from tel device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelread(dev_t dev, struct uio *uio, int ioflag)
{
int unit = UNIT(dev);
@@ -453,16 +442,10 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
NDBGL4(L4_TELDBG, "i4btel%d, queue empty!", unit);
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if((error = msleep((caddr_t) &sc->isdn_linktab->rx_queue,
&sc->isdn_linktab->rx_queue->ifq_mtx,
TTIPRI | PCATCH,
"rtel", 0 )) != 0)
-#else
- if((error = tsleep((caddr_t) &sc->isdn_linktab->rx_queue,
- TTIPRI | PCATCH,
- "rtel", 0 )) != 0)
-#endif
{
sc->devstate &= ~ST_RDWAITDATA;
IF_UNLOCK(sc->isdn_linktab->rx_queue);
@@ -558,7 +541,7 @@ i4btelread(dev_t dev, struct uio *uio, int ioflag)
/*---------------------------------------------------------------------------*
* write to tel device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
{
int unit = UNIT(dev);
@@ -589,14 +572,9 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
{
sc->devstate |= ST_WRWAITEMPTY;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if((error = msleep((caddr_t) &sc->isdn_linktab->tx_queue,
&sc->isdn_linktab->tx_queue->ifq_mtx,
TTIPRI | PCATCH, "wtel", 0)) != 0)
-#else
- if((error = tsleep((caddr_t) &sc->isdn_linktab->tx_queue,
- TTIPRI | PCATCH, "wtel", 0)) != 0)
-#endif
{
sc->devstate &= ~ST_WRWAITEMPTY;
IF_UNLOCK(sc->isdn_linktab->tx_queue);
@@ -635,15 +613,7 @@ i4btelwrite(dev_t dev, struct uio * uio, int ioflag)
/* always reverse bitorder to line */
mtod(m,u_char *)[i] = bitreverse[mtod(m,u_char *)[i]];
}
-
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
(void) IF_HANDOFF(sc->isdn_linktab->tx_queue, m, NULL);
-#else
- if(IF_QFULL(sc->isdn_linktab->tx_queue))
- m_freem(m);
- else
- IF_ENQUEUE(sc->isdn_linktab->tx_queue, m);
-#endif
(*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel);
}
@@ -728,12 +698,10 @@ tel_tone(tel_sc_t *sc)
(*sc->isdn_linktab->bch_tx_start)(sc->isdn_linktab->unit, sc->isdn_linktab->channel);
}
-
-#ifdef OS_USES_POLL
/*---------------------------------------------------------------------------*
* device driver poll
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btelpoll(dev_t dev, int events, struct thread *td)
{
int revents = 0; /* Events we found */
@@ -810,85 +778,6 @@ i4btelpoll(dev_t dev, int events, struct thread *td)
return(revents);
}
-#else /* OS_USES_POLL */
-
-/*---------------------------------------------------------------------------*
- * device driver select
- *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4btelsel(dev_t dev, int rw, struct thread *td)
-{
- int s;
- int unit = UNIT(dev);
- int func = FUNC(dev);
-
- tel_sc_t *sc = &tel_sc[unit][func];
-
- s = splhigh();
-
- if (!(sc->devstate & ST_ISOPEN))
- {
- NDBGL4(L4_TELDBG, "i4btel%d, !ST_ISOPEN", unit);
- splx(s);
- return(0);
- }
-
- if (func == FUNCTEL)
- {
- /* Don't even bother if we're not connected */
- if (!(sc->devstate & ST_CONNECTED) || sc->isdn_linktab == NULL)
- {
- splx(s);
- return 0;
- }
-
- if (rw == FREAD)
- {
- if (!IF_QEMPTY(sc->isdn_linktab->rx_queue))
- {
- NDBGL4(L4_TELDBG, "i4btel%d, FREAD", unit);
- splx(s);
- return 1;
- }
- }
- else if (rw == FWRITE)
- {
- if (!_IF_QFULL(sc->isdn_linktab->tx_queue))
- {
- NDBGL4(L4_TELDBG, "i4btel%d, FWRITE", unit);
- splx(s);
- return 1;
- }
- }
- }
- else if (func == FUNCDIAL)
- {
- if (rw == FWRITE)
- {
- NDBGL4(L4_TELDBG, "i4bteld%d, FWRITE", unit);
- splx(s);
- return 1;
- }
-
- if (rw == FREAD)
- {
- NDBGL4(L4_TELDBG, "i4bteld%d, FREAD, result = %d", unit, sc->result);
- if (sc->result != 0)
- {
- splx(s);
- return 1;
- }
- }
- }
-
- NDBGL4(L4_TELDBG, "i4bteld%d, selrecord", unit);
- selrecord(td, &sc->selp);
- splx(s);
- return 0;
-}
-
-#endif /* OS_USES_POLL */
-
/*===========================================================================*
* ISDN INTERFACE ROUTINES
*===========================================================================*/
diff --git a/sys/i4b/driver/i4b_trace.c b/sys/i4b/driver/i4b_trace.c
index 81a5385..20bbbf2 100644
--- a/sys/i4b/driver/i4b_trace.c
+++ b/sys/i4b/driver/i4b_trace.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
* i4btrc - device driver for trace data read device
* ---------------------------------------------------
*
- * last edit-date: [Fri Jan 12 14:18:12 2001]
+ * last edit-date: [Sun Mar 17 09:52:51 2002]
*
* $FreeBSD$
*
@@ -41,13 +41,7 @@
#include <sys/param.h>
#include <sys/systm.h>
-
-#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#include <sys/ioccom.h>
-#else
-#include <sys/ioctl.h>
-#endif
-
#include <sys/conf.h>
#include <sys/uio.h>
#include <sys/kernel.h>
@@ -56,8 +50,6 @@
#include <net/if.h>
#include <sys/tty.h>
-#ifdef __FreeBSD__
-
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
@@ -65,67 +57,27 @@
#include <machine/i4b_trace.h>
#include <machine/i4b_ioctl.h>
-#else
-
-#include <i4b/i4b_trace.h>
-#include <i4b/i4b_ioctl.h>
-
-#endif
-
#include <i4b/include/i4b_mbuf.h>
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
-#ifndef __FreeBSD__
-#define memcpy(d,s,l) bcopy(s,d,l)
-#endif
-
static struct ifqueue trace_queue[NI4BTRC];
+
static int device_state[NI4BTRC];
#define ST_IDLE 0x00
#define ST_ISOPEN 0x01
#define ST_WAITDATA 0x02
-#if defined(__FreeBSD__) && __FreeBSD__ == 3
-#ifdef DEVFS
-static void *devfs_token[NI4BTRC];
-#endif
-#endif
-
static int analyzemode = 0;
static int rxunit = -1;
static int txunit = -1;
static int outunit = -1;
-#ifndef __FreeBSD__
-
-#define PDEVSTATIC /* - not static - */
-void i4btrcattach __P((void));
-int i4btrcopen __P((dev_t dev, int flag, int fmt, struct thread *td));
-int i4btrcclose __P((dev_t dev, int flag, int fmt, struct thread *td));
-int i4btrcread __P((dev_t dev, struct uio * uio, int ioflag));
-
-#ifdef __bsdi__
-int i4btrcioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td));
-#else
-int i4btrcioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct thread *td));
-#endif
-
-#endif
-
-#if BSD > 199306 && defined(__FreeBSD__)
-#define PDEVSTATIC static
static d_open_t i4btrcopen;
static d_close_t i4btrcclose;
static d_read_t i4btrcread;
static d_ioctl_t i4btrcioctl;
-
-#ifdef OS_USES_POLL
static d_poll_t i4btrcpoll;
-#define POLLFIELD i4btrcpoll
-#else
-#define POLLFIELD noselect
-#endif
#define CDEV_MAJOR 59
@@ -135,7 +87,7 @@ static struct cdevsw i4btrc_cdevsw = {
/* read */ i4btrcread,
/* write */ nowrite,
/* ioctl */ i4btrcioctl,
- /* poll */ POLLFIELD,
+ /* poll */ i4btrcpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "i4btrc",
@@ -160,49 +112,13 @@ SYSINIT(i4btrcdev, SI_SUB_DRIVERS,
static void i4btrcattach(void *);
PSEUDO_SET(i4btrcattach, i4b_trace);
-#endif /* BSD > 199306 && defined(__FreeBSD__) */
-
-#ifdef __bsdi__
-#include <sys/device.h>
-int i4btrcmatch(struct device *parent, struct cfdata *cf, void *aux);
-void dummy_i4btrcattach(struct device*, struct device *, void *);
-
-#define CDEV_MAJOR 60
-
-static struct cfdriver i4btrccd =
- { NULL, "i4btrc", i4btrcmatch, dummy_i4btrcattach, DV_DULL,
- sizeof(struct cfdriver) };
-struct devsw i4btrcsw =
- { &i4btrccd,
- i4btrcopen, i4btrcclose, i4btrcread, nowrite,
- i4btrcioctl, seltrue, nommap, nostrat,
- nodump, nopsize, 0, nostop
-};
-
-int
-i4btrcmatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- printf("i4btrcmatch: aux=0x%x\n", aux);
- return 1;
-}
-void
-dummy_i4btrcattach(struct device *parent, struct device *self, void *aux)
-{
- printf("dummy_i4btrcattach: aux=0x%x\n", aux);
-}
-#endif /* __bsdi__ */
-
int get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf);
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
-#ifdef __FreeBSD__
+static void
i4btrcattach(void *dummy)
-#else
-i4btrcattach()
-#endif
{
int i;
@@ -210,17 +126,13 @@ i4btrcattach()
for(i=0; i < NI4BTRC; i++)
{
-
-#if defined(__FreeBSD__)
make_dev(&i4btrc_cdevsw, i,
UID_ROOT, GID_WHEEL, 0600, "i4btrc%d", i);
-#endif
trace_queue[i].ifq_maxlen = IFQ_MAXLEN;
-#if __FreeBSD__ > 4
if(!mtx_initialized(&trace_queue[i].ifq_mtx))
mtx_init(&trace_queue[i].ifq_mtx, "i4b_trace", MTX_DEF);
-#endif
+
device_state[i] = ST_IDLE;
}
}
@@ -294,6 +206,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf)
}
IF_LOCK(&trace_queue[unit]);
+
if(_IF_QFULL(&trace_queue[unit]))
{
struct mbuf *m1;
@@ -333,7 +246,7 @@ get_trace_data_from_l1(i4b_trace_hdr_t *hdr, int len, char *buf)
/*---------------------------------------------------------------------------*
* open trace device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td)
{
int x;
@@ -360,7 +273,7 @@ i4btrcopen(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* close trace device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td)
{
int unit = minor(dev);
@@ -406,7 +319,7 @@ i4btrcclose(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* read from trace device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btrcread(dev_t dev, struct uio * uio, int ioflag)
{
struct mbuf *m;
@@ -420,20 +333,15 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag)
x = SPLI4B();
IF_LOCK(&trace_queue[unit]);
+
while(IF_QEMPTY(&trace_queue[unit]) && (device_state[unit] & ST_ISOPEN))
{
device_state[unit] |= ST_WAITDATA;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if((error = msleep((caddr_t) &trace_queue[unit],
&trace_queue[unit].ifq_mtx,
TTIPRI | PCATCH,
"bitrc", 0 )) != 0)
-#else
- if((error = tsleep((caddr_t) &trace_queue[unit],
- TTIPRI | PCATCH,
- "bitrc", 0 )) != 0)
-#endif
{
device_state[unit] &= ~ST_WAITDATA;
IF_UNLOCK(&trace_queue[unit]);
@@ -458,28 +366,20 @@ i4btrcread(dev_t dev, struct uio * uio, int ioflag)
return(error);
}
-#if defined(__FreeBSD__) && defined(OS_USES_POLL)
/*---------------------------------------------------------------------------*
* poll device
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4btrcpoll(dev_t dev, int events, struct thread *td)
{
return(ENODEV);
}
-#endif
/*---------------------------------------------------------------------------*
* device driver ioctl routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
-#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
+static int
i4btrcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#elif defined(__bsdi__)
-i4btrcioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#else
-i4btrcioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
-#endif
{
int error = 0;
int unit = minor(dev);
diff --git a/sys/i4b/include/i4b_cause.h b/sys/i4b/include/i4b_cause.h
index 36c6142..c98683a 100644
--- a/sys/i4b/include/i4b_cause.h
+++ b/sys/i4b/include/i4b_cause.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_cause.h - causes and cause handling for i4b
* -----------------------------------------------
*
- * $Id: i4b_cause.h,v 1.13 2000/02/06 19:01:14 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Sun Feb 6 19:46:41 2000]
+ * last edit-date: [Sun Mar 17 10:08:21 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_debug.h b/sys/i4b/include/i4b_debug.h
index 084623a..ac8f6a8 100644
--- a/sys/i4b/include/i4b_debug.h
+++ b/sys/i4b/include/i4b_debug.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Mon May 21 10:05:34 2001]
+ * last edit-date: [Sun Mar 17 10:08:41 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_global.h b/sys/i4b/include/i4b_global.h
index f2e9bff..c245277 100644
--- a/sys/i4b/include/i4b_global.h
+++ b/sys/i4b/include/i4b_global.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Mon Jan 15 15:47:40 2001]
+ * last edit-date: [Sun Mar 17 09:55:26 2002]
*
*---------------------------------------------------------------------------*/
@@ -40,25 +40,6 @@
* hiding OS differences in the kernel
*---------------------------------------------------------------------------*/
-/*-------------------------------------------------*/
-/* hide SMP changes in FreeBSD 5.x-current for 4.x */
-/*-------------------------------------------------*/
-
-#if defined(__FreeBSD__) && __FreeBSD__ <= 4
-
-#define IF_LOCK(a)
-#define IF_UNLOCK(a)
-#define _IF_QFULL(a) IF_QFULL((a))
-#define _IF_ENQUEUE(a, b) IF_ENQUEUE((a), (b))
-#define _IF_DEQUEUE(a, b) IF_DEQUEUE((a), (b))
-#define _IF_PREPEND(a, b) IF_PREPEND((a), (b))
-
-/* get back DELAY() */
-
-#include <machine/clock.h>
-
-#endif
-
#if defined(__FreeBSD__) && __FreeBSD__ >= 5
/*
* Deprecated LKM interface.
@@ -91,71 +72,18 @@
/* time handling */
/*---------------*/
-#ifdef __FreeBSD__
#include <sys/param.h>
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 400000 && __FreeBSD_version < 400011
-#error "Unsupported FreeBSD-current version,"
-#error "you need a FreeBSD-current >= 400011"
-#endif
-
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
-
#define TIMEOUT_FUNC_T timeout_t *
#define SECOND time_second
#define MICROTIME(x) getmicrotime(&(x))
-#else /* FreeBSD < 3 */
-
-#define TIMEOUT_FUNC_T timeout_func_t
-#define SECOND time.tv_sec
-#define MICROTIME(x) microtime(&(x))
-
-#endif /* >= 3 */
-#endif /* __FreeBSD__ */
-
-#if defined(__NetBSD__) || defined (__OpenBSD__) || defined(__bsdi__)
-
-#define TIMEOUT_FUNC_T void *
-#define SECOND time.tv_sec
-#define MICROTIME(x) (x) = time
-
-#endif /* __NetBSD__ */
-
/*----------------*/
/* timer handling */
/*----------------*/
-#if defined(__NetBSD__)
-
-#if __NetBSD_Version__ >= 104230000
-#define START_TIMER(XHANDLE, XF, XSC, XTIME) callout_reset(&XHANDLE, XTIME, (TIMEOUT_FUNC_T)XF, (void*)XSC)
-#define STOP_TIMER(XHANDLE, XF, XSC) callout_stop(&XHANDLE)
-#else
-#define START_TIMER(XHANDLE, XF, XSC, XTIME) timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
-#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
-#endif
-
-#else
#define START_TIMER(XHANDLE, XF, XSC, XTIME) XHANDLE = timeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XTIME)
-#ifdef __FreeBSD__
#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC, XHANDLE)
-#else
-#define STOP_TIMER(XHANDLE, XF, XSC) untimeout((TIMEOUT_FUNC_T)XF, (void*)XSC)
-#endif
-#endif
-
-/*----------------------*/
-/* poll/select handling */
-/*----------------------*/
-
-#if (defined(__FreeBSD__) && \
- (!defined(__FreeBSD_version) || (__FreeBSD_version < 300001))) \
- || defined (__OpenBSD__) || defined(__bsdi__)
-#define OS_USES_SELECT
-#else
-#define OS_USES_POLL
-#endif
/*---------------------------------------------------------------------------*
* misc globally used things in the kernel
diff --git a/sys/i4b/include/i4b_ioctl.h b/sys/i4b/include/i4b_ioctl.h
index 4d5b913..561a131 100644
--- a/sys/i4b/include/i4b_ioctl.h
+++ b/sys/i4b/include/i4b_ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,18 +29,20 @@
*
* $FreeBSD$
*
- * last edit-date: [Sun Oct 21 11:00:31 2001]
+ * last edit-date: [Sun Mar 17 10:09:55 2002]
*
*---------------------------------------------------------------------------*/
#ifndef _I4B_IOCTL_H_
#define _I4B_IOCTL_H_
+#if 0
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
#ifndef _MACHINE_TYPES_H_
#include <machine/types.h>
#endif /* _MACHINE_TYPES_H_ */
#endif /* __FreeBSD__ */
+#endif
/*---------------------------------------------------------------------------*
* version and release number for isdn4bsd package
diff --git a/sys/i4b/include/i4b_isdnq931.h b/sys/i4b/include/i4b_isdnq931.h
index 19ef428..94f1291 100644
--- a/sys/i4b/include/i4b_isdnq931.h
+++ b/sys/i4b/include/i4b_isdnq931.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_isdnq931.h - DSS1 layer 3 message types
* -------------------------------------------
*
- * $Id: i4b_isdnq931.h,v 1.7 2000/04/27 07:42:43 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Apr 27 09:46:13 2000]
+ * last edit-date: [Sat Mar 9 15:53:49 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_l1l2.h b/sys/i4b/include/i4b_l1l2.h
index 4a8ccba..be45c07 100644
--- a/sys/i4b/include/i4b_l1l2.h
+++ b/sys/i4b/include/i4b_l1l2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,22 +27,16 @@
* i4b_l1l2.h - i4b layer 1 / layer 2 interactions
* ---------------------------------------------------
*
- * $Id: i4b_l1l2.h,v 1.11 2000/06/02 16:14:35 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Jun 2 14:35:03 2000]
+ * last edit-date: [Sat Mar 9 15:54:49 2002]
*
*---------------------------------------------------------------------------*/
#ifndef _I4B_L1L2_H_
#define _I4B_L1L2_H_
-#ifdef __FreeBSD__
#include <machine/i4b_trace.h>
-#else
-#include <i4b/i4b_trace.h>
-#endif
extern struct i4b_l1l2_func i4b_l1l2_func;
@@ -93,4 +87,3 @@ struct i4b_l1l2_func
};
#endif /* _I4B_L1L2_H_ */
-
diff --git a/sys/i4b/include/i4b_l2l3.h b/sys/i4b/include/i4b_l2l3.h
index 6e0e197..19a6990 100644
--- a/sys/i4b/include/i4b_l2l3.h
+++ b/sys/i4b/include/i4b_l2l3.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l2l3.h - i4b layer 2 / layer 3 interactions
* -----------------------------------------------
*
- * $Id: i4b_l2l3.h,v 1.8 2000/06/02 16:14:35 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Jun 2 14:33:34 2000]
+ * last edit-date: [Sat Mar 9 15:55:16 2002]
*
*---------------------------------------------------------------------------*/
@@ -115,4 +113,3 @@ struct i4b_l2l3_func
};
#endif /* _I4B_L2L3_H_ */
-
diff --git a/sys/i4b/include/i4b_l3l4.h b/sys/i4b/include/i4b_l3l4.h
index 64617a2..b4da38a 100644
--- a/sys/i4b/include/i4b_l3l4.h
+++ b/sys/i4b/include/i4b_l3l4.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:26:16 2001]
+ * last edit-date: [Sat Mar 9 15:57:44 2002]
*
*---------------------------------------------------------------------------*/
@@ -113,13 +113,6 @@ void tel_set_linktab(int unit, isdn_link_t *ilt);
drvr_link_t *i4bisppp_ret_linktab(int unit);
void i4bisppp_set_linktab(int unit, isdn_link_t *ilt);
-#ifdef __bsdi__
-/* global linktab functions for IBC userland driver */
-
-drvr_link_t *ibc_ret_linktab(int unit);
-void ibc_set_linktab(int unit, isdn_link_t *ilt);
-#endif
-
/* global linktab functions for ING network driver */
drvr_link_t *ing_ret_linktab(int unit);
@@ -189,8 +182,7 @@ typedef struct
int timeout_active; /* idle timeout() active flag */
-#if (defined(__FreeBSD_version) && __FreeBSD_version >= 300001) || \
- (!defined(__FreeBSD_version) && defined(__FreeBSD__) && __FreeBSD__ >= 3)
+ int callouts_inited; /* must init before use */
struct callout_handle idle_timeout_handle;
struct callout_handle T303_callout;
struct callout_handle T305_callout;
@@ -199,19 +191,6 @@ typedef struct
struct callout_handle T310_callout;
struct callout_handle T313_callout;
struct callout_handle T400_callout;
- int callouts_inited; /* must init before use */
-#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- struct callout idle_timeout_handle;
- struct callout T303_callout;
- struct callout T305_callout;
- struct callout T308_callout;
- struct callout T309_callout;
- struct callout T310_callout;
- struct callout T313_callout;
- struct callout T400_callout;
- int callouts_inited; /* must init before use */
-#endif
int idletime_state; /* wait for idle_time begin */
#define IST_IDLE 0 /* shorthold mode disabled */
diff --git a/sys/i4b/include/i4b_mbuf.h b/sys/i4b/include/i4b_mbuf.h
index b1b46c0..0b74044 100644
--- a/sys/i4b/include/i4b_mbuf.h
+++ b/sys/i4b/include/i4b_mbuf.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b - mbuf handling support routines
* --------------------------------------
*
- * $Id: i4b_mbuf.h,v 1.9 2000/03/07 14:21:18 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Mar 3 14:30:09 2000]
+ * last edit-date: [Sat Mar 9 15:58:11 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_rbch_ioctl.h b/sys/i4b/include/i4b_rbch_ioctl.h
index 88142ad..dbaceed 100644
--- a/sys/i4b/include/i4b_rbch_ioctl.h
+++ b/sys/i4b/include/i4b_rbch_ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1999, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_rbch_ioctl.h raw B-channel driver interface ioctls
* ------------------------------------------------------
*
- * $Id: i4b_rbch_ioctl.h,v 1.2 1999/12/13 21:25:28 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon Dec 13 22:07:12 1999]
+ * last edit-date: [Sun Mar 17 10:10:25 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_tel_ioctl.h b/sys/i4b/include/i4b_tel_ioctl.h
index 3b92922..2f0bb2b 100644
--- a/sys/i4b/include/i4b_tel_ioctl.h
+++ b/sys/i4b/include/i4b_tel_ioctl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Oct 17 13:47:03 2001]
+ * last edit-date: [Sun Mar 17 10:10:39 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/include/i4b_trace.h b/sys/i4b/include/i4b_trace.h
index 24229ec..ee05bfd 100644
--- a/sys/i4b/include/i4b_trace.h
+++ b/sys/i4b/include/i4b_trace.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_trace.h - header file for trace data read device
* ----------------------------------------------------
*
- * $Id: i4b_trace.h,v 1.8 2000/03/08 16:08:18 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Wed Mar 8 16:41:43 2000]
+ * last edit-date: [Sun Mar 17 10:10:52 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer1/isic/i4b_bchan.c b/sys/i4b/layer1/isic/i4b_bchan.c
index 2f520d8..f8b6f0d 100644
--- a/sys/i4b/layer1/isic/i4b_bchan.c
+++ b/sys/i4b/layer1/isic/i4b_bchan.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Jan 24 09:07:12 2001]
+ * last edit-date: [Sat Mar 9 16:00:56 2002]
*
*---------------------------------------------------------------------------*/
@@ -89,10 +89,8 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate)
chan->rx_queue.ifq_maxlen = IFQ_MAXLEN;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&chan->rx_queue.ifq_mtx))
mtx_init(&chan->rx_queue.ifq_mtx, "i4b_isic_rx", MTX_DEF);
-#endif
i4b_Bcleanifq(&chan->rx_queue); /* clean rx queue */
@@ -108,10 +106,8 @@ isic_bchannel_setup(int unit, int h_chan, int bprot, int activate)
chan->tx_queue.ifq_maxlen = IFQ_MAXLEN;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&chan->tx_queue.ifq_mtx))
mtx_init(&chan->tx_queue.ifq_mtx, "i4b_isic_tx", MTX_DEF);
-#endif
i4b_Bcleanifq(&chan->tx_queue); /* clean tx queue */
diff --git a/sys/i4b/layer1/isic/i4b_hscx.c b/sys/i4b/layer1/isic/i4b_hscx.c
index cac4a13..03eb3c4 100644
--- a/sys/i4b/layer1/isic/i4b_hscx.c
+++ b/sys/i4b/layer1/isic/i4b_hscx.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Jan 24 09:09:42 2001]
+ * last edit-date: [Sat Mar 9 16:01:49 2002]
*
*---------------------------------------------------------------------------*/
@@ -267,18 +267,8 @@ isic_hscx_irq(register struct l1_softc *sc, u_char ista, int h_chan, u_char ex_i
if(!(i4b_l1_bchan_tel_silence(chan->in_mbuf->m_data, chan->in_mbuf->m_len)))
activity = ACT_RX;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
(void) IF_HANDOFF(&chan->rx_queue, chan->in_mbuf, NULL);
-#else
- if(!(IF_QFULL(&chan->rx_queue)))
- {
- IF_ENQUEUE(&chan->rx_queue, chan->in_mbuf);
- }
- else
- {
- i4b_Bfreembuf(chan->in_mbuf);
- }
-#endif
+
/* signal upper driver that data is available */
(*chan->isic_drvr_linktab->bch_rx_data_ready)(chan->isic_drvr_linktab->unit);
diff --git a/sys/i4b/layer2/i4b_iframe.c b/sys/i4b/layer2/i4b_iframe.c
index 4280528..7d5cbd1 100644
--- a/sys/i4b/layer2/i4b_iframe.c
+++ b/sys/i4b/layer2/i4b_iframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_iframe.c - i frame handling routines
* ------------------------------------------
*
- * $Id: i4b_iframe.c,v 1.25 2000/08/24 11:48:57 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Aug 24 12:49:18 2000]
+ * last edit-date: [Sat Mar 9 16:07:21 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -49,18 +44,8 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_trace.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_trace.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l1l2.h>
diff --git a/sys/i4b/layer2/i4b_l2.c b/sys/i4b/layer2/i4b_l2.c
index 96a4a15..745b465 100644
--- a/sys/i4b/layer2/i4b_l2.c
+++ b/sys/i4b/layer2/i4b_l2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,15 +29,12 @@
*
* $FreeBSD$
*
- * last edit-date: [Fri Jan 12 16:43:31 2001]
+ * last edit-date: [Sat Mar 9 16:11:14 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -46,16 +43,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_l1l2.h>
#include <i4b/include/i4b_l2l3.h>
@@ -276,29 +264,18 @@ i4b_mph_status_ind(int unit, int status, int parm)
l2sc->unit = unit;
l2sc->i_queue.ifq_maxlen = IQUEUE_MAXLEN;
-#if defined(__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&l2sc->i_queue.ifq_mtx))
mtx_init(&l2sc->i_queue.ifq_mtx, "i4b_l2sc", MTX_DEF);
-#endif
+
l2sc->ua_frame = NULL;
bzero(&l2sc->stat, sizeof(lapdstat_t));
i4b_l2_unit_init(unit);
-#if defined(__FreeBSD__)
/* initialize the callout handles for timeout routines */
callout_handle_init(&l2sc->T200_callout);
callout_handle_init(&l2sc->T202_callout);
callout_handle_init(&l2sc->T203_callout);
callout_handle_init(&l2sc->IFQU_callout);
-#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- /* initialize the callout handles for timeout routines */
- callout_init(&l2sc->T200_callout);
- callout_init(&l2sc->T202_callout);
- callout_init(&l2sc->T203_callout);
- callout_init(&l2sc->IFQU_callout);
-#endif
-
break;
case STI_L1STAT: /* state of layer 1 */
diff --git a/sys/i4b/layer2/i4b_l2.h b/sys/i4b/layer2/i4b_l2.h
index 5277a06..15c6ef8 100644
--- a/sys/i4b/layer2/i4b_l2.h
+++ b/sys/i4b/layer2/i4b_l2.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l2.h - ISDN layer 2 (Q.921) definitions
* ---------------------------------------------
*
- * $Id: i4b_l2.h,v 1.23 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Sat Mar 18 10:28:22 2000]
+ * last edit-date: [Sat Mar 9 16:12:20 2002]
*
*---------------------------------------------------------------------------*/
@@ -63,18 +61,10 @@ typedef struct {
void(*T202func)(void *);/* function to be called when T202 expires */
int T203; /* max line idle time */
-#if defined(__FreeBSD__)
struct callout_handle T200_callout;
struct callout_handle T202_callout;
struct callout_handle T203_callout;
struct callout_handle IFQU_callout;
-#endif
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
- struct callout T200_callout;
- struct callout T202_callout;
- struct callout T203_callout;
- struct callout IFQU_callout;
-#endif
/*
* i4b_iframe.c, i4b_i_frame_queued_up(): value of IFQU_DLY
diff --git a/sys/i4b/layer2/i4b_l2fsm.c b/sys/i4b/layer2/i4b_l2fsm.c
index 441b314..a0ca484 100644
--- a/sys/i4b/layer2/i4b_l2fsm.c
+++ b/sys/i4b/layer2/i4b_l2fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_l2fsm.c - layer 2 FSM
* -------------------------
*
- * $Id: i4b_l2fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Tue May 30 15:48:20 2000]
+ * last edit-date: [Sat Mar 9 16:14:07 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -47,17 +42,8 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l2l3.h>
diff --git a/sys/i4b/layer2/i4b_l2fsm.h b/sys/i4b/layer2/i4b_l2fsm.h
index c7ddaee..0589560 100644
--- a/sys/i4b/layer2/i4b_l2fsm.h
+++ b/sys/i4b/layer2/i4b_l2fsm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l2fsm.h - layer 2 FSM
* -------------------------
*
- * $Id: i4b_l2fsm.h,v 1.6 2000/03/18 09:33:48 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Sat Mar 18 10:28:37 2000]
+ * last edit-date: [Sat Mar 9 17:47:53 2002]
*
*---------------------------------------------------------------------------*/
@@ -81,4 +79,3 @@ enum Q921_events {
};
#endif /* _I4B_L2FSM_H_ */
-
diff --git a/sys/i4b/layer2/i4b_l2timer.c b/sys/i4b/layer2/i4b_l2timer.c
index 4ee335a..c3cbf1d 100644
--- a/sys/i4b/layer2/i4b_l2timer.c
+++ b/sys/i4b/layer2/i4b_l2timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_l2timer.c - layer 2 timer handling
* --------------------------------------
*
- * $Id: i4b_l2timer.c,v 1.20 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Aug 24 12:48:52 2000]
+ * last edit-date: [Sat Mar 9 17:48:58 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -48,16 +43,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
diff --git a/sys/i4b/layer2/i4b_lme.c b/sys/i4b/layer2/i4b_lme.c
index 7bc08ab..fce3712 100644
--- a/sys/i4b/layer2/i4b_lme.c
+++ b/sys/i4b/layer2/i4b_lme.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_lme.c - layer management entity
* -------------------------------------
*
- * $Id: i4b_lme.c,v 1.15 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:55:12 2000]
+ * last edit-date: [Sat Mar 9 17:49:42 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -47,17 +42,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
-
#include <i4b/layer2/i4b_l2.h>
diff --git a/sys/i4b/layer2/i4b_mbuf.c b/sys/i4b/layer2/i4b_mbuf.c
index 665ff67..95f234c 100644
--- a/sys/i4b/layer2/i4b_mbuf.c
+++ b/sys/i4b/layer2/i4b_mbuf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Sat Jan 13 13:15:45 2001]
+ * last edit-date: [Sat Mar 9 17:51:22 2002]
*
*---------------------------------------------------------------------------*/
@@ -46,18 +46,9 @@
#ifdef I4B_MBUF_TYPE_DEBUG
-#ifdef __FreeBSD__
-
#define MT_DCHAN 42
#define MT_BCHAN 43
-#else /* NetBSD */
-
-#define MT_DCHAN MT_DATA
-#define MT_BCHAN MT_DATA
-
-#endif
-
#define MT_I4B_D MT_DCHAN
#define MT_I4B_B MT_BCHAN
@@ -140,16 +131,8 @@ i4b_Dcleanifq(struct ifqueue *ifq)
{
int x = splimp();
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
IF_DRAIN(ifq);
-#else
- struct mbuf *m;
- while(!IF_QEMPTY(ifq))
- {
- IF_DEQUEUE(ifq, m);
- i4b_Dfreembuf(m);
- }
-#endif
+
splx(x);
}
@@ -225,16 +208,8 @@ i4b_Bcleanifq(struct ifqueue *ifq)
{
int x = splimp();
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
IF_DRAIN(ifq);
-#else
- struct mbuf *m;
- while(!IF_QEMPTY(ifq))
- {
- IF_DEQUEUE(ifq, m);
- i4b_Bfreembuf(m);
- }
-#endif
+
splx(x);
}
diff --git a/sys/i4b/layer2/i4b_sframe.c b/sys/i4b/layer2/i4b_sframe.c
index 34697c9..0b4c6c6 100644
--- a/sys/i4b/layer2/i4b_sframe.c
+++ b/sys/i4b/layer2/i4b_sframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_sframe.c - s frame handling routines
* ----------------------------------------
*
- * $Id: i4b_sframe.c,v 1.15 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:55:23 2000]
+ * last edit-date: [Sat Mar 9 17:52:06 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -48,16 +43,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_l1l2.h>
#include <i4b/include/i4b_mbuf.h>
diff --git a/sys/i4b/layer2/i4b_tei.c b/sys/i4b/layer2/i4b_tei.c
index 9beadf5..1e5cfa8 100644
--- a/sys/i4b/layer2/i4b_tei.c
+++ b/sys/i4b/layer2/i4b_tei.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_tei.c - tei handling procedures
* -----------------------------------
*
- * $Id: i4b_tei.c,v 1.25 2000/09/01 14:11:51 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Oct 13 15:56:35 2000]
+ * last edit-date: [Sat Mar 9 17:53:27 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -49,16 +44,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l1l2.h>
@@ -282,9 +268,6 @@ i4b_tei_chkresp(l2_softc_t *l2sc)
void
i4b_make_rand_ri(l2_softc_t *l2sc)
{
-
-#if defined(__FreeBSD__)
-
u_short val;
#ifdef RANDOMDEV
@@ -293,28 +276,6 @@ i4b_make_rand_ri(l2_softc_t *l2sc)
val = (u_short)random();
#endif /* RANDOMDEV */
-#else
-
- register u_short val;
- register int i;
- static int called = 42;
-
- val = (l2sc->last_rih << 8) | l2sc->last_ril;
-
- val += ++called;
-
- for(i=0; i < 50 ; i++, val++)
- {
- val |= l2sc->unit+i;
- val <<= i;
- val ^= (time.tv_sec >> 16) ^ time.tv_usec;
- val <<= i;
- val ^= time.tv_sec ^ (time.tv_usec >> 16);
-
- if(val != 0 && val != 0xffff)
- break;
- }
-#endif
l2sc->last_rih = (val >> 8) & 0x00ff;
l2sc->last_ril = val & 0x00ff;
}
diff --git a/sys/i4b/layer2/i4b_uframe.c b/sys/i4b/layer2/i4b_uframe.c
index 1a29f27..f7c89c2 100644
--- a/sys/i4b/layer2/i4b_uframe.c
+++ b/sys/i4b/layer2/i4b_uframe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_uframe.c - routines for handling U-frames
* -----------------------------------------------
*
- * $Id: i4b_uframe.c,v 1.13 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:55:30 2000]
+ * last edit-date: [Sat Mar 9 17:54:08 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -48,16 +43,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_l1l2.h>
#include <i4b/include/i4b_l2l3.h>
diff --git a/sys/i4b/layer2/i4b_util.c b/sys/i4b/layer2/i4b_util.c
index 0569a84..511df7d 100644
--- a/sys/i4b/layer2/i4b_util.c
+++ b/sys/i4b/layer2/i4b_util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_util.c - layer 2 utility routines
* -------------------------------------
*
- * $Id: i4b_util.c,v 1.26 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:55:35 2000]
+ * last edit-date: [Sat Mar 9 17:55:03 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq921.h"
-#else
-#define NI4BQ921 1
-#endif
+
#if NI4BQ921 > 0
#include <sys/param.h>
@@ -48,16 +43,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l1l2.h>
diff --git a/sys/i4b/layer3/i4b_l3fsm.c b/sys/i4b/layer3/i4b_l3fsm.c
index cde6e7c..77b3204 100644
--- a/sys/i4b/layer3/i4b_l3fsm.c
+++ b/sys/i4b/layer3/i4b_l3fsm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,38 +27,23 @@
* i4b_l3fsm.c - layer 3 FSM
* -------------------------
*
- * $Id: i4b_l3fsm.c,v 1.22 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Oct 12 17:58:35 2000]
+ * last edit-date: [Sat Mar 9 19:34:39 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq931.h"
-#else
-#define NI4BQ931 1
-#endif
+
#if NI4BQ931 > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#endif
#include <i4b/include/i4b_l2l3.h>
#include <i4b/include/i4b_l3l4.h>
@@ -69,7 +54,6 @@
#include <i4b/layer4/i4b_l4.h>
-
static void F_00A(call_desc_t *cd), F_00H(call_desc_t *cd), F_00I(call_desc_t *cd);
static void F_00J(call_desc_t *cd);
diff --git a/sys/i4b/layer3/i4b_l3fsm.h b/sys/i4b/layer3/i4b_l3fsm.h
index 0b1c76d..fbb7c37 100644
--- a/sys/i4b/layer3/i4b_l3fsm.h
+++ b/sys/i4b/layer3/i4b_l3fsm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l3fsm.c - layer 3 FSM
* -------------------------
*
- * $Id: i4b_l3fsm.h,v 1.8 2000/04/27 09:25:22 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Apr 27 11:07:16 2000]
+ * last edit-date: [Sat Mar 9 19:34:51 2002]
*
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l3timer.c b/sys/i4b/layer3/i4b_l3timer.c
index add27ad..ec408b6 100644
--- a/sys/i4b/layer3/i4b_l3timer.c
+++ b/sys/i4b/layer3/i4b_l3timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,14 @@
* i4b_l3timer.c - timer and timeout handling for layer 3
* ------------------------------------------------------
*
- * $Id: i4b_l3timer.c,v 1.17 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Aug 24 12:49:50 2000]
+ * last edit-date: [Sat Mar 9 19:35:31 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq931.h"
-#else
-#define NI4BQ931 1
-#endif
+
#if NI4BQ931 > 0
#include <sys/param.h>
@@ -47,17 +42,8 @@
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
@@ -65,7 +51,6 @@
#include <i4b/layer3/i4b_l3.h>
#include <i4b/layer3/i4b_l3fsm.h>
-
/*---------------------------------------------------------------------------*
* stop all layer 3 timers
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer3/i4b_l4if.c b/sys/i4b/layer3/i4b_l4if.c
index 3681219..34ddad8 100644
--- a/sys/i4b/layer3/i4b_l4if.c
+++ b/sys/i4b/layer3/i4b_l4if.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,38 +27,23 @@
* i4b_l4if.c - Layer 3 interface to Layer 4
* -------------------------------------------
*
- * $Id: i4b_l4if.c,v 1.27 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Jun 2 14:32:19 2000]
+ * last edit-date: [Sat Mar 9 19:36:08 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq931.h"
-#else
-#define NI4BQ931 1
-#endif
+
#if NI4BQ931 > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#endif
#include <i4b/include/i4b_l2l3.h>
#include <i4b/include/i4b_l3l4.h>
diff --git a/sys/i4b/layer3/i4b_q931.c b/sys/i4b/layer3/i4b_q931.c
index c294c7d..89d7a07 100644
--- a/sys/i4b/layer3/i4b_q931.c
+++ b/sys/i4b/layer3/i4b_q931.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,19 +27,13 @@
* i4b_q931.c - Q931 received messages handling
* --------------------------------------------
*
- * $Id: i4b_q931.c,v 1.32 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:56:52 2000]
+ * last edit-date: [Sat Mar 9 19:36:45 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq931.h"
-#else
-#define NI4BQ931 1
-#endif
#if NI4BQ931 > 0
@@ -47,19 +41,9 @@
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#endif
#include <i4b/include/i4b_isdnq931.h>
#include <i4b/include/i4b_l3l4.h>
@@ -71,10 +55,6 @@
#include <i4b/layer4/i4b_l4.h>
-#ifndef __FreeBSD__
-#define memcpy(d,s,l) bcopy(s,d,l)
-#endif
-
unsigned int i4b_l3_debug = L3_DEBUG_DEFAULT;
ctrl_desc_t ctrl_desc[MAX_CONTROLLERS]; /* controller description array */
diff --git a/sys/i4b/layer3/i4b_q932fac.c b/sys/i4b/layer3/i4b_q932fac.c
index 99a7608..38bf5da 100644
--- a/sys/i4b/layer3/i4b_q932fac.c
+++ b/sys/i4b/layer3/i4b_q932fac.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,43 +27,28 @@
* i4b_q932fac.c - Q932 facility handling
* --------------------------------------
*
- * $Id: i4b_q932fac.c,v 1.11 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Mon May 29 16:57:04 2000]
+ * last edit-date: [Sat Mar 9 19:37:29 2002]
*
*---------------------------------------------------------------------------*/
-#ifdef __FreeBSD__
#include "i4bq931.h"
-#else
-#define NI4BQ931 1
-#endif
+
#if NI4BQ931 > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_l3l4.h>
#include <i4b/layer3/i4b_l3.h>
#include <i4b/layer3/i4b_q932fac.h>
-
static int do_component(int length);
static void next_state(int class, int form, int code, int val);
diff --git a/sys/i4b/layer3/i4b_q932fac.h b/sys/i4b/layer3/i4b_q932fac.h
index 0c92177..c424fa1 100644
--- a/sys/i4b/layer3/i4b_q932fac.h
+++ b/sys/i4b/layer3/i4b_q932fac.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_q932fac.h - Q932 facility handling header file
* --------------------------------------------------
*
- * $Id: i4b_q932fac.h,v 1.8 2000/04/27 09:25:22 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Apr 27 11:07:52 2000]
+ * last edit-date: [Sat Mar 9 19:37:46 2002]
*
*---------------------------------------------------------------------------
*
diff --git a/sys/i4b/layer4/i4b_i4bdrv.c b/sys/i4b/layer4/i4b_i4bdrv.c
index 6083e84..7000add 100644
--- a/sys/i4b/layer4/i4b_i4bdrv.c
+++ b/sys/i4b/layer4/i4b_i4bdrv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Wed Oct 17 13:37:56 2001]
+ * last edit-date: [Sun Mar 17 09:54:22 2002]
*
*---------------------------------------------------------------------------*/
@@ -44,66 +44,27 @@
#if NI4B > 0
#include <sys/param.h>
-
-#if defined(__FreeBSD__)
#include <sys/ioccom.h>
#include <sys/malloc.h>
#include <sys/uio.h>
-#else
-#include <sys/ioctl.h>
-#endif
-
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
-#if __FreeBSD_version >= 500014
#include <sys/selinfo.h>
-#else
-#include <sys/select.h>
-#endif
#include <net/if.h>
-#ifdef __NetBSD__
-#include <sys/types.h>
-#endif
-
-#if defined(__FreeBSD__)
#include "i4bing.h"
-#endif
-
-#ifdef __bsdi__
-#include "ibc.h"
-#else
-#ifdef __FreeBSD__
#include "i4bisppp.h"
-#else
-#include <net/if_sppp.h>
-#endif
-#endif
-
-#ifdef __FreeBSD__
-
-#if defined(__FreeBSD__) && __FreeBSD__ == 3
-#include "opt_devfs.h"
-#endif
#ifdef DEVFS
#include <sys/devfsext.h>
#endif
-#endif /* __FreeBSD__*/
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#endif
#include <i4b/include/i4b_l3l4.h>
#include <i4b/include/i4b_mbuf.h>
@@ -111,9 +72,7 @@
#include <i4b/layer4/i4b_l4.h>
-#ifdef OS_USES_POLL
#include <sys/poll.h>
-#endif
struct selinfo select_rd_info;
@@ -122,61 +81,21 @@ static int openflag = 0;
static int selflag = 0;
static int readflag = 0;
-#if defined(__FreeBSD__) && __FreeBSD__ == 3
-#ifdef DEVFS
-static void *devfs_token;
-#endif
-#endif
-
-#ifndef __FreeBSD__
-
-#define PDEVSTATIC /* - not static - */
-PDEVSTATIC void i4battach __P((void));
-PDEVSTATIC int i4bopen __P((dev_t dev, int flag, int fmt, struct thread *td));
-PDEVSTATIC int i4bclose __P((dev_t dev, int flag, int fmt, struct thread *td));
-PDEVSTATIC int i4bread __P((dev_t dev, struct uio *uio, int ioflag));
-
-#ifdef __bsdi__
-PDEVSTATIC int i4bioctl __P((dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td));
-#else
-PDEVSTATIC int i4bioctl __P((dev_t dev, int cmd, caddr_t data, int flag, struct thread *td));
-#endif
-
-#ifdef OS_USES_POLL
-PDEVSTATIC int i4bpoll __P((dev_t dev, int events, struct thread *td));
-#else
-PDEVSTATIC int i4bselect __P((dev_t dev, int rw, struct thread *td));
-#endif
-
-#endif /* #ifndef __FreeBSD__ */
-
-#if BSD > 199306 && defined(__FreeBSD__)
-
-#define PDEVSTATIC static
-
-PDEVSTATIC d_open_t i4bopen;
-PDEVSTATIC d_close_t i4bclose;
-PDEVSTATIC d_read_t i4bread;
-PDEVSTATIC d_ioctl_t i4bioctl;
-
-#ifdef OS_USES_POLL
-PDEVSTATIC d_poll_t i4bpoll;
-#define POLLFIELD i4bpoll
-#else
-PDEVSTATIC d_select_t i4bselect;
-#define POLLFIELD i4bselect
-#endif
+static d_open_t i4bopen;
+static d_close_t i4bclose;
+static d_read_t i4bread;
+static d_ioctl_t i4bioctl;
+static d_poll_t i4bpoll;
#define CDEV_MAJOR 60
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
static struct cdevsw i4b_cdevsw = {
/* open */ i4bopen,
/* close */ i4bclose,
/* read */ i4bread,
/* write */ nowrite,
/* ioctl */ i4bioctl,
- /* poll */ POLLFIELD,
+ /* poll */ i4bpoll,
/* mmap */ nommap,
/* strategy */ nostrategy,
/* name */ "i4b",
@@ -185,97 +104,38 @@ static struct cdevsw i4b_cdevsw = {
/* psize */ nopsize,
/* flags */ 0,
};
-#else
-static struct cdevsw i4b_cdevsw = {
- i4bopen, i4bclose, i4bread, nowrite,
- i4bioctl, nostop, nullreset, nodevtotty,
- POLLFIELD, nommap, NULL, "i4b", NULL, -1
-};
-#endif
-PDEVSTATIC void i4battach(void *);
+static void i4battach(void *);
PSEUDO_SET(i4battach, i4b_i4bdrv);
static void
i4b_drvinit(void *unused)
{
-#if defined(__FreeBSD__) && __FreeBSD__ >= 4
cdevsw_add(&i4b_cdevsw);
-#else
- static int i4b_devsw_installed = 0;
- dev_t dev;
-
- if( ! i4b_devsw_installed )
- {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&i4b_cdevsw,NULL);
- i4b_devsw_installed = 1;
- }
-#endif
}
SYSINIT(i4bdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,i4b_drvinit,NULL)
-#endif /* BSD > 199306 && defined(__FreeBSD__) */
-
-#ifdef __bsdi__
-#include <sys/device.h>
-int i4bmatch(struct device *parent, struct cfdata *cf, void *aux);
-void dummy_i4battach(struct device*, struct device *, void *);
-
-#define CDEV_MAJOR 65
-
-static struct cfdriver i4bcd =
- { NULL, "i4b", i4bmatch, dummy_i4battach, DV_DULL,
- sizeof(struct cfdriver) };
-struct devsw i4bsw =
- { &i4bcd,
- i4bopen, i4bclose, i4bread, nowrite,
- i4bioctl, i4bselect, nommap, nostrat,
- nodump, nopsize, 0, nostop
-};
-
-int
-i4bmatch(struct device *parent, struct cfdata *cf, void *aux)
-{
- printf("i4bmatch: aux=0x%x\n", aux);
- return 1;
-}
-void
-dummy_i4battach(struct device *parent, struct device *self, void *aux)
-{
- printf("dummy_i4battach: aux=0x%x\n", aux);
-}
-#endif /* __bsdi__ */
-
/*---------------------------------------------------------------------------*
* interface attach routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC void
-#ifdef __FreeBSD__
+static void
i4battach(void *dummy)
-#else
-i4battach()
-#endif
{
printf("i4b: ISDN call control device attached\n");
i4b_rdqueue.ifq_maxlen = IFQ_MAXLEN;
-#if defined(__FreeBSD__) && __FreeBSD__ > 4
if(!mtx_initialized(&i4b_rdqueue.ifq_mtx))
mtx_init(&i4b_rdqueue.ifq_mtx, "i4b_rdqueue", MTX_DEF);
-#endif
-#if defined(__FreeBSD__)
make_dev(&i4b_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "i4b");
-#endif
}
/*---------------------------------------------------------------------------*
* i4bopen - device driver open routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bopen(dev_t dev, int flag, int fmt, struct thread *td)
{
int x;
@@ -297,7 +157,7 @@ i4bopen(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* i4bclose - device driver close routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bclose(dev_t dev, int flag, int fmt, struct thread *td)
{
int x = splimp();
@@ -311,7 +171,7 @@ i4bclose(dev_t dev, int flag, int fmt, struct thread *td)
/*---------------------------------------------------------------------------*
* i4bread - device driver read routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bread(dev_t dev, struct uio *uio, int ioflag)
{
struct mbuf *m;
@@ -326,13 +186,10 @@ i4bread(dev_t dev, struct uio *uio, int ioflag)
while(IF_QEMPTY(&i4b_rdqueue))
{
readflag = 1;
-#if defined (__FreeBSD__) && __FreeBSD__ > 4
+
error = msleep((caddr_t) &i4b_rdqueue, &i4b_rdqueue.ifq_mtx,
(PZERO + 1) | PCATCH, "bird", 0);
-#else
- error = tsleep((caddr_t) &i4b_rdqueue, (PZERO + 1) | PCATCH,
- "bird", 0);
-#endif
+
if (error != 0) {
IF_UNLOCK(&i4b_rdqueue);
splx(x);
@@ -359,14 +216,8 @@ i4bread(dev_t dev, struct uio *uio, int ioflag)
/*---------------------------------------------------------------------------*
* i4bioctl - device driver ioctl routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
-#if defined (__FreeBSD_version) && __FreeBSD_version >= 300003
-i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#elif defined(__bsdi__)
+static int
i4bioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-#else
-i4bioctl(dev_t dev, int cmd, caddr_t data, int flag, struct thread *td)
-#endif
{
call_desc_t *cd;
int error = 0;
@@ -921,44 +772,10 @@ diag_done:
return(error);
}
-#ifdef OS_USES_SELECT
-
-/*---------------------------------------------------------------------------*
- * i4bselect - device driver select routine
- *---------------------------------------------------------------------------*/
-PDEVSTATIC int
-i4bselect(dev_t dev, int rw, struct thread *td)
-{
- int x;
-
- if(minor(dev))
- return(ENODEV);
-
- switch(rw)
- {
- case FREAD:
- if(!IF_QEMPTY(&i4b_rdqueue))
- return(1);
- x = splimp();
- selrecord(td, &select_rd_info);
- selflag = 1;
- splx(x);
- return(0);
- break;
-
- case FWRITE:
- return(1);
- break;
- }
- return(0);
-}
-
-#else /* OS_USES_SELECT */
-
/*---------------------------------------------------------------------------*
* i4bpoll - device driver poll routine
*---------------------------------------------------------------------------*/
-PDEVSTATIC int
+static int
i4bpoll(dev_t dev, int events, struct thread *td)
{
int x;
@@ -985,8 +802,6 @@ i4bpoll(dev_t dev, int events, struct thread *td)
return(0);
}
-#endif /* OS_USES_SELECT */
-
/*---------------------------------------------------------------------------*
* i4bputqueue - put message into queue to userland
*---------------------------------------------------------------------------*/
diff --git a/sys/i4b/layer4/i4b_l4.c b/sys/i4b/layer4/i4b_l4.c
index 4981b96..0980862 100644
--- a/sys/i4b/layer4/i4b_l4.c
+++ b/sys/i4b/layer4/i4b_l4.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2001 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -29,7 +29,7 @@
*
* $FreeBSD$
*
- * last edit-date: [Thu Oct 18 13:31:22 2001]
+ * last edit-date: [Sat Mar 9 19:46:26 2002]
*
*---------------------------------------------------------------------------*/
@@ -43,47 +43,20 @@
#include <sys/systm.h>
#include <sys/mbuf.h>
-#ifdef __NetBSD__
-#include <sys/types.h>
-#endif
-
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#if defined(__FreeBSD__)
#include "i4bing.h"
-#endif
-
-#ifdef __bsdi__
-#define NI4BISPPP 0
-#include "ibc.h"
-#else
#include "i4bisppp.h"
-#endif
-
#include "i4brbch.h"
#include "i4btel.h"
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
#include <machine/i4b_cause.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#include <i4b/i4b_cause.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
#include <i4b/include/i4b_mbuf.h>
#include <i4b/layer4/i4b_l4.h>
-#if !defined(__FreeBSD__) && !defined(__NetBSD__)
-#define memcpy(dst, src, len) bcopy((src), (dst), (len))
-#endif
-
unsigned int i4b_l4_debug = L4_DEBUG_DEFAULT;
struct ctrl_type_desc ctrl_types[CTRL_NUMTYPES] = { { NULL, NULL} };
@@ -96,6 +69,7 @@ static void i4b_idle_check_var_unit(call_desc_t *cd);
static void i4b_l4_setup_timeout_fix_unit(call_desc_t *cd);
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
@@ -654,7 +628,7 @@ i4b_link_bchandrvr(call_desc_t *cd)
break;
#endif
-#if defined(__bsdi__) && NIBC > 0
+#if NIBC > 0
case BDRV_IBC:
cd->dlt = ibc_ret_linktab(cd->driver_unit);
break;
@@ -708,7 +682,7 @@ i4b_link_bchandrvr(call_desc_t *cd)
break;
#endif
-#if defined(__bsdi__) && NIBC > 0
+#if NIBC > 0
case BDRV_IBC:
ibc_set_linktab(cd->driver_unit, cd->ilt);
break;
@@ -1082,11 +1056,9 @@ i4b_idle_check_var_unit(call_desc_t *cd)
case IST_CHECK:
if( i4b_get_idletime(cd) > (SECOND - cd->shorthold_data.idle_time))
{ /* activity detected */
-#if defined(__FreeBSD_version) && __FreeBSD_version >= 300001
+ /* check again in one second */
cd->idle_timeout_handle =
-#endif
- /* check again in one second */
- START_TIMER(cd->idle_timeout_handle, i4b_idle_check, cd, hz);
+ START_TIMER (cd->idle_timeout_handle, i4b_idle_check, cd, hz);
cd->timeout_active = 1;
cd->idletime_state = IST_CHECK;
NDBGL4(L4_TIMO, "%ld: outgoing-call, var idle timeout - activity at %ld, continuing", (long)SECOND, (long)i4b_get_idletime(cd));
diff --git a/sys/i4b/layer4/i4b_l4mgmt.c b/sys/i4b/layer4/i4b_l4mgmt.c
index 183f751..17bf29a 100644
--- a/sys/i4b/layer4/i4b_l4mgmt.c
+++ b/sys/i4b/layer4/i4b_l4mgmt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l4mgmt.c - layer 4 calldescriptor management utilites
* -----------------------------------------------------------
*
- * $Id: i4b_l4mgmt.c,v 1.34 2000/09/01 14:11:51 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Fri Oct 13 15:58:34 2000]
+ * last edit-date: [Sat Mar 9 19:48:32 2002]
*
*---------------------------------------------------------------------------*/
@@ -43,17 +41,8 @@
#include <sys/systm.h>
#include <sys/mbuf.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_l3l4.h>
#include <i4b/include/i4b_global.h>
@@ -66,9 +55,7 @@ static unsigned int get_cdid(void);
int nctrl; /* number of attached controllers */
-#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
void i4b_init_callout(call_desc_t *);
-#endif
/*---------------------------------------------------------------------------*
* return a new unique call descriptor id
@@ -149,9 +136,7 @@ reserve_cd(void)
if(cd == NULL)
panic("reserve_cd: no free call descriptor available!");
-#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
i4b_init_callout(cd);
-#endif
return(cd);
}
@@ -204,9 +189,9 @@ cd_by_cdid(unsigned int cdid)
{
NDBGL4(L4_MSG, "found cdid - index=%d cdid=%u cr=%d",
i, call_desc[i].cdid, call_desc[i].cr);
-#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
+
i4b_init_callout(&call_desc[i]);
-#endif
+
return(&(call_desc[i]));
}
}
@@ -235,9 +220,9 @@ cd_by_unitcr(int unit, int cr, int crf)
{
NDBGL4(L4_MSG, "found cd, index=%d cdid=%u cr=%d",
i, call_desc[i].cdid, call_desc[i].cr);
-#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
+
i4b_init_callout(&call_desc[i]);
-#endif
+
return(&(call_desc[i]));
}
}
@@ -260,22 +245,12 @@ get_rand_cr(int unit)
{
int found = 1;
-#if defined(__FreeBSD__)
-
#ifdef RANDOMDEV
read_random((char *)&val, sizeof(val));
#else
val = (u_char)random();
#endif /* RANDOMDEV */
-#else
- val |= unit+i;
- val <<= i;
- val ^= (time.tv_sec >> 8) ^ time.tv_usec;
- val <<= i;
- val ^= time.tv_sec ^ (time.tv_usec >> 8);
-#endif
-
retval = val & 0x7f;
if(retval == 0 || retval == 0x7f)
@@ -300,13 +275,11 @@ get_rand_cr(int unit)
/*---------------------------------------------------------------------------*
* initialize the callout handles for FreeBSD
*---------------------------------------------------------------------------*/
-#if (defined(__NetBSD__) && __NetBSD_Version__ >= 104230000) || defined(__FreeBSD__)
void
i4b_init_callout(call_desc_t *cd)
{
if(cd->callouts_inited == 0)
{
-#ifdef __FreeBSD__
callout_handle_init(&cd->idle_timeout_handle);
callout_handle_init(&cd->T303_callout);
callout_handle_init(&cd->T305_callout);
@@ -315,20 +288,9 @@ i4b_init_callout(call_desc_t *cd)
callout_handle_init(&cd->T310_callout);
callout_handle_init(&cd->T313_callout);
callout_handle_init(&cd->T400_callout);
-#else
- callout_init(&cd->idle_timeout_handle);
- callout_init(&cd->T303_callout);
- callout_init(&cd->T305_callout);
- callout_init(&cd->T308_callout);
- callout_init(&cd->T309_callout);
- callout_init(&cd->T310_callout);
- callout_init(&cd->T313_callout);
- callout_init(&cd->T400_callout);
-#endif
cd->callouts_inited = 1;
}
}
-#endif
/*---------------------------------------------------------------------------*
* daemon is attached
diff --git a/sys/i4b/layer4/i4b_l4timer.c b/sys/i4b/layer4/i4b_l4timer.c
index 7710ad5..327ad92 100644
--- a/sys/i4b/layer4/i4b_l4timer.c
+++ b/sys/i4b/layer4/i4b_l4timer.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
+ * Copyright (c) 1997, 2002 Hellmuth Michaelis. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -27,11 +27,9 @@
* i4b_l4timer.c - timer and timeout handling for layer 4
* --------------------------------------------------------
*
- * $Id: i4b_l4timer.c,v 1.18 2000/08/24 11:48:58 hm Exp $
- *
* $FreeBSD$
*
- * last edit-date: [Thu Aug 24 12:50:17 2000]
+ * last edit-date: [Sat Mar 9 19:49:13 2002]
*
*---------------------------------------------------------------------------*/
@@ -43,17 +41,8 @@
#include <sys/kernel.h>
#include <sys/systm.h>
-#if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
-#include <sys/callout.h>
-#endif
-
-#ifdef __FreeBSD__
#include <machine/i4b_debug.h>
#include <machine/i4b_ioctl.h>
-#else
-#include <i4b/i4b_debug.h>
-#include <i4b/i4b_ioctl.h>
-#endif
#include <i4b/include/i4b_global.h>
#include <i4b/include/i4b_l3l4.h>
OpenPOWER on IntegriCloud