summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_default.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-10-17 12:36:19 +0000
committerphk <phk@FreeBSD.org>1997-10-17 12:36:19 +0000
commit14aa7b01ea93949392e6e18666f790095eac2ebf (patch)
treeaf234d30cce9d801c011d9f4154cc8c26d406c53 /sys/kern/vfs_default.c
parent988fe95f9897d896424ea0328f166e0e740afeaa (diff)
downloadFreeBSD-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.c45
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));
+}
+
OpenPOWER on IntegriCloud