aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-07-10 02:20:29 -0400
committerGuido Guenther <agx@bogon.sigxcpu.org>2007-07-15 12:18:57 -0400
commitb847a2205376a11f616a2846613a7cc793ff2f0d (patch)
tree54a27e36067534232608cf0cca0e4b1746e5cc04
parent99775409e957ddca7c78ce8c2abf336d3d468719 (diff)
[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 <proski@gnu.org>
-rw-r--r--compat.h32
1 files 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 <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
-#include <linux/skbuff.h>
-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)