path: root/sys/sys/lock.h
diff options
authorJohn Baldwin <jhb@FreeBSD.org>2006-01-27 22:20:15 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2006-01-27 22:20:15 +0000
commitffaf2c55a856876601049d913fc58414ab024f98 (patch)
tree973032d84271692bbb5522bf9cdc89b3e27b8595 /sys/sys/lock.h
parentbef4bf1adf2652cbee085d36c7475cb2db3fa869 (diff)
Add a new macro wrapper WITNESS_CHECK() around the witness_warn() function.
The difference between WITNESS_CHECK() and WITNESS_WARN() is that WITNESS_CHECK() should be used in the places that the return value of witness_warn() is checked, whereas WITNESS_WARN() should be used in places where the return value is ignored. Specifically, in a kernel without WITNESS enabled, WITNESS_WARN() evaluates to an empty string where as WITNESS_CHECK evaluates to 0. I also updated the one place that was checking the return value of WITNESS_WARN() to use WITNESS_CHECK.
Notes: svn path=/head/; revision=154934
Diffstat (limited to 'sys/sys/lock.h')
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/lock.h b/sys/sys/lock.h
index 03b41e3fb478..6fcb03312063 100644
--- a/sys/sys/lock.h
+++ b/sys/sys/lock.h
@@ -268,6 +268,9 @@ const char *witness_file(struct lock_object *);
#define WITNESS_UNLOCK(lock, flags, file, line) \
witness_unlock((lock), (flags), (file), (line))
+#define WITNESS_CHECK(flags, lock, fmt, ...) \
+ witness_warn((flags), (lock), (fmt), ## __VA_ARGS__)
#define WITNESS_WARN(flags, lock, fmt, ...) \
witness_warn((flags), (lock), (fmt), ## __VA_ARGS__)
@@ -296,6 +299,7 @@ const char *witness_file(struct lock_object *);
#define WITNESS_UPGRADE(lock, flags, file, line)
#define WITNESS_DOWNGRADE(lock, flags, file, line)
#define WITNESS_UNLOCK(lock, flags, file, line)
+#define WITNESS_CHECK(flags, lock, fmt, ...) 0
#define WITNESS_WARN(flags, lock, fmt, ...)
#define WITNESS_SAVE(lock, n)