diff options
author | phk <phk@FreeBSD.org> | 1997-10-17 12:36:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1997-10-17 12:36:19 +0000 |
commit | 14aa7b01ea93949392e6e18666f790095eac2ebf (patch) | |
tree | af234d30cce9d801c011d9f4154cc8c26d406c53 /sys/kern/vfs_default.c | |
parent | 988fe95f9897d896424ea0328f166e0e740afeaa (diff) | |
download | FreeBSD-src-14aa7b01ea93949392e6e18666f790095eac2ebf.zip FreeBSD-src-14aa7b01ea93949392e6e18666f790095eac2ebf.tar.gz |
Make a set of VOP standard lock, unlock & islocked VOP operators, which
depend on the lock being located at vp->v_data. Saves 3x3 identical
vop procs, more as the other filesystems becomes lock aware.
Diffstat (limited to 'sys/kern/vfs_default.c')
-rw-r--r-- | sys/kern/vfs_default.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index a6a1d39..d130200 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -172,3 +172,48 @@ vop_stdpathconf(ap) } /* NOTREACHED */ } + +/* + * Standard lock, unlock and islocked functions. + * + * These depend on the lock structure being the first element in the + * inode, ie: vp->v_data points to the the lock! + */ +int +vop_stdlock(ap) + struct vop_lock_args /* { + struct vnode *a_vp; + int a_flags; + struct proc *a_p; + } */ *ap; +{ + struct lock *l = (struct lock*)ap->a_vp->v_data; + + return (lockmgr(l, ap->a_flags, &ap->a_vp->v_interlock, ap->a_p)); +} + +int +vop_stdunlock(ap) + struct vop_unlock_args /* { + struct vnode *a_vp; + int a_flags; + struct proc *a_p; + } */ *ap; +{ + struct lock *l = (struct lock*)ap->a_vp->v_data; + + return (lockmgr(l, ap->a_flags | LK_RELEASE, &ap->a_vp->v_interlock, + ap->a_p)); +} + +int +vop_stdislocked(ap) + struct vop_islocked_args /* { + struct vnode *a_vp; + } */ *ap; +{ + struct lock *l = (struct lock*)ap->a_vp->v_data; + + return (lockstatus(l)); +} + |