aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/core.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/core.h')
-rw-r--r--net/tipc/core.h47
1 files changed, 9 insertions, 38 deletions
diff --git a/net/tipc/core.h b/net/tipc/core.h
index 3af0b36e3f1..997158546e2 100644
--- a/net/tipc/core.h
+++ b/net/tipc/core.h
@@ -83,6 +83,7 @@ struct print_buf; /* log.h */
83 * user-defined buffers can be configured to do the same thing. 83 * user-defined buffers can be configured to do the same thing.
84 */ 84 */
85extern struct print_buf *const TIPC_NULL; 85extern struct print_buf *const TIPC_NULL;
86extern struct print_buf *const TIPC_CONS;
86extern struct print_buf *const TIPC_LOG; 87extern struct print_buf *const TIPC_LOG;
87 88
88void tipc_printf(struct print_buf *, const char *fmt, ...); 89void tipc_printf(struct print_buf *, const char *fmt, ...);
@@ -95,56 +96,26 @@ void tipc_printf(struct print_buf *, const char *fmt, ...);
95#define TIPC_OUTPUT TIPC_LOG 96#define TIPC_OUTPUT TIPC_LOG
96#endif 97#endif
97 98
98/*
99 * TIPC can be configured to send system messages to TIPC_OUTPUT
100 * or to the system console only.
101 */
102
103#ifdef CONFIG_TIPC_DEBUG
104
105#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 99#define err(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
106 KERN_ERR "TIPC: " fmt, ## arg) 100 KERN_ERR "TIPC: " fmt, ## arg)
107#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 101#define warn(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
108 KERN_WARNING "TIPC: " fmt, ## arg) 102 KERN_WARNING "TIPC: " fmt, ## arg)
109#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \ 103#define info(fmt, arg...) tipc_printf(TIPC_OUTPUT, \
110 KERN_NOTICE "TIPC: " fmt, ## arg) 104 KERN_NOTICE "TIPC: " fmt, ## arg)
111
112#else
113 105
114#define err(fmt, arg...) printk(KERN_ERR "TIPC: " fmt , ## arg) 106#ifdef CONFIG_TIPC_DEBUG
115#define info(fmt, arg...) printk(KERN_INFO "TIPC: " fmt , ## arg)
116#define warn(fmt, arg...) printk(KERN_WARNING "TIPC: " fmt , ## arg)
117
118#endif
119 107
120/* 108/*
121 * DBG_OUTPUT is the destination print buffer for debug messages. 109 * DBG_OUTPUT is the destination print buffer for debug messages.
122 * It defaults to the the null print buffer, but can be redefined
123 * (typically in the individual .c files being debugged) to allow
124 * selected debug messages to be generated where needed.
125 */ 110 */
126 111
127#ifndef DBG_OUTPUT 112#ifndef DBG_OUTPUT
128#define DBG_OUTPUT TIPC_NULL 113#define DBG_OUTPUT TIPC_LOG
129#endif 114#endif
130 115
131/* 116#define dbg(fmt, arg...) tipc_printf(DBG_OUTPUT, KERN_DEBUG fmt, ## arg);
132 * TIPC can be configured to send debug messages to the specified print buffer
133 * (typically DBG_OUTPUT) or to suppress them entirely.
134 */
135
136#ifdef CONFIG_TIPC_DEBUG
137 117
138#define dbg(fmt, arg...) \ 118#define msg_dbg(msg, txt) tipc_msg_dbg(DBG_OUTPUT, msg, txt);
139 do { \
140 if (DBG_OUTPUT != TIPC_NULL) \
141 tipc_printf(DBG_OUTPUT, fmt, ## arg); \
142 } while (0)
143#define msg_dbg(msg, txt) \
144 do { \
145 if (DBG_OUTPUT != TIPC_NULL) \
146 tipc_msg_dbg(DBG_OUTPUT, msg, txt); \
147 } while (0)
148 119
149void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *); 120void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
150 121
@@ -153,7 +124,7 @@ void tipc_msg_dbg(struct print_buf *, struct tipc_msg *, const char *);
153#define dbg(fmt, arg...) do {} while (0) 124#define dbg(fmt, arg...) do {} while (0)
154#define msg_dbg(msg, txt) do {} while (0) 125#define msg_dbg(msg, txt) do {} while (0)
155 126
156#define tipc_msg_dbg(...) do {} while (0) 127#define tipc_msg_dbg(buf, msg, txt) do {} while (0)
157 128
158#endif 129#endif
159 130