1 #ifndef __KERNEL_H_WRAPPER
2 #define __KERNEL_H_WRAPPER 1
4 #include_next <linux/kernel.h>
6 #include <linux/log2.h>
9 #include <linux/version.h>
11 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
13 #define pr_emerg(fmt, ...) \
14 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
16 #define pr_alert(fmt, ...) \
17 printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
19 #define pr_crit(fmt, ...) \
20 printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
22 #define pr_err(fmt, ...) \
23 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
25 #define pr_warning(fmt, ...) \
26 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
28 #define pr_notice(fmt, ...) \
29 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
31 #define pr_info(fmt, ...) \
32 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
34 #define pr_cont(fmt, ...) \
35 printk(KERN_CONT fmt, ##__VA_ARGS__)
38 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
39 #define pr_warn pr_warning
42 #if defined(CONFIG_PREEMPT) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)
43 #error "CONFIG_PREEMPT is broken before 2.6.21--see commit 4498121ca3, \"[NET]: Handle disabled preemption in gfp_any()\""
47 #define USHRT_MAX ((u16)(~0U))
48 #define SHRT_MAX ((s16)(USHRT_MAX>>1))
49 #define SHRT_MIN ((s16)(-SHRT_MAX - 1))
53 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
56 #endif /* linux/kernel.h */