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 65922 2000-09-16 14:17:15Z brian $
41 */
42
43#include "bpf.h"
44
45#ifndef __GNUC__
46#define inline
47#else
48#define inline __inline
--- 309 unchanged lines hidden (view full) ---
358
359 d = dev->si_drv1;
360 /*
361 * Each minor can be opened by only one process. If the requested
362 * minor is in use, return EBUSY.
363 */
364 if (d)
365 return (EBUSY);
366 make_dev(&bpf_cdevsw, minor(dev), 0, 0, 0600, "bpf%d", lminor(dev));
367 MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
368 bzero(d, sizeof(*d));
369 dev->si_drv1 = d;
370 d->bd_bufsize = bpf_bufsize;
371 d->bd_sig = SIGIO;
372 d->bd_seesent = 1;
373
374 return (0);
--- 997 unchanged lines hidden (view full) ---
1372 dev_t *dev;
1373{
1374 int u;
1375
1376 if (*dev != NODEV)
1377 return;
1378 if (dev_stdclone(name, NULL, "bpf", &u) != 1)
1379 return;
1380 /* XXX: minor encoding if u > 255 */
1381 *dev = make_dev(&bpf_cdevsw, u, 0, 0, 0600, "bpf%d", u);
1382 return;
1383}
1384
1385static void
1386bpf_drvinit(unused)
1387 void *unused;
1388{
1389
--- 53 unchanged lines hidden ---
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 65922 2000-09-16 14:17:15Z brian $
41 */
42
43#include "bpf.h"
44
45#ifndef __GNUC__
46#define inline
47#else
48#define inline __inline
--- 309 unchanged lines hidden (view full) ---
358
359 d = dev->si_drv1;
360 /*
361 * Each minor can be opened by only one process. If the requested
362 * minor is in use, return EBUSY.
363 */
364 if (d)
365 return (EBUSY);
366 make_dev(&bpf_cdevsw, minor(dev), 0, 0, 0600, "bpf%d", lminor(dev));
367 MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
368 bzero(d, sizeof(*d));
369 dev->si_drv1 = d;
370 d->bd_bufsize = bpf_bufsize;
371 d->bd_sig = SIGIO;
372 d->bd_seesent = 1;
373
374 return (0);
--- 997 unchanged lines hidden (view full) ---
1372 dev_t *dev;
1373{
1374 int u;
1375
1376 if (*dev != NODEV)
1377 return;
1378 if (dev_stdclone(name, NULL, "bpf", &u) != 1)
1379 return;
1380 /* XXX: minor encoding if u > 255 */
1381 *dev = make_dev(&bpf_cdevsw, u, 0, 0, 0600, "bpf%d", u);
1382 return;
1383}
1384
1385static void
1386bpf_drvinit(unused)
1387 void *unused;
1388{
1389
--- 53 unchanged lines hidden ---