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 #define VLAN_N_VID 4096
16 * netif_set_real_num_rx_queues - set actual number of RX queues used
17 * @dev: Network device
18 * @rxq: Actual number of RX queues
20 * This function actully sets the real_num_rx_queues field in struct
21 * net_device. Since real_num_rx_queues field is not present in net_device
22 * structure in 2.6.37 kernel making this function to set that field is not
23 * possible. Hence adding this function to avoid changes in driver source
24 * code and making this function to always return success.
26 static inline int netif_set_real_num_rx_queues(struct net_device *dev,
32 extern struct kobj_ns_type_operations net_ns_type_operations;
34 /* mask skb_checksum_none_assert as RHEL6 backports this */
35 #define skb_checksum_none_assert(a) compat_skb_checksum_none_assert(a)
38 * skb_checksum_none_assert - make sure skb ip_summed is CHECKSUM_NONE
41 * fresh skbs have their ip_summed set to CHECKSUM_NONE.
42 * Instead of forcing ip_summed to CHECKSUM_NONE, we can
43 * use this helper, to document places where we make this assertion.
45 static inline void skb_checksum_none_assert(struct sk_buff *skb)
48 BUG_ON(skb->ip_summed != CHECKSUM_NONE);
52 #define pcmcia_enable_device(link) pcmcia_request_configuration(link, &link->conf)
54 #include <net/genetlink.h>
56 struct compat_genl_info {
57 struct genl_info *info;
61 struct genlmsghdr *genlhdr;
62 struct nlattr **attrs;
65 #define genl_info compat_genl_info
67 struct compat_genl_ops {
73 const struct nla_policy *policy;
75 int (*doit)(struct sk_buff *skb, struct genl_info *info);
76 int (*dumpit)(struct sk_buff *skb, struct netlink_callback *cb);
77 int (*done)(struct netlink_callback *cb);
79 #define genl_ops compat_genl_ops
81 struct compat_genl_family {
82 struct genl_family family;
84 struct list_head list;
86 unsigned int id, hdrsize, version, maxattr;
90 struct nlattr **attrbuf;
92 int (*pre_doit)(struct genl_ops *ops, struct sk_buff *skb,
93 struct genl_info *info);
95 void (*post_doit)(struct genl_ops *ops, struct sk_buff *skb,
96 struct genl_info *info);
99 #define genl_family compat_genl_family
101 #define genl_register_family_with_ops compat_genl_register_family_with_ops
103 int genl_register_family_with_ops(struct genl_family *family,
104 struct genl_ops *ops, size_t n_ops);
106 #define genl_unregister_family compat_genl_unregister_family
108 int genl_unregister_family(struct genl_family *family);
110 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32))
111 #define genl_info_net(_info) genl_info_net((_info)->info)
114 #define genlmsg_reply(_msg, _info) genlmsg_reply(_msg, (_info)->info)
115 #define genlmsg_put(_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd)
116 #define genl_register_mc_group(_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp)
117 #define genl_unregister_mc_group(_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp)
120 extern void led_blink_set(struct led_classdev *led_cdev,
121 unsigned long *delay_on,
122 unsigned long *delay_off);
124 #define led_classdev_unregister compat_led_classdev_unregister
125 extern void compat_led_classdev_unregister(struct led_classdev *led_cdev);
127 #define led_brightness_set compat_led_brightness_set
128 extern void compat_led_brightness_set(struct led_classdev *led_cdev,
129 enum led_brightness brightness);
131 #define alloc_ordered_workqueue(name, flags) create_singlethread_workqueue(name)
133 #define netdev_refcnt_read(a) atomic_read(&a->refcnt)
135 /* mask vzalloc as RHEL6 backports this */
136 #define vzalloc(a) compat_vzalloc(a)
138 extern void *vzalloc(unsigned long size);
140 #define rtnl_dereference(p) \
141 rcu_dereference_protected(p, lockdep_rtnl_is_held())
144 * RCU_INIT_POINTER() - initialize an RCU protected pointer
146 * Initialize an RCU-protected pointer in such a way to avoid RCU-lockdep
149 #define RCU_INIT_POINTER(p, v) \
150 p = (typeof(*v) __force __rcu *)(v)
152 static inline bool skb_has_frag_list(const struct sk_buff *skb)
154 return skb_shinfo(skb)->frag_list != NULL;
157 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */
159 #endif /* LINUX_26_37_COMPAT_H */