提交 9aada7ac 编写于 作者: H Hannes Eder 提交者: David S. Miller

IPVS: use pr_fmt

While being at it cleanup whitespace.
Signed-off-by: NHannes Eder <heder@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b4076d17
...@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, ...@@ -99,47 +99,47 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
return &buf[*idx - len]; return &buf[*idx - len];
} }
#define IP_VS_DBG_BUF(level, msg...) \ #define IP_VS_DBG_BUF(level, msg, ...) \
do { \ do { \
char ip_vs_dbg_buf[160]; \ char ip_vs_dbg_buf[160]; \
int ip_vs_dbg_idx = 0; \ int ip_vs_dbg_idx = 0; \
if (level <= ip_vs_get_debug_level()) \ if (level <= ip_vs_get_debug_level()) \
printk(KERN_DEBUG "IPVS: " msg); \ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
} while (0) } while (0)
#define IP_VS_ERR_BUF(msg...) \ #define IP_VS_ERR_BUF(msg...) \
do { \ do { \
char ip_vs_dbg_buf[160]; \ char ip_vs_dbg_buf[160]; \
int ip_vs_dbg_idx = 0; \ int ip_vs_dbg_idx = 0; \
printk(KERN_ERR "IPVS: " msg); \ pr_err(msg); \
} while (0) } while (0)
/* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */ /* Only use from within IP_VS_DBG_BUF() or IP_VS_ERR_BUF macros */
#define IP_VS_DBG_ADDR(af, addr) \ #define IP_VS_DBG_ADDR(af, addr) \
ip_vs_dbg_addr(af, ip_vs_dbg_buf, \ ip_vs_dbg_addr(af, ip_vs_dbg_buf, \
sizeof(ip_vs_dbg_buf), addr, \ sizeof(ip_vs_dbg_buf), addr, \
&ip_vs_dbg_idx) &ip_vs_dbg_idx)
#define IP_VS_DBG(level, msg...) \ #define IP_VS_DBG(level, msg, ...) \
do { \ do { \
if (level <= ip_vs_get_debug_level()) \ if (level <= ip_vs_get_debug_level()) \
printk(KERN_DEBUG "IPVS: " msg); \ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
} while (0) } while (0)
#define IP_VS_DBG_RL(msg...) \ #define IP_VS_DBG_RL(msg, ...) \
do { \ do { \
if (net_ratelimit()) \ if (net_ratelimit()) \
printk(KERN_DEBUG "IPVS: " msg); \ printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \
} while (0) } while (0)
#define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ #define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \
do { \ do { \
if (level <= ip_vs_get_debug_level()) \ if (level <= ip_vs_get_debug_level()) \
pp->debug_packet(pp, skb, ofs, msg); \ pp->debug_packet(pp, skb, ofs, msg); \
} while (0) } while (0)
#define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ #define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \
do { \ do { \
if (level <= ip_vs_get_debug_level() && \ if (level <= ip_vs_get_debug_level() && \
net_ratelimit()) \ net_ratelimit()) \
pp->debug_packet(pp, skb, ofs, msg); \ pp->debug_packet(pp, skb, ofs, msg); \
} while (0) } while (0)
#else /* NO DEBUGGING at ALL */ #else /* NO DEBUGGING at ALL */
#define IP_VS_DBG_BUF(level, msg...) do {} while (0) #define IP_VS_DBG_BUF(level, msg...) do {} while (0)
#define IP_VS_ERR_BUF(msg...) do {} while (0) #define IP_VS_ERR_BUF(msg...) do {} while (0)
...@@ -150,29 +150,30 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, ...@@ -150,29 +150,30 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
#endif #endif
#define IP_VS_BUG() BUG() #define IP_VS_BUG() BUG()
#define IP_VS_ERR(msg...) printk(KERN_ERR "IPVS: " msg) #define IP_VS_ERR(msg...) pr_err(msg)
#define IP_VS_INFO(msg...) printk(KERN_INFO "IPVS: " msg) #define IP_VS_INFO(msg...) pr_info(msg)
#define IP_VS_WARNING(msg...) \ #define IP_VS_WARNING(msg...) pr_warning(msg)
printk(KERN_WARNING "IPVS: " msg) #define IP_VS_ERR_RL(msg...) \
#define IP_VS_ERR_RL(msg...) \ do { \
do { \ if (net_ratelimit()) \
if (net_ratelimit()) \ pr_err(msg); \
printk(KERN_ERR "IPVS: " msg); \ } while (0)
} while (0)
#ifdef CONFIG_IP_VS_DEBUG #ifdef CONFIG_IP_VS_DEBUG
#define EnterFunction(level) \ #define EnterFunction(level) \
do { \ do { \
if (level <= ip_vs_get_debug_level()) \ if (level <= ip_vs_get_debug_level()) \
printk(KERN_DEBUG "Enter: %s, %s line %i\n", \ printk(KERN_DEBUG \
__func__, __FILE__, __LINE__); \ pr_fmt("Enter: %s, %s line %i\n"), \
} while (0) __func__, __FILE__, __LINE__); \
#define LeaveFunction(level) \ } while (0)
do { \ #define LeaveFunction(level) \
if (level <= ip_vs_get_debug_level()) \ do { \
printk(KERN_DEBUG "Leave: %s, %s line %i\n", \ if (level <= ip_vs_get_debug_level()) \
__func__, __FILE__, __LINE__); \ printk(KERN_DEBUG \
} while (0) pr_fmt("Leave: %s, %s line %i\n"), \
__func__, __FILE__, __LINE__); \
} while (0)
#else #else
#define EnterFunction(level) do {} while (0) #define EnterFunction(level) do {} while (0)
#define LeaveFunction(level) do {} while (0) #define LeaveFunction(level) do {} while (0)
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/in.h> #include <linux/in.h>
#include <linux/net.h> #include <linux/net.h>
......
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ip.h> #include <linux/ip.h>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
* Changes: * Changes:
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/slab.h> #include <linux/slab.h>
......
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -39,6 +39,9 @@ ...@@ -39,6 +39,9 @@
* me to write this module. * me to write this module.
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -37,6 +37,9 @@ ...@@ -37,6 +37,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/skbuff.h> #include <linux/skbuff.h>
...@@ -181,7 +184,7 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_vs_protocol *pp, ...@@ -181,7 +184,7 @@ ip_vs_tcpudp_debug_packet_v4(struct ip_vs_protocol *pp,
&ih->daddr, ntohs(pptr[1])); &ih->daddr, ntohs(pptr[1]));
} }
printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); pr_debug("%s: %s\n", msg, buf);
} }
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
...@@ -215,7 +218,7 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp, ...@@ -215,7 +218,7 @@ ip_vs_tcpudp_debug_packet_v6(struct ip_vs_protocol *pp,
&ih->daddr, ntohs(pptr[1])); &ih->daddr, ntohs(pptr[1]));
} }
printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); pr_debug("%s: %s\n", msg, buf);
} }
#endif #endif
......
...@@ -10,6 +10,9 @@ ...@@ -10,6 +10,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/in.h> #include <linux/in.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -138,7 +141,7 @@ ah_esp_debug_packet_v4(struct ip_vs_protocol *pp, const struct sk_buff *skb, ...@@ -138,7 +141,7 @@ ah_esp_debug_packet_v4(struct ip_vs_protocol *pp, const struct sk_buff *skb,
sprintf(buf, "%s %pI4->%pI4", sprintf(buf, "%s %pI4->%pI4",
pp->name, &ih->saddr, &ih->daddr); pp->name, &ih->saddr, &ih->daddr);
printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); pr_debug("%s: %s\n", msg, buf);
} }
#ifdef CONFIG_IP_VS_IPV6 #ifdef CONFIG_IP_VS_IPV6
...@@ -156,7 +159,7 @@ ah_esp_debug_packet_v6(struct ip_vs_protocol *pp, const struct sk_buff *skb, ...@@ -156,7 +159,7 @@ ah_esp_debug_packet_v6(struct ip_vs_protocol *pp, const struct sk_buff *skb,
sprintf(buf, "%s %pI6->%pI6", sprintf(buf, "%s %pI6->%pI6",
pp->name, &ih->saddr, &ih->daddr); pp->name, &ih->saddr, &ih->daddr);
printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf); pr_debug("%s: %s\n", msg, buf);
} }
#endif #endif
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/tcp.h> /* for tcphdr */ #include <linux/tcp.h> /* for tcphdr */
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/in.h> #include <linux/in.h>
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/ip.h> #include <linux/ip.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -17,6 +17,9 @@ ...@@ -17,6 +17,9 @@
* Justin Ossevoort : Fix endian problem on sync message size. * Justin Ossevoort : Fix endian problem on sync message size.
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/inetdevice.h> #include <linux/inetdevice.h>
......
...@@ -19,6 +19,9 @@ ...@@ -19,6 +19,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/net.h> #include <linux/net.h>
......
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
* *
*/ */
#define KMSG_COMPONENT "IPVS"
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/tcp.h> /* for tcphdr */ #include <linux/tcp.h> /* for tcphdr */
#include <net/ip.h> #include <net/ip.h>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册