summaryrefslogtreecommitdiffstats
path: root/sys/i4b/driver
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/driver
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/driver')
-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
7 files changed, 95 insertions, 955 deletions
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);
OpenPOWER on IntegriCloud