Define debugging/error logging macros that only do something for a
specific address family. Avoids ugly conditionals in code using these
debugging macros.
Signed-off-by: Julius R. Volz <juliusv@xxxxxxxxxx>
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index b7b181e..349a746 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -287,6 +287,24 @@ struct ip_vs_daemon_user {
#include <linux/net.h>
extern int ip_vs_get_debug_level(void);
+#define IP_VS_DBG_V4(af, level, msg...) \
+ do { \
+ if (af == AF_INET \
+ && level <= ip_vs_get_debug_level()) \
+ printk(KERN_DEBUG "IPVS: " msg); \
+ } while (0)
+
+#ifdef CONFIG_IP_VS_IPV6
+#define IP_VS_DBG_V6(af, level, msg...) \
+ do { \
+ if (af == AF_INET6 \
+ && level <= ip_vs_get_debug_level()) \
+ printk(KERN_DEBUG "IPVS: " msg); \
+ } while (0)
+#else
+#define IP_VS_DBG_V6(af, level, msg...) do {} while (0)
+#endif
+
#define IP_VS_DBG(level, msg...) \
do { \
if (level <= ip_vs_get_debug_level()) \
@@ -309,6 +327,8 @@ extern int ip_vs_get_debug_level(void);
pp->debug_packet(pp, skb, ofs, msg); \
} while (0)
#else /* NO DEBUGGING at ALL */
+#define IP_VS_DBG_V4(af, level, msg...) do {} while (0)
+#define IP_VS_DBG_V6(af, level, msg...) do {} while (0)
#define IP_VS_DBG(level, msg...) do {} while (0)
#define IP_VS_DBG_RL(msg...) do {} while (0)
#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0)
@@ -316,6 +336,20 @@ extern int ip_vs_get_debug_level(void);
#endif
#define IP_VS_BUG() BUG()
+#define IP_VS_ERR_V4(af, msg...) \
+ do { \
+ if (af == AF_INET) \
+ printk(KERN_ERR "IPVS: " msg); \
+ } while (0)
+#ifdef CONFIG_IP_VS_IPV6
+#define IP_VS_ERR_V6(af, msg...) \
+do { \
+ if (af == AF_INET6) \
+ printk(KERN_ERR "IPVS: " msg); \
+ } while (0)
+#else
+#define IP_VS_ERR_V6(af, msg...) do {} while (0)
+#endif
#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg)
#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg)
#define IP_VS_WARNING(msg...) \
--
1.5.3.6
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
|