summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2000-09-19 10:28:44 +0000
committerphk <phk@FreeBSD.org>2000-09-19 10:28:44 +0000
commit6023f979709dc325fe614123710e7faa12ba79f9 (patch)
treec347201698c5958ef6e577c73bf7f710c905f8db /sys/net/bpf.c
parentbc8d9c4814a55bf29cd2c010b5a0a58a79337d46 (diff)
downloadFreeBSD-src-6023f979709dc325fe614123710e7faa12ba79f9.zip
FreeBSD-src-6023f979709dc325fe614123710e7faa12ba79f9.tar.gz
Rename lminor() to dev2unit(). This function gives a linear unit number
which hides the 'hole' in the minor bits. Introduce unit2minor() to do the reverse operation. Fix some some make_dev() calls which didn't use UID_* or GID_* macros. Kill the v_hashchain alias macro, it hides the real relationship. Introduce experimental SI_CHEAPCLONE flag set it on cloned bpfs.
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 18433a3..f4da899 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -363,7 +363,8 @@ bpfopen(dev, flags, fmt, p)
*/
if (d)
return (EBUSY);
- make_dev(&bpf_cdevsw, minor(dev), 0, 0, 0600, "bpf%d", lminor(dev));
+ make_dev(&bpf_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600,
+ "bpf%d", dev2unit(dev));
MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK);
bzero(d, sizeof(*d));
dev->si_drv1 = d;
@@ -1377,8 +1378,9 @@ bpf_clone(arg, name, namelen, dev)
return;
if (dev_stdclone(name, NULL, "bpf", &u) != 1)
return;
- /* XXX: minor encoding if u > 255 */
- *dev = make_dev(&bpf_cdevsw, u, 0, 0, 0600, "bpf%d", u);
+ *dev = make_dev(&bpf_cdevsw, unit2minor(u), UID_ROOT, GID_WHEEL, 0600,
+ "bpf%d", u);
+ (*dev)->si_flags |= SI_CHEAPCLONE;
return;
}
OpenPOWER on IntegriCloud