From b847a2205376a11f616a2846613a7cc793ff2f0d Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Tue, 10 Jul 2007 02:20:29 -0400 Subject: [PATCH] Convert skb compatibility code from functions to macros One reason is that it can be expected that some vendor kernels will backport the Linux 2.6.22 skb API. Macros can safely mask the inline functions used by the vendor kernel, whereas inline functions will conflict and fail. Another reason is that linux/skbuff.h doesn't need to be included from compat.h anymore, which makes the compatibility code less intrusive. Signed-off-by: Pavel Roskin --- compat.h | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/compat.h b/compat.h index 7759f04..77dcc29 100644 --- a/compat.h +++ b/compat.h @@ -12,31 +12,13 @@ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22) -#include -static inline unsigned char *skb_mac_header(const struct sk_buff *skb) -{ - return skb->mac.raw; -} - -static inline void skb_reset_mac_header(struct sk_buff *skb) -{ - skb->mac.raw = skb->data; -} - -static inline void skb_set_mac_header(struct sk_buff *skb, const int offset) -{ - skb->mac.raw = skb->data + offset; -} - -static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) -{ - return skb->end; -} - -static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb) -{ - return skb->tail; -} +#define skb_mac_header(_skb) ((_skb)->mac.raw) +#define skb_reset_mac_header(_skb) \ + do { (_skb)->mac.raw = (_skb)->data; } while(0) +#define skb_set_mac_header(_skb, _offset) \ + do { (_skb)->mac.raw = (_skb)->data + (_offset); } while(0) +#define skb_end_pointer(_skb) ((_skb)->end) +#define skb_tail_pointer(_skb) ((_skb)->tail) #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) -- cgit v1.2.3