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,35)
12 #define pr_warn pr_warning
16 * Print a one-time message (analogous to WARN_ONCE() et al):
18 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
20 #define printk_once(fmt, ...) \
22 static bool __print_once; \
24 if (!__print_once) { \
25 __print_once = true; \
26 printk(fmt, ##__VA_ARGS__); \
30 #define pr_emerg_once(fmt, ...) \
31 printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
32 #define pr_alert_once(fmt, ...) \
33 printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
34 #define pr_crit_once(fmt, ...) \
35 printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
36 #define pr_err_once(fmt, ...) \
37 printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
38 #define pr_warn_once(fmt, ...) \
39 printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
40 #define pr_notice_once(fmt, ...) \
41 printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
42 #define pr_info_once(fmt, ...) \
43 printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
44 #define pr_cont_once(fmt, ...) \
45 printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__)
50 #define USHRT_MAX ((u16)(~0U))
51 #define SHRT_MAX ((s16)(USHRT_MAX>>1))
52 #define SHRT_MIN ((s16)(-SHRT_MAX - 1))
56 #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
60 #define rounddown(x, y) ( \
62 typeof(x) __x = (x); \
68 #endif /* linux/kernel.h */