From b09de1f158b7b4ed69265edda4c411791602badd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 7 Oct 2018 19:19:25 +0200 Subject: global: prefix functions used in callbacks with wg_ Suggested-by: Jiri Pirko Signed-off-by: Jason A. Donenfeld --- src/compat/compat.h | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'src/compat') diff --git a/src/compat/compat.h b/src/compat/compat.h index 58636da..3ef8620 100644 --- a/src/compat/compat.h +++ b/src/compat/compat.h @@ -502,7 +502,7 @@ static inline void kvfree_ours(const void *addr) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && !defined(ISOPENSUSE15) -#define newlink(a,b,c,d,e) newlink(a,b,c,d) +#define wg_newlink(a,b,c,d,e) wg_newlink(a,b,c,d) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) @@ -547,30 +547,36 @@ static inline struct nlattr **genl_family_attrbuf(const struct genl_family *fami #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 2) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 14, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 16) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 65) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 4, 101) && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 84) -#define ___COMPAT_NETLINK_DUMP_BLOCK { int ret; skb->end -= nlmsg_total_size(sizeof(int)); ret = get_device_dump_real(skb, cb); skb->end += nlmsg_total_size(sizeof(int)); return ret; } +#define ___COMPAT_NETLINK_DUMP_BLOCK { \ + int ret; \ + skb->end -= nlmsg_total_size(sizeof(int)); \ + ret = wg_get_device_dump_real(skb, cb); \ + skb->end += nlmsg_total_size(sizeof(int)); \ + return ret; \ +} #define ___COMPAT_NETLINK_DUMP_OVERRIDE #else -#define ___COMPAT_NETLINK_DUMP_BLOCK return get_device_dump_real(skb, cb); +#define ___COMPAT_NETLINK_DUMP_BLOCK return wg_get_device_dump_real(skb, cb); #endif #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 8) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)) || (LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 25) && LINUX_VERSION_CODE >= KERNEL_VERSION(4, 10, 0)) || LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 87) -#define get_device_dump(a, b) get_device_dump_real(a, b); \ -static int get_device_dump(a, b) { \ +#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \ +static int wg_get_device_dump(a, b) { \ struct wireguard_device *wg = (struct wireguard_device *)cb->args[0]; \ if (!wg) { \ - int ret = get_device_start(cb); \ + int ret = wg_get_device_start(cb); \ if (ret) \ return ret; \ } \ ___COMPAT_NETLINK_DUMP_BLOCK \ } \ -static int get_device_dump_real(a, b) +static int wg_get_device_dump_real(a, b) #define COMPAT_CANNOT_USE_NETLINK_START #elif defined(___COMPAT_NETLINK_DUMP_OVERRIDE) -#define get_device_dump(a, b) get_device_dump_real(a, b); \ -static int get_device_dump(a, b) { \ +#define wg_get_device_dump(a, b) wg_get_device_dump_real(a, b); \ +static int wg_get_device_dump(a, b) { \ ___COMPAT_NETLINK_DUMP_BLOCK \ } \ -static int get_device_dump_real(a, b) +static int wg_get_device_dump_real(a, b) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0) @@ -788,11 +794,11 @@ static inline void new_icmpv6_send(struct sk_buff *skb, u8 type, u8 code, __u32 #endif #if defined(RAP_PLUGIN) && LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) #include -#define expired_retransmit_handshake(a) expired_retransmit_handshake(unsigned long timer) -#define expired_send_keepalive(a) expired_send_keepalive(unsigned long timer) -#define expired_new_handshake(a) expired_new_handshake(unsigned long timer) -#define expired_zero_key_material(a) expired_zero_key_material(unsigned long timer) -#define expired_send_persistent_keepalive(a) expired_send_persistent_keepalive(unsigned long timer) +#define wg_expired_retransmit_handshake(a) wg_expired_retransmit_handshake(unsigned long timer) +#define wg_expired_send_keepalive(a) wg_expired_send_keepalive(unsigned long timer) +#define wg_expired_new_handshake(a) wg_expired_new_handshake(unsigned long timer) +#define wg_expired_zero_key_material(a) wg_expired_zero_key_material(unsigned long timer) +#define wg_expired_send_persistent_keepalive(a) wg_expired_send_persistent_keepalive(unsigned long timer) #undef timer_setup #define timer_setup(a, b, c) setup_timer(a, ((void (*)(unsigned long))b), ((unsigned long)a)) #undef from_timer -- cgit v1.2.3