diff options
author | attilio <attilio@FreeBSD.org> | 2007-11-18 14:43:53 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2007-11-18 14:43:53 +0000 |
commit | bfc761fdba732e46979638ae050d0477eaf4b2cb (patch) | |
tree | 85188d6cc1153cc1df464313f1de2d46f0d4f067 /sys/kern/kern_sx.c | |
parent | 9dbec8e7dff5d2722f0ec81fca3a4d632eaadd19 (diff) | |
download | FreeBSD-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_sx.c')
-rw-r--r-- | sys/kern/kern_sx.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_sx.c b/sys/kern/kern_sx.c index 8e99ee3..1e3f135 100644 --- a/sys/kern/kern_sx.c +++ b/sys/kern/kern_sx.c @@ -103,6 +103,7 @@ CTASSERT(((SX_ADAPTIVESPIN | SX_RECURSE) & LO_CLASSFLAGS) == */ #define sx_recursed(sx) ((sx)->sx_recurse != 0) +static void assert_sx(struct lock_object *lock, int what); #ifdef DDB static void db_show_sx(struct lock_object *lock); #endif @@ -112,6 +113,7 @@ static int unlock_sx(struct lock_object *lock); struct lock_class lock_class_sx = { .lc_name = "sx", .lc_flags = LC_SLEEPLOCK | LC_SLEEPABLE | LC_RECURSABLE | LC_UPGRADABLE, + .lc_assert = assert_sx, #ifdef DDB .lc_ddb_show = db_show_sx, #endif @@ -124,6 +126,13 @@ struct lock_class lock_class_sx = { #endif void +assert_sx(struct lock_object *lock, int what) +{ + + sx_assert((struct sx *)lock, what); +} + +void lock_sx(struct lock_object *lock, int how) { struct sx *sx; |