diff options
| author | 2008-04-08 14:46:45 +0000 | |
|---|---|---|
| committer | 2008-04-08 14:46:45 +0000 | |
| commit | 43ba3c33f7056a6498869018ae580cca628c2ac2 (patch) | |
| tree | a4d79c440b0ada362c82da1f9d5200d593270d90 /sys/kern/spec_vnops.c | |
| parent | Split the cdev makro for bpftun into two seperate definitions. tun(4) and (diff) | |
| download | wireguard-openbsd-43ba3c33f7056a6498869018ae580cca628c2ac2.tar.xz wireguard-openbsd-43ba3c33f7056a6498869018ae580cca628c2ac2.zip | |
bring cloning up too date; Munge it so it will work with atleast
oga@'s upcoming DRM changes and too some degree ratchov@'s audio
work. It still works for bpf's though.
Parts from ratchov@; fstat(1) parts from Pedro Martelletto;
tested by many, ok'ed by a few;
"get going with cloning" deraadt@
Diffstat (limited to 'sys/kern/spec_vnops.c')
| -rw-r--r-- | sys/kern/spec_vnops.c | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/sys/kern/spec_vnops.c b/sys/kern/spec_vnops.c index 97bfdf61f85..e5d3f2c86f0 100644 --- a/sys/kern/spec_vnops.c +++ b/sys/kern/spec_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spec_vnops.c,v 1.44 2007/12/27 13:59:12 thib Exp $ */ +/* $OpenBSD: spec_vnops.c,v 1.45 2008/04/08 14:46:45 thib Exp $ */ /* $NetBSD: spec_vnops.c,v 1.29 1996/04/22 01:42:38 christos Exp $ */ /* @@ -529,6 +529,8 @@ spec_close(void *v) vrele(vp); ap->a_p->p_session->s_ttyvp = NULL; } + if (cdevsw[major(dev)].d_flags & D_CLONE) + return (spec_close_clone(ap)); /* * If the vnode is locked, then we are in the midst * of forcably closing the device, otherwise we only @@ -536,8 +538,6 @@ spec_close(void *v) */ if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0) return (0); - if (cdevsw[major(dev)].d_flags & D_CLONE) - return (spec_close_clone(ap)); devclose = cdevsw[major(dev)].d_close; mode = S_IFCHR; break; @@ -579,6 +579,47 @@ spec_close(void *v) return ((*devclose)(dev, ap->a_fflag, mode, ap->a_p)); } +int +spec_getattr(void *v) +{ + struct vop_getattr_args *ap = v; + struct vnode *vp = ap->a_vp; + + if (!(vp->v_flag & VCLONE)) + return (EBADF); + + return (VOP_GETATTR(vp->v_specparent, ap->a_vap, ap->a_cred, ap->a_p)); +} + +int +spec_setattr(void *v) +{ + struct vop_getattr_args *ap = v; + struct vnode *vp = ap->a_vp; + int error; + + if (!(vp->v_flag & VCLONE)) + return (EBADF); + + vn_lock(vp->v_specparent, LK_EXCLUSIVE|LK_RETRY, ap->a_p); + error = VOP_SETATTR(vp->v_specparent, ap->a_vap, ap->a_cred, ap->a_p); + VOP_UNLOCK(vp, 0, ap->a_p); + + return (error); +} + +int +spec_access(void *v) +{ + struct vop_access_args *ap = v; + struct vnode *vp = ap->a_vp; + + if (!(vp->v_flag & VCLONE)) + return (EBADF); + + return (VOP_ACCESS(vp->v_specparent, ap->a_mode, ap->a_cred, ap->a_p)); +} + /* * Print out the contents of a special device vnode. */ |
