summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_lock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2007-11-18 14:43:53 +0000
committerattilio <attilio@FreeBSD.org>2007-11-18 14:43:53 +0000
commitbfc761fdba732e46979638ae050d0477eaf4b2cb (patch)
tree85188d6cc1153cc1df464313f1de2d46f0d4f067 /sys/kern/kern_lock.c
parent9dbec8e7dff5d2722f0ec81fca3a4d632eaadd19 (diff)
downloadFreeBSD-src-bfc761fdba732e46979638ae050d0477eaf4b2cb.zip
FreeBSD-src-bfc761fdba732e46979638ae050d0477eaf4b2cb.tar.gz
Expand lock class with the "virtual" function lc_assert which will offer
an unified way for all the lock primitives to express lock assertions. Currenty, lockmgrs and rmlocks don't have assertions, so just panic in that case. This will be a base for more callout improvements. Ok'ed by: jhb, jeff
Diffstat (limited to 'sys/kern/kern_lock.c')
-rw-r--r--sys/kern/kern_lock.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c
index 7256630..6a5f213 100644
--- a/sys/kern/kern_lock.c
+++ b/sys/kern/kern_lock.c
@@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$");
#include <sys/stack.h>
#endif
+static void assert_lockmgr(struct lock_object *lock, int what);
#ifdef DDB
#include <ddb/ddb.h>
static void db_show_lockmgr(struct lock_object *lock);
@@ -70,6 +71,7 @@ static int unlock_lockmgr(struct lock_object *lock);
struct lock_class lock_class_lockmgr = {
.lc_name = "lockmgr",
.lc_flags = LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE,
+ .lc_assert = assert_lockmgr,
#ifdef DDB
.lc_ddb_show = db_show_lockmgr,
#endif
@@ -83,6 +85,13 @@ struct lock_class lock_class_lockmgr = {
*/
void
+assert_lockmgr(struct lock_object *lock, int what)
+{
+
+ panic("lockmgr locks do not support assertions");
+}
+
+void
lock_lockmgr(struct lock_object *lock, int how)
{
OpenPOWER on IntegriCloud