Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | #ifndef __KERNEL_PRINTK__ #define __KERNEL_PRINTK__ #include <log.h> #include <stdio.h> #include <linux/compiler.h> #define KERN_EMERG "" #define KERN_ALERT "" #define KERN_CRIT "" #define KERN_ERR "" #define KERN_WARNING "" #define KERN_NOTICE "" #define KERN_INFO "" #define KERN_DEBUG "" #define KERN_CONT "" #define printk(fmt, ...) \ printf(fmt, ##__VA_ARGS__) /* * Dummy printk for disabled debugging statements to use whilst maintaining * gcc's format checking. */ #define no_printk(fmt, ...) \ ({ \ if (0) \ printk(fmt, ##__VA_ARGS__); \ 0; \ }) #ifndef pr_fmt #define pr_fmt(fmt) fmt #endif #define pr_emerg(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 0 ? log_emerg(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_alert(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 1 ? log_alert(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_crit(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 2 ? log_crit(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_err(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 3 ? log_err(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_warn(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 4 ? log_warning(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_notice(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 5 ? log_notice(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_info(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 6 ? log_info(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_debug(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 7 ? log_debug(fmt, ##__VA_ARGS__) : 0; \ }) #define pr_devel(fmt, ...) \ ({ \ CONFIG_LOGLEVEL > 7 ? log_debug(fmt, ##__VA_ARGS__) : 0; \ }) #ifdef CONFIG_LOG #define pr_cont(fmt, ...) \ ({ \ gd->logl_prev < CONFIG_LOGLEVEL ? \ log_cont(fmt, ##__VA_ARGS__) : 0; \ }) #else #define pr_cont(fmt, ...) \ printk(fmt, ##__VA_ARGS__) #endif #define printk_once(fmt, ...) \ printk(fmt, ##__VA_ARGS__) /* _once variants - just call the base function (no actual once tracking) */ #define pr_warn_once(fmt, ...) pr_warn(fmt, ##__VA_ARGS__) #define pr_info_once(fmt, ...) pr_info(fmt, ##__VA_ARGS__) #define pr_notice_once(fmt, ...) pr_notice(fmt, ##__VA_ARGS__) /* _ratelimited variants - just call the base function (no rate limiting) */ #define printk_ratelimited(fmt, ...) printk(fmt, ##__VA_ARGS__) #define pr_notice_ratelimited(fmt, ...) pr_notice(fmt, ##__VA_ARGS__) #define pr_warn_ratelimited(fmt, ...) pr_warn(fmt, ##__VA_ARGS__) #define pr_err_ratelimited(fmt, ...) pr_err(fmt, ##__VA_ARGS__) struct va_format { const char *fmt; va_list *va; }; #endif |