1 #ifndef LINUX_26_22_COMPAT_H
2 #define LINUX_26_22_COMPAT_H
4 #include <linux/version.h>
6 /* Compat work for 2.6.21 */
7 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
10 #include <linux/skbuff.h>
13 #define ieee80211_ptr ax25_ptr
16 #error Compat reuses the AX.25 pointer so that may not be enabled!
19 static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
24 static inline void skb_set_mac_header(struct sk_buff *skb, int offset)
26 skb->mac.raw = skb->data + offset;
29 static inline void skb_reset_mac_header(struct sk_buff *skb)
31 skb->mac.raw = skb->data;
34 static inline void skb_reset_network_header(struct sk_buff *skb)
36 skb->nh.raw = skb->data;
39 static inline void skb_set_network_header(struct sk_buff *skb, int offset)
41 skb->nh.raw = skb->data + offset;
44 static inline void skb_set_transport_header(struct sk_buff *skb, int offset)
46 skb->h.raw = skb->data + offset;
49 static inline unsigned char *skb_transport_header(struct sk_buff *skb)
54 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
59 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
64 static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
66 return (struct iphdr *)skb_network_header(skb);
69 static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
71 const unsigned int len)
73 memcpy(to, skb->data, len);
76 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
77 const int offset, void *to,
78 const unsigned int len)
80 memcpy(to, skb->data + offset, len);
83 #define __maybe_unused __attribute__((unused))
85 #define uninitialized_var(x) x = x
87 /* This will lead to very weird behaviour... */
88 #define NLA_BINARY NLA_STRING
90 static inline int pci_set_mwi(struct pci_dev *dev)
95 static inline void pci_clear_mwi(struct pci_dev *dev)
99 #define list_first_entry(ptr, type, member) \
100 list_entry((ptr)->next, type, member)
102 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */
104 #endif /* LINUX_26_22_COMPAT_H */