1 #ifndef LINUX_26_38_COMPAT_H
2 #define LINUX_26_38_COMPAT_H
4 #include <linux/version.h>
6 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38))
8 #include <linux/kernel.h>
9 #include <linux/skbuff.h>
11 /* rename member in struct mmc_host in include/linux/mmc/host.h */
12 #define max_segs max_hw_segs
15 /* Exponentially weighted moving average (EWMA) */
17 /* For more documentation see lib/average.c */
20 unsigned long internal;
25 extern void ewma_init(struct ewma *avg, unsigned long factor,
26 unsigned long weight);
28 extern struct ewma *ewma_add(struct ewma *avg, unsigned long val);
31 * ewma_read() - Get average value
32 * @avg: Average structure
34 * Returns the average value held in @avg.
36 static inline unsigned long ewma_read(const struct ewma *avg)
38 return DIV_ROUND_CLOSEST(avg->internal, avg->factor);
41 #define pr_warn pr_warning
42 #define create_freezable_workqueue create_freezeable_workqueue
44 static inline int skb_checksum_start_offset(const struct sk_buff *skb)
46 return skb->csum_start - skb_headroom(skb);
49 /* from include/linux/printk.h */
50 #define pr_emerg_once(fmt, ...) \
51 printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
52 #define pr_alert_once(fmt, ...) \
53 printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
54 #define pr_crit_once(fmt, ...) \
55 printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
56 #define pr_err_once(fmt, ...) \
57 printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
58 #define pr_warn_once(fmt, ...) \
59 printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
60 #define pr_notice_once(fmt, ...) \
61 printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
62 #define pr_info_once(fmt, ...) \
63 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
64 #define pr_cont_once(fmt, ...) \
65 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
67 #define pr_debug_once(fmt, ...) \
68 printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
70 #define pr_debug_once(fmt, ...) \
71 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
74 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,38)) */
76 #endif /* LINUX_26_38_COMPAT_H */