diff options
author | davide <davide@FreeBSD.org> | 2013-09-20 23:06:21 +0000 |
---|---|---|
committer | davide <davide@FreeBSD.org> | 2013-09-20 23:06:21 +0000 |
commit | 5273d359fdd82fc7a93ff0f694844d25a2e17c59 (patch) | |
tree | 0f8acc1728a85e0911253a1fa7cfe9c10d2c05b4 /sys/kern/kern_rwlock.c | |
parent | 7ed30adae7eb0c6e156983ca0c96c04e1e6a8e0d (diff) | |
download | FreeBSD-src-5273d359fdd82fc7a93ff0f694844d25a2e17c59.zip FreeBSD-src-5273d359fdd82fc7a93ff0f694844d25a2e17c59.tar.gz |
Fix lc_lock/lc_unlock() support for rmlocks held in shared mode. With
current lock classes KPI it was really difficult because there was no
way to pass an rmtracker object to the lock/unlock routines. In order
to accomplish the task, modify the aforementioned functions so that
they can return (or pass as argument) an uinptr_t, which is in the rm
case used to hold a pointer to struct rm_priotracker for current
thread. As an added bonus, this fixes rm_sleep() in the rm shared
case, which right now can communicate priotracker structure between
lc_unlock()/lc_lock().
Suggested by: jhb
Reviewed by: jhb
Approved by: re (delphij)
Diffstat (limited to 'sys/kern/kern_rwlock.c')
-rw-r--r-- | sys/kern/kern_rwlock.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/kern/kern_rwlock.c b/sys/kern/kern_rwlock.c index bd40704..45993f2 100644 --- a/sys/kern/kern_rwlock.c +++ b/sys/kern/kern_rwlock.c @@ -83,11 +83,11 @@ SYSCTL_INT(_debug_rwlock, OID_AUTO, loops, CTLFLAG_RW, &rowner_loops, 0, ""); static void db_show_rwlock(const struct lock_object *lock); #endif static void assert_rw(const struct lock_object *lock, int what); -static void lock_rw(struct lock_object *lock, int how); +static void lock_rw(struct lock_object *lock, uintptr_t how); #ifdef KDTRACE_HOOKS static int owner_rw(const struct lock_object *lock, struct thread **owner); #endif -static int unlock_rw(struct lock_object *lock); +static uintptr_t unlock_rw(struct lock_object *lock); struct lock_class lock_class_rw = { .lc_name = "rw", @@ -141,7 +141,7 @@ assert_rw(const struct lock_object *lock, int what) } void -lock_rw(struct lock_object *lock, int how) +lock_rw(struct lock_object *lock, uintptr_t how) { struct rwlock *rw; @@ -152,7 +152,7 @@ lock_rw(struct lock_object *lock, int how) rw_rlock(rw); } -int +uintptr_t unlock_rw(struct lock_object *lock) { struct rwlock *rw; |