summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/net/bpf.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
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 db072c3..8a1840c 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
OpenPOWER on IntegriCloud