aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/lock.h
diff options
context:
space:
mode:
authorAndrew Thompson <thompsa@FreeBSD.org>2009-01-21 04:19:18 +0000
committerAndrew Thompson <thompsa@FreeBSD.org>2009-01-21 04:19:18 +0000
commit018cecb61b7d37434ee3cdd527653afda64ad8ed (patch)
tree1a88a1f2553a5d499bb94b56aedbe8ab634b7f12 /sys/sys/lock.h
parentb2edeea7fb0768cbc4baf21c61f4780e3f7091b2 (diff)
downloadsrc-018cecb61b7d37434ee3cdd527653afda64ad8ed.tar.gz
src-018cecb61b7d37434ee3cdd527653afda64ad8ed.zip
Add functions WITNESS so it can be asserted that the lock is not released for a
section of code, this uses WITNESS_NORELEASE() and WITNESS_RELEASEOK() to mark the boundaries. Both functions require the lock to be held when calling. This is intended for scenarios like a bus asserting that the bus lock is not dropped during a driver call. There doesn't appear to be a man page to document this in. Reviewed by: jhb
Notes
Notes: svn path=/head/; revision=187511
Diffstat (limited to 'sys/sys/lock.h')
-rw-r--r--sys/sys/lock.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index b2f778252a57..8eb85a3f4cd6 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -216,6 +216,8 @@ int witness_warn(int, struct lock_object *, const char *, ...);
void witness_assert(struct lock_object *, int, const char *, int);
void witness_display_spinlock(struct lock_object *, struct thread *);
int witness_line(struct lock_object *);
+void witness_norelease(struct lock_object *);
+void witness_releaseok(struct lock_object *);
const char *witness_file(struct lock_object *);
void witness_thread_exit(struct thread *);
@@ -267,6 +269,12 @@ void witness_thread_exit(struct thread *);
#define WITNESS_RESTORE(lock, n) \
witness_restore((lock), __CONCAT(n, __wf), __CONCAT(n, __wl))
+#define WITNESS_NORELEASE(lock) \
+ witness_norelease(&(lock)->lock_object)
+
+#define WITNESS_RELEASEOK(lock) \
+ witness_releaseok(&(lock)->lock_object)
+
#define WITNESS_FILE(lock) \
witness_file(lock)
@@ -287,6 +295,8 @@ void witness_thread_exit(struct thread *);
#define WITNESS_SAVE_DECL(n)
#define WITNESS_SAVE(lock, n)
#define WITNESS_RESTORE(lock, n)
+#define WITNESS_NORELEASE(lock)
+#define WITNESS_RELEASEOK(lock)
#define WITNESS_FILE(lock) ("?")
#define WITNESS_LINE(lock) (0)
#endif /* WITNESS */