summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2009-04-02 18:43:09 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2009-04-02 18:43:09 +0000
commit18d68267be9932247dfd19a353d4bc8116423f9d (patch)
treef242db91605b86877c0f89b2e38ec4b5be68f346 /sys
parent11879adda470773f46c696a75badbd4aa3984b95 (diff)
Convert lockmgr to rwlock. Been in snaps for a while.
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r--sys/miscfs/procfs/procfs_subr.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c
index fb36b3432bb..2acb3f4e704 100644
--- a/sys/miscfs/procfs/procfs_subr.c
+++ b/sys/miscfs/procfs/procfs_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: procfs_subr.c,v 1.28 2007/12/09 21:34:32 hshoexer Exp $ */
+/* $OpenBSD: procfs_subr.c,v 1.29 2009/04/02 18:43:08 oga Exp $ */
/* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */
/*
@@ -40,6 +40,7 @@
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/kernel.h>
+#include <sys/rwlock.h>
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/malloc.h>
@@ -49,13 +50,12 @@
#include <miscfs/procfs/procfs.h>
static TAILQ_HEAD(, pfsnode) pfshead;
-struct lock pfs_vlock;
+struct rwlock pfs_vlock = RWLOCK_INITIALIZER("procfsl");
/*ARGSUSED*/
int
procfs_init(struct vfsconf *vfsp)
{
- lockinit(&pfs_vlock, PVFS, "procfsl", 0, 0);
TAILQ_INIT(&pfshead);
return (0);
}
@@ -97,9 +97,7 @@ procfs_allocvp(struct mount *mp, struct vnode **vpp, pid_t pid, pfstype pfs_type
/*
* Lock the vp list, getnewvnode can sleep.
*/
- error = lockmgr(&pfs_vlock, LK_EXCLUSIVE, NULL);
- if (error)
- return (error);
+ rw_enter_write(&pfs_vlock);
loop:
TAILQ_FOREACH(pfs, &pfshead, list) {
vp = PFSTOV(pfs);
@@ -175,7 +173,7 @@ loop:
TAILQ_INSERT_TAIL(&pfshead, pfs, list);
uvm_vnp_setsize(vp, 0);
out:
- lockmgr(&pfs_vlock, LK_RELEASE, NULL);
+ rw_exit_write(&pfs_vlock);
return (error);
}