summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-11-16 01:02:00 +0000
committerpjd <pjd@FreeBSD.org>2006-11-16 01:02:00 +0000
commit63d82b700dad091f36b4fdf7ac55bfe272a625ba (patch)
treefefa626382a1e038e96529f97a2dd9ce533319d8 /sys/kern
parentb33232cde3fde704b882dff91db2b12776b4b38f (diff)
downloadFreeBSD-src-63d82b700dad091f36b4fdf7ac55bfe272a625ba.zip
FreeBSD-src-63d82b700dad091f36b4fdf7ac55bfe272a625ba.tar.gz
Change sleepq_add(9) argument from 'struct mtx *' to 'struct lock_object *',
which allows to use it with different kinds of locks. For example it allows to implement Solaris conditions variables which will be used in ZFS port on top of sx(9) locks. Reviewed by: jhb
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_condvar.c8
-rw-r--r--sys/kern/kern_synch.c5
-rw-r--r--sys/kern/subr_sleepqueue.c6
3 files changed, 10 insertions, 9 deletions
diff --git a/sys/kern/kern_condvar.c b/sys/kern/kern_condvar.c
index 7377981..85a52b1 100644
--- a/sys/kern/kern_condvar.c
+++ b/sys/kern/kern_condvar.c
@@ -149,7 +149,7 @@ cv_wait_unlock(struct cv *cvp, struct mtx *mp)
DROP_GIANT();
mtx_unlock(mp);
- sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR);
+ sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR);
sleepq_wait(cvp);
PICKUP_GIANT();
@@ -196,7 +196,7 @@ cv_wait_sig(struct cv *cvp, struct mtx *mp)
DROP_GIANT();
mtx_unlock(mp);
- sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR |
+ sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR |
SLEEPQ_INTERRUPTIBLE);
rval = sleepq_wait_sig(cvp);
@@ -250,7 +250,7 @@ cv_timedwait(struct cv *cvp, struct mtx *mp, int timo)
DROP_GIANT();
mtx_unlock(mp);
- sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR);
+ sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR);
sleepq_set_timeout(cvp, timo);
rval = sleepq_timedwait(cvp);
@@ -307,7 +307,7 @@ cv_timedwait_sig(struct cv *cvp, struct mtx *mp, int timo)
DROP_GIANT();
mtx_unlock(mp);
- sleepq_add(cvp, mp, cvp->cv_description, SLEEPQ_CONDVAR |
+ sleepq_add(cvp, &mp->mtx_object, cvp->cv_description, SLEEPQ_CONDVAR |
SLEEPQ_INTERRUPTIBLE);
sleepq_set_timeout(cvp, timo);
rval = sleepq_timedwait_sig(cvp);
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index b8082fd..3662902 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -188,7 +188,8 @@ msleep(ident, mtx, priority, wmesg, timo)
* stopped, then td will no longer be on a sleep queue upon
* return from cursig().
*/
- sleepq_add(ident, ident == &lbolt ? NULL : mtx, wmesg, flags);
+ sleepq_add(ident, ident == &lbolt ? NULL : &mtx->mtx_object, wmesg,
+ flags);
if (timo)
sleepq_set_timeout(ident, timo);
@@ -265,7 +266,7 @@ msleep_spin(ident, mtx, wmesg, timo)
/*
* We put ourselves on the sleep queue and start our timeout.
*/
- sleepq_add(ident, mtx, wmesg, SLEEPQ_MSLEEP);
+ sleepq_add(ident, &mtx->mtx_object, wmesg, SLEEPQ_MSLEEP);
if (timo)
sleepq_set_timeout(ident, timo);
diff --git a/sys/kern/subr_sleepqueue.c b/sys/kern/subr_sleepqueue.c
index 081c737..2d79c99 100644
--- a/sys/kern/subr_sleepqueue.c
+++ b/sys/kern/subr_sleepqueue.c
@@ -120,7 +120,7 @@ struct sleepqueue {
void *sq_wchan; /* (c) Wait channel. */
#ifdef INVARIANTS
int sq_type; /* (c) Queue type. */
- struct mtx *sq_lock; /* (c) Associated lock. */
+ struct lock_object *sq_lock; /* (c) Associated lock. */
#endif
};
@@ -262,7 +262,7 @@ sleepq_release(void *wchan)
* woken up.
*/
void
-sleepq_add(void *wchan, struct mtx *lock, const char *wmesg, int flags)
+sleepq_add(void *wchan, struct lock_object *lock, const char *wmesg, int flags)
{
struct sleepqueue_chain *sc;
struct sleepqueue *sq;
@@ -895,7 +895,7 @@ found:
#ifdef INVARIANTS
db_printf("Queue type: %d\n", sq->sq_type);
if (sq->sq_lock) {
- lock = &sq->sq_lock->mtx_object;
+ lock = sq->sq_lock;
db_printf("Associated Interlock: %p - (%s) %s\n", lock,
LOCK_CLASS(lock)->lc_name, lock->lo_name);
}
OpenPOWER on IntegriCloud