bpf.c (61153) | bpf.c (64880) |
---|---|
1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94 39 * | 1/* 2 * Copyright (c) 1990, 1991, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from the Stanford/CMU enet packet filter, 6 * (net/enet.c) distributed as part of 4.3BSD, and code contributed 7 * to Berkeley by Steven McCanne and Van Jacobson both of Lawrence 8 * Berkeley Laboratory. --- 23 unchanged lines hidden (view full) --- 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 36 * SUCH DAMAGE. 37 * 38 * @(#)bpf.c 8.2 (Berkeley) 3/28/94 39 * |
40 * $FreeBSD: head/sys/net/bpf.c 61153 2000-06-01 21:57:13Z phk $ | 40 * $FreeBSD: head/sys/net/bpf.c 64880 2000-08-20 21:34:39Z phk $ |
41 */ 42 43#include "bpf.h" | 41 */ 42 43#include "bpf.h" |
44#include "opt_devfs.h" |
|
44 45#ifndef __GNUC__ 46#define inline 47#else 48#define inline __inline 49#endif 50 51#include <sys/param.h> --- 21 unchanged lines hidden (view full) --- 73#include <net/bpf.h> 74#include <net/bpfdesc.h> 75 76#include <netinet/in.h> 77#include <netinet/if_ether.h> 78#include <sys/kernel.h> 79#include <sys/sysctl.h> 80 | 45 46#ifndef __GNUC__ 47#define inline 48#else 49#define inline __inline 50#endif 51 52#include <sys/param.h> --- 21 unchanged lines hidden (view full) --- 74#include <net/bpf.h> 75#include <net/bpfdesc.h> 76 77#include <netinet/in.h> 78#include <netinet/if_ether.h> 79#include <sys/kernel.h> 80#include <sys/sysctl.h> 81 |
82#ifdef DEVFS 83#include <sys/eventhandler.h> 84#include <fs/devfs/devfs.h> 85#endif 86 |
|
81MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); 82 83#if NBPF > 0 84 85/* 86 * Older BSDs don't have kernel malloc. 87 */ 88#if BSD < 199103 --- 1263 unchanged lines hidden (view full) --- 1352 1353 free(bp, M_BPF); 1354 1355 splx(s); 1356} 1357 1358static void bpf_drvinit __P((void *unused)); 1359 | 87MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); 88 89#if NBPF > 0 90 91/* 92 * Older BSDs don't have kernel malloc. 93 */ 94#if BSD < 199103 --- 1263 unchanged lines hidden (view full) --- 1358 1359 free(bp, M_BPF); 1360 1361 splx(s); 1362} 1363 1364static void bpf_drvinit __P((void *unused)); 1365 |
1366#ifdef DEVFS 1367static void bpf_clone __P((void *arg, char *name, int namelen, dev_t *dev)); 1368 |
|
1360static void | 1369static void |
1370bpf_clone(arg, name, namelen, dev) 1371 void *arg; 1372 char *name; 1373 int namelen; 1374 dev_t *dev; 1375{ 1376 int u; 1377 1378 if (*dev != NODEV) 1379 return; 1380 if (devfs_stdclone(name, NULL, "bpf", &u) != 1) 1381 return; 1382 /* XXX: minor encoding if u > 255 */ 1383 *dev = make_dev(&bpf_cdevsw, u, 0, 0, 0600, "bpf%d", u); 1384 return; 1385} 1386#endif 1387 1388static void |
|
1361bpf_drvinit(unused) 1362 void *unused; 1363{ 1364 | 1389bpf_drvinit(unused) 1390 void *unused; 1391{ 1392 |
1393#ifdef DEVFS 1394 EVENTHANDLER_REGISTER(devfs_clone, bpf_clone, 0, 1000); 1395#else |
|
1365 cdevsw_add(&bpf_cdevsw); | 1396 cdevsw_add(&bpf_cdevsw); |
1397#endif |
|
1366} 1367 1368SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) 1369 1370#else /* !BPF */ 1371/* 1372 * NOP stubs to allow bpf-using drivers to load and function. 1373 * --- 43 unchanged lines hidden --- | 1398} 1399 1400SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) 1401 1402#else /* !BPF */ 1403/* 1404 * NOP stubs to allow bpf-using drivers to load and function. 1405 * --- 43 unchanged lines hidden --- |