1 #ifndef LINUX_26_37_COMPAT_H
2 #define LINUX_26_37_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
8 #include <linux/skbuff.h>
9 #include <linux/leds.h>
11 #define SDIO_CLASS_BT_AMP 0x09 /* Type-A Bluetooth AMP interface */
13 extern struct kobj_ns_type_operations net_ns_type_operations;
15 /* mask skb_checksum_none_assert as RHEL6 backports this */
16 #define skb_checksum_none_assert(a) compat_skb_checksum_none_assert(a)
19 * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE
22 * fresh skbs have their ip_summed set to CHECKSUM_NONE.
23 * Instead of forcing ip_summed to CHECKSUM_NONE, we can
24 * use this helper, to document places where we make this assertion.
26 static inline void skb_checksum_none_assert(struct sk_buff *skb)
29 BUG_ON(skb->ip_summed != CHECKSUM_NONE);
33 #define pcmcia_enable_device(link) pcmcia_request_configuration(link, &link->conf)
35 #include <net/genetlink.h>
37 struct compat_genl_info {
38 struct genl_info *info;
42 struct genlmsghdr *genlhdr;
43 struct nlattr **attrs;
46 #define genl_info compat_genl_info
48 struct compat_genl_ops {
54 const struct nla_policy *policy;
56 int (*doit)(struct sk_buff *skb, struct genl_info *info);
57 int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
58 int (*done)(struct netlink_callback *cb);
60 #define genl_ops compat_genl_ops
62 struct compat_genl_family {
63 struct genl_family family;
65 struct list_head list;
67 unsigned int id, hdrsize, version, maxattr;
71 struct nlattr **attrbuf;
73 int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
74 struct genl_info *info);
76 void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
77 struct genl_info *info);
80 #define genl_family compat_genl_family
82 #define genl_register_family_with_ops compat_genl_register_family_with_ops
84 int genl_register_family_with_ops(struct genl_family *family,
85 struct genl_ops *ops, size_t n_ops);
87 #define genl_unregister_family compat_genl_unregister_family
89 int genl_unregister_family(struct genl_family *family);
91 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
92 #define genl_info_net(_info) genl_info_net((_info)->info)
95 #define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
96 #define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
97 #define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
98 #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
101 extern void led_blink_set(struct led_classdev *led_cdev,
102 unsigned long *delay_on,
103 unsigned long *delay_off);
105 #define led_classdev_unregister compat_led_classdev_unregister
106 extern void compat_led_classdev_unregister(struct led_classdev *led_cdev);
108 #define led_brightness_set compat_led_brightness_set
109 extern void compat_led_brightness_set(struct led_classdev *led_cdev,
110 enum led_brightness brightness);
112 #define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name)
114 #define netdev_refcnt_read(a) atomic_read(&a->refcnt)
116 /* mask vzalloc as RHEL6 backports this */
117 #define vzalloc(a) compat_vzalloc(a)
119 extern void *vzalloc(unsigned long size);
121 #define rtnl_dereference(p) \
122 rcu_dereference_protected(p, lockdep_rtnl_is_held())
125 * RCU_INIT_POINTER() - initialize an RCU protected pointer
127 * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep
130 #define RCU_INIT_POINTER(p, v) \
131 p = (typeof(*v) __force __rcu *)(v)
133 static inline bool skb_has_frag_list(const struct sk_buff *skb)
135 return skb_shinfo(skb)->frag_list != NULL;
138 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
140 #endif /* LINUX_26_37_COMPAT_H */