]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: add WARN_ON()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 20 Dec 2011 09:08:52 +0000 (17:08 +0800)
committerPekka Enberg <penberg@kernel.org>
Wed, 21 Dec 2011 20:28:08 +0000 (22:28 +0200)
like the WARN_ON() of kernel code.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/include/kvm/util.h

index 6c8d4bc1ccc087f83c9ccfeb455ab35155172bfd..cfa3d9057b41addd44f1b446abae490eacb5bc4e 100644 (file)
@@ -62,6 +62,15 @@ do {                                                         \
                __stringify(cnd) "\n");                         \
 } while (0)
 
+#define WARN_ON(condition) ({                                  \
+       int __ret_warn_on = !!(condition);                      \
+       if (__ret_warn_on)                                      \
+               pr_warning("(%s) %s:%d: failed condition: %s",  \
+                               __FILE__, __func__, __LINE__,   \
+                               __stringify(condition));        \
+       __ret_warn_on;                                          \
+})
+
 #define MSECS_TO_USECS(s) ((s) * 1000)
 
 /* Millisecond sleep */