[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 2/2] make {,g}dprintk() a noâop in nonâdebug builds



As discussed before, code absolutely wanting to get something into the
log should use {,g}printk() instead.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -72,16 +72,6 @@
 #define MB(_mb)     (_AC(_mb, UL) << 20)
 #define GB(_gb)     (_AC(_gb, UL) << 30)
 
-#ifndef __ASSEMBLY__
-
-#define dprintk(_l, _f, _a...)                              \
-    printk(_l "%s:%d: " _f, __FILE__ , __LINE__ , ## _a )
-#define gdprintk(_l, _f, _a...)                             \
-    printk(XENLOG_GUEST _l "%s:%d:%pv " _f, __FILE__,       \
-           __LINE__, current, ## _a )
-
-#endif /* !__ASSEMBLY__ */
-
 #define __STR(...) #__VA_ARGS__
 #define STR(...) __STR(__VA_ARGS__)
 
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -87,6 +87,26 @@ extern int printk_ratelimit(void);
 #define gprintk(lvl, fmt, args...) \
     printk(XENLOG_GUEST lvl "%pv " fmt, current, ## args)
 
+#ifdef NDEBUG
+
+static inline void
+__attribute__ ((__format__ (__printf__, 2, 3)))
+dprintk(const char *lvl, const char *fmt, ...) {}
+
+static inline void
+__attribute__ ((__format__ (__printf__, 2, 3)))
+gdprintk(const char *lvl, const char *fmt, ...) {}
+
+#else
+
+#define dprintk(lvl, fmt, args...) \
+    printk(lvl "%s:%d: " fmt, __FILE__, __LINE__, ## args)
+#define gdprintk(lvl, fmt, args...) \
+    printk(XENLOG_GUEST lvl "%s:%d:%pv " fmt, \
+           __FILE__, __LINE__, current, ## args)
+
+#endif
+
 /* vsprintf.c */
 #define sprintf __xen_has_no_sprintf__
 #define vsprintf __xen_has_no_vsprintf__



Attachment: dprintk.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.