aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/vfs_default.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1997-10-17 12:36:19 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1997-10-17 12:36:19 +0000
commitd54d34b53372c7e1465edd7bbe1831b8b3a71fde (patch)
tree71fed97a025f04ee5943faf6994a88552560d7b8 /sys/kern/vfs_default.c
parentc717c2d74c8e8e83979be636c46e094897b139ca (diff)
downloadsrc-d54d34b53372c7e1465edd7bbe1831b8b3a71fde.tar.gz
src-d54d34b53372c7e1465edd7bbe1831b8b3a71fde.zip
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.
Notes
Notes: svn path=/head/; revision=30513
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 a6a1d397e7ee..d130200820f9 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));
+}
+