summaryrefslogtreecommitdiff
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerJulian Elischer <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit87f6c6625d5a4889540cb77c8296e456b7d1390b (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/net/bpf.c
parent0b7a315970685222e8ccbcdf3d645d35650cd03e (diff)
downloadsrc-test2-87f6c6625d5a4889540cb77c8296e456b7d1390b.tar.gz
src-test2-87f6c6625d5a4889540cb77c8296e456b7d1390b.zip
Notes
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c59
1 files changed, 32 insertions, 27 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index db072c33a204..8a1840c8f337 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -37,7 +37,7 @@
*
* @(#)bpf.c 8.2 (Berkeley) 3/28/94
*
- * $Id: bpf.c,v 1.17 1995/12/02 19:37:19 bde Exp $
+ * $Id: bpf.c,v 1.18 1995/12/06 23:51:53 bde Exp $
*/
#include "bpfilter.h"
@@ -80,14 +80,11 @@
#include <netinet/in.h>
#include <netinet/if_ether.h>
#include <sys/kernel.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 23
-#endif /*JREMOD*/
+
/*
* Older BSDs don't have kernel malloc.
@@ -145,6 +142,20 @@ static void catchpacket __P((struct bpf_d *, u_char *, u_int,
u_int, void (*)(const void *, void *, u_int)));
static void reset_d __P((struct bpf_d *));
+static d_open_t bpfopen;
+static d_close_t bpfclose;
+static d_read_t bpfread;
+static d_write_t bpfwrite;
+static d_ioctl_t bpfioctl;
+static d_select_t bpfselect;
+
+#define CDEV_MAJOR 23
+struct cdevsw bpf_cdevsw =
+ { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
+ bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
+ bpfselect, nommap, NULL, "bpf", NULL, -1 };
+
+
static int
bpf_movein(uio, linktype, mp, sockp, datlen)
register struct uio *uio;
@@ -321,7 +332,7 @@ bpf_detachd(d)
* EBUSY if file is open by another process.
*/
/* ARGSUSED */
-int
+static int
bpfopen(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -353,7 +364,7 @@ bpfopen(dev, flags, fmt, p)
* deallocating its buffers, and marking it free.
*/
/* ARGSUSED */
-int
+static int
bpfclose(dev, flags, fmt, p)
dev_t dev;
int flags;
@@ -425,7 +436,7 @@ bpf_sleep(d)
/*
* bpfread - read next chunk of packets from buffers
*/
-int
+static int
bpfread(dev, uio, ioflag)
dev_t dev;
register struct uio *uio;
@@ -540,7 +551,7 @@ bpf_wakeup(d)
#endif
}
-int
+static int
bpfwrite(dev, uio, ioflag)
dev_t dev;
struct uio *uio;
@@ -617,7 +628,7 @@ reset_d(d)
* BIOCVERSION Get filter language version.
*/
/* ARGSUSED */
-int
+static int
bpfioctl(dev, cmd, addr, flags, p)
dev_t dev;
int cmd;
@@ -1006,7 +1017,7 @@ bpf_ifname(ifp, ifr)
#if BSD >= 199103
#define bpf_select bpfselect
#else
-int
+static int
bpfselect(dev, rw)
register dev_t dev;
int rw;
@@ -1322,30 +1333,26 @@ bpfattach(driverp, ifp, dlt, hdrlen)
printf("bpf: %s%d attached\n", ifp->if_name, ifp->if_unit);
}
-
-#ifdef JREMOD
-struct cdevsw bpf_cdevsw =
- { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
- bpfioctl, nostop, nullreset, nodevtotty,/* bpf */
- bpfselect, nommap, NULL };
+static void *bpf_devfs_token[NBPFILTER];
static bpf_devsw_installed = 0;
static void bpf_drvinit(void *unused)
{
dev_t dev;
+ int i;
+ char name[32];
if( ! bpf_devsw_installed ) {
- dev = makedev(CDEV_MAJOR,0);
- cdevsw_add(&dev,&bpf_cdevsw,NULL);
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev,&bpf_cdevsw, NULL);
bpf_devsw_installed = 1;
#ifdef DEVFS
- {
- int x;
-/* default for a simple device with no probe routine (usually delete this) */
- x=devfs_add_devsw(
-/* path name devsw minor type uid gid perm*/
- "/", "bpf", major(dev), 0, DV_CHR, 0, 0, 0600);
+ for ( i = 0 ; i < NBPFILTER ; i++ ) {
+ sprintf(name,"bpf%d",i);
+ bpf_devfs_token[i] =
+ devfs_add_devsw( "/", name,
+ &bpf_cdevsw, i, DV_CHR, 0, 0, 0600);
}
#endif
}
@@ -1353,6 +1360,4 @@ static void bpf_drvinit(void *unused)
SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL)
-#endif /* JREMOD */
-
#endif