1 #ifndef LINUX_26_22_COMPAT_H
2 #define LINUX_26_22_COMPAT_H
4 #include <linux/autoconf.h>
5 #include <linux/version.h>
7 /* Compat work for 2.6.21 */
8 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22))
10 #include <linux/pci.h>
11 #include <linux/skbuff.h>
14 #define ieee80211_ptr ax25_ptr
17 #error Compat reuses the AX.25 pointer so that may not be enabled!
20 static inline unsigned char *skb_mac_header(const struct sk_buff *skb)
25 static inline void skb_set_mac_header(struct sk_buff *skb, int offset)
27 skb->mac.raw = skb->data + offset;
30 static inline void skb_reset_mac_header(struct sk_buff *skb)
32 skb->mac.raw = skb->data;
35 static inline void skb_reset_network_header(struct sk_buff *skb)
37 skb->nh.raw = skb->data;
40 static inline void skb_set_network_header(struct sk_buff *skb, int offset)
42 skb->nh.raw = skb->data + offset;
45 static inline void skb_set_transport_header(struct sk_buff *skb, int offset)
47 skb->h.raw = skb->data + offset;
50 static inline unsigned char *skb_transport_header(struct sk_buff *skb)
55 static inline unsigned char *skb_network_header(const struct sk_buff *skb)
60 static inline unsigned char *skb_tail_pointer(const struct sk_buff *skb)
65 static inline struct iphdr *ip_hdr(const struct sk_buff *skb)
67 return (struct iphdr *)skb_network_header(skb);
70 static inline void skb_copy_from_linear_data(const struct sk_buff *skb,
72 const unsigned int len)
74 memcpy(to, skb->data, len);
77 static inline void skb_copy_from_linear_data_offset(const struct sk_buff *skb,
78 const int offset, void *to,
79 const unsigned int len)
81 memcpy(to, skb->data + offset, len);
84 #define __maybe_unused __attribute__((unused))
86 #define uninitialized_var(x) x = x
88 /* This will lead to very weird behaviour... */
89 #define NLA_BINARY NLA_STRING
91 static inline int pci_set_mwi(struct pci_dev *dev)
96 static inline void pci_clear_mwi(struct pci_dev *dev)
100 #define list_first_entry(ptr, type, member) \
101 list_entry((ptr)->next, type, member)
103 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)) */
105 #endif /* LINUX_26_22_COMPAT_H */