Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 1 | #ifndef __KERNEL_PRINTK__ |
| 2 | #define __KERNEL_PRINTK__ |
| 3 | |
Mike Travis | 162a7e7 | 2011-05-24 17:13:20 -0700 | [diff] [blame] | 4 | #include <linux/init.h> |
| 5 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 6 | extern const char linux_banner[]; |
| 7 | extern const char linux_proc_banner[]; |
| 8 | |
Joe Perches | 7d1e91a | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 9 | #define KERN_EMERG "<0>" /* system is unusable */ |
| 10 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
| 11 | #define KERN_CRIT "<2>" /* critical conditions */ |
| 12 | #define KERN_ERR "<3>" /* error conditions */ |
| 13 | #define KERN_WARNING "<4>" /* warning conditions */ |
| 14 | #define KERN_NOTICE "<5>" /* normal but significant condition */ |
| 15 | #define KERN_INFO "<6>" /* informational */ |
| 16 | #define KERN_DEBUG "<7>" /* debug-level messages */ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 17 | |
| 18 | /* Use the default kernel loglevel */ |
| 19 | #define KERN_DEFAULT "<d>" |
| 20 | /* |
| 21 | * Annotation for a "continued" line of log printout (only done after a |
| 22 | * line that had no enclosing \n). Only to be used by core/arch code |
| 23 | * during early bootup (a continued line is not SMP-safe otherwise). |
| 24 | */ |
Joe Perches | 7d1e91a | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 25 | #define KERN_CONT "<c>" |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 26 | |
Joe Perches | acc8fa41 | 2012-07-30 14:40:09 -0700 | [diff] [blame^] | 27 | static inline int printk_get_level(const char *buffer) |
| 28 | { |
| 29 | if (buffer[0] == '<' && buffer[1] && buffer[2] == '>') { |
| 30 | switch (buffer[1]) { |
| 31 | case '0' ... '7': |
| 32 | case 'd': /* KERN_DEFAULT */ |
| 33 | case 'c': /* KERN_CONT */ |
| 34 | return buffer[1]; |
| 35 | } |
| 36 | } |
| 37 | return 0; |
| 38 | } |
| 39 | |
| 40 | static inline const char *printk_skip_level(const char *buffer) |
| 41 | { |
| 42 | if (printk_get_level(buffer)) { |
| 43 | switch (buffer[1]) { |
| 44 | case '0' ... '7': |
| 45 | case 'd': /* KERN_DEFAULT */ |
| 46 | case 'c': /* KERN_CONT */ |
| 47 | return buffer + 3; |
| 48 | } |
| 49 | } |
| 50 | return buffer; |
| 51 | } |
| 52 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 53 | extern int console_printk[]; |
| 54 | |
| 55 | #define console_loglevel (console_printk[0]) |
| 56 | #define default_message_loglevel (console_printk[1]) |
| 57 | #define minimum_console_loglevel (console_printk[2]) |
| 58 | #define default_console_loglevel (console_printk[3]) |
| 59 | |
Joe Perches | a9747cc | 2011-01-12 16:59:43 -0800 | [diff] [blame] | 60 | static inline void console_silent(void) |
| 61 | { |
| 62 | console_loglevel = 0; |
| 63 | } |
| 64 | |
| 65 | static inline void console_verbose(void) |
| 66 | { |
| 67 | if (console_loglevel) |
| 68 | console_loglevel = 15; |
| 69 | } |
| 70 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 71 | struct va_format { |
| 72 | const char *fmt; |
| 73 | va_list *va; |
| 74 | }; |
| 75 | |
| 76 | /* |
| 77 | * FW_BUG |
| 78 | * Add this to a message where you are sure the firmware is buggy or behaves |
| 79 | * really stupid or out of spec. Be aware that the responsible BIOS developer |
| 80 | * should be able to fix this issue or at least get a concrete idea of the |
| 81 | * problem by reading your message without the need of looking at the kernel |
| 82 | * code. |
| 83 | * |
| 84 | * Use it for definite and high priority BIOS bugs. |
| 85 | * |
| 86 | * FW_WARN |
| 87 | * Use it for not that clear (e.g. could the kernel messed up things already?) |
| 88 | * and medium priority BIOS bugs. |
| 89 | * |
| 90 | * FW_INFO |
| 91 | * Use this one if you want to tell the user or vendor about something |
| 92 | * suspicious, but generally harmless related to the firmware. |
| 93 | * |
| 94 | * Use it for information or very low priority BIOS bugs. |
| 95 | */ |
| 96 | #define FW_BUG "[Firmware Bug]: " |
| 97 | #define FW_WARN "[Firmware Warn]: " |
| 98 | #define FW_INFO "[Firmware Info]: " |
| 99 | |
| 100 | /* |
| 101 | * HW_ERR |
| 102 | * Add this to a message for hardware errors, so that user can report |
| 103 | * it to hardware vendor instead of LKML or software vendor. |
| 104 | */ |
| 105 | #define HW_ERR "[Hardware Error]: " |
| 106 | |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 107 | /* |
| 108 | * Dummy printk for disabled debugging statements to use whilst maintaining |
| 109 | * gcc's format and side-effect checking. |
| 110 | */ |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 111 | static inline __printf(1, 2) |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 112 | int no_printk(const char *fmt, ...) |
| 113 | { |
| 114 | return 0; |
| 115 | } |
| 116 | |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 117 | extern asmlinkage __printf(1, 2) |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 118 | void early_printk(const char *fmt, ...); |
| 119 | |
| 120 | extern int printk_needs_cpu(int cpu); |
| 121 | extern void printk_tick(void); |
| 122 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 123 | #ifdef CONFIG_PRINTK |
Kay Sievers | 7ff9554 | 2012-05-03 02:29:13 +0200 | [diff] [blame] | 124 | asmlinkage __printf(5, 0) |
| 125 | int vprintk_emit(int facility, int level, |
| 126 | const char *dict, size_t dictlen, |
| 127 | const char *fmt, va_list args); |
| 128 | |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 129 | asmlinkage __printf(1, 0) |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 130 | int vprintk(const char *fmt, va_list args); |
Kay Sievers | 7ff9554 | 2012-05-03 02:29:13 +0200 | [diff] [blame] | 131 | |
| 132 | asmlinkage __printf(5, 6) __cold |
| 133 | asmlinkage int printk_emit(int facility, int level, |
| 134 | const char *dict, size_t dictlen, |
| 135 | const char *fmt, ...); |
| 136 | |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 137 | asmlinkage __printf(1, 2) __cold |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 138 | int printk(const char *fmt, ...); |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 139 | |
| 140 | /* |
Peter Zijlstra | 3ccf3e8 | 2012-02-27 10:47:00 +0100 | [diff] [blame] | 141 | * Special printk facility for scheduler use only, _DO_NOT_USE_ ! |
| 142 | */ |
| 143 | __printf(1, 2) __cold int printk_sched(const char *fmt, ...); |
| 144 | |
| 145 | /* |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 146 | * Please don't use printk_ratelimit(), because it shares ratelimiting state |
| 147 | * with all other unrelated printk_ratelimit() callsites. Instead use |
| 148 | * printk_ratelimited() or plain old __ratelimit(). |
| 149 | */ |
| 150 | extern int __printk_ratelimit(const char *func); |
| 151 | #define printk_ratelimit() __printk_ratelimit(__func__) |
| 152 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 153 | unsigned int interval_msec); |
| 154 | |
| 155 | extern int printk_delay_msec; |
| 156 | extern int dmesg_restrict; |
Dan Rosenberg | 455cd5a | 2011-01-12 16:59:41 -0800 | [diff] [blame] | 157 | extern int kptr_restrict; |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 158 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 159 | void log_buf_kexec_setup(void); |
Mike Travis | 162a7e7 | 2011-05-24 17:13:20 -0700 | [diff] [blame] | 160 | void __init setup_log_buf(int early); |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 161 | #else |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 162 | static inline __printf(1, 0) |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 163 | int vprintk(const char *s, va_list args) |
| 164 | { |
| 165 | return 0; |
| 166 | } |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 167 | static inline __printf(1, 2) __cold |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 168 | int printk(const char *s, ...) |
| 169 | { |
| 170 | return 0; |
| 171 | } |
Peter Zijlstra | 3ccf3e8 | 2012-02-27 10:47:00 +0100 | [diff] [blame] | 172 | static inline __printf(1, 2) __cold |
| 173 | int printk_sched(const char *s, ...) |
| 174 | { |
| 175 | return 0; |
| 176 | } |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 177 | static inline int printk_ratelimit(void) |
| 178 | { |
| 179 | return 0; |
| 180 | } |
| 181 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 182 | unsigned int interval_msec) |
| 183 | { |
| 184 | return false; |
| 185 | } |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 186 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 187 | static inline void log_buf_kexec_setup(void) |
| 188 | { |
| 189 | } |
Mike Travis | 162a7e7 | 2011-05-24 17:13:20 -0700 | [diff] [blame] | 190 | |
| 191 | static inline void setup_log_buf(int early) |
| 192 | { |
| 193 | } |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 194 | #endif |
| 195 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 196 | extern void dump_stack(void) __cold; |
| 197 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 198 | #ifndef pr_fmt |
| 199 | #define pr_fmt(fmt) fmt |
| 200 | #endif |
| 201 | |
| 202 | #define pr_emerg(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 203 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 204 | #define pr_alert(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 205 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 206 | #define pr_crit(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 207 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 208 | #define pr_err(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 209 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 210 | #define pr_warning(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 211 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 212 | #define pr_warn pr_warning |
| 213 | #define pr_notice(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 214 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 215 | #define pr_info(fmt, ...) \ |
Joe Perches | a3f938b | 2011-01-12 16:59:48 -0800 | [diff] [blame] | 216 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 217 | #define pr_cont(fmt, ...) \ |
| 218 | printk(KERN_CONT fmt, ##__VA_ARGS__) |
| 219 | |
| 220 | /* pr_devel() should produce zero code unless DEBUG is defined */ |
| 221 | #ifdef DEBUG |
| 222 | #define pr_devel(fmt, ...) \ |
| 223 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 224 | #else |
| 225 | #define pr_devel(fmt, ...) \ |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 226 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 227 | #endif |
| 228 | |
| 229 | /* If you are writing a driver, please use dev_dbg instead */ |
Jim Cromie | b558c96 | 2011-12-19 17:11:18 -0500 | [diff] [blame] | 230 | #if defined(CONFIG_DYNAMIC_DEBUG) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 231 | /* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ |
| 232 | #define pr_debug(fmt, ...) \ |
| 233 | dynamic_pr_debug(fmt, ##__VA_ARGS__) |
Jim Cromie | b558c96 | 2011-12-19 17:11:18 -0500 | [diff] [blame] | 234 | #elif defined(DEBUG) |
| 235 | #define pr_debug(fmt, ...) \ |
| 236 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 237 | #else |
| 238 | #define pr_debug(fmt, ...) \ |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 239 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 240 | #endif |
| 241 | |
| 242 | /* |
Joe Perches | 16cb839 | 2011-01-12 16:59:46 -0800 | [diff] [blame] | 243 | * Print a one-time message (analogous to WARN_ONCE() et al): |
| 244 | */ |
| 245 | |
| 246 | #ifdef CONFIG_PRINTK |
| 247 | #define printk_once(fmt, ...) \ |
| 248 | ({ \ |
| 249 | static bool __print_once; \ |
| 250 | \ |
| 251 | if (!__print_once) { \ |
| 252 | __print_once = true; \ |
| 253 | printk(fmt, ##__VA_ARGS__); \ |
| 254 | } \ |
| 255 | }) |
| 256 | #else |
| 257 | #define printk_once(fmt, ...) \ |
| 258 | no_printk(fmt, ##__VA_ARGS__) |
| 259 | #endif |
| 260 | |
| 261 | #define pr_emerg_once(fmt, ...) \ |
| 262 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
| 263 | #define pr_alert_once(fmt, ...) \ |
| 264 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
| 265 | #define pr_crit_once(fmt, ...) \ |
| 266 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
| 267 | #define pr_err_once(fmt, ...) \ |
| 268 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
| 269 | #define pr_warn_once(fmt, ...) \ |
| 270 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
| 271 | #define pr_notice_once(fmt, ...) \ |
| 272 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
| 273 | #define pr_info_once(fmt, ...) \ |
| 274 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
| 275 | #define pr_cont_once(fmt, ...) \ |
| 276 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) |
| 277 | /* If you are writing a driver, please use dev_dbg instead */ |
| 278 | #if defined(DEBUG) |
| 279 | #define pr_debug_once(fmt, ...) \ |
| 280 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 281 | #else |
| 282 | #define pr_debug_once(fmt, ...) \ |
| 283 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 284 | #endif |
| 285 | |
| 286 | /* |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 287 | * ratelimited messages with local ratelimit_state, |
| 288 | * no local ratelimit_state used in the !PRINTK case |
| 289 | */ |
| 290 | #ifdef CONFIG_PRINTK |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 291 | #define printk_ratelimited(fmt, ...) \ |
| 292 | ({ \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 293 | static DEFINE_RATELIMIT_STATE(_rs, \ |
| 294 | DEFAULT_RATELIMIT_INTERVAL, \ |
| 295 | DEFAULT_RATELIMIT_BURST); \ |
| 296 | \ |
| 297 | if (__ratelimit(&_rs)) \ |
| 298 | printk(fmt, ##__VA_ARGS__); \ |
| 299 | }) |
| 300 | #else |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 301 | #define printk_ratelimited(fmt, ...) \ |
| 302 | no_printk(fmt, ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 303 | #endif |
| 304 | |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 305 | #define pr_emerg_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 306 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 307 | #define pr_alert_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 308 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 309 | #define pr_crit_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 310 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 311 | #define pr_err_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 312 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 313 | #define pr_warn_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 314 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 315 | #define pr_notice_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 316 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 317 | #define pr_info_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 318 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
| 319 | /* no pr_cont_ratelimited, don't do that... */ |
| 320 | /* If you are writing a driver, please use dev_dbg instead */ |
| 321 | #if defined(DEBUG) |
Joe Perches | 6ec42a56 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 322 | #define pr_debug_ratelimited(fmt, ...) \ |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 323 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
| 324 | #else |
| 325 | #define pr_debug_ratelimited(fmt, ...) \ |
Joe Perches | 5264f2f | 2011-01-12 16:59:45 -0800 | [diff] [blame] | 326 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 327 | #endif |
| 328 | |
Kay Sievers | e11fea9 | 2012-05-03 02:29:41 +0200 | [diff] [blame] | 329 | extern const struct file_operations kmsg_fops; |
| 330 | |
Joe Perches | ac83ed6 | 2011-01-12 16:59:47 -0800 | [diff] [blame] | 331 | enum { |
| 332 | DUMP_PREFIX_NONE, |
| 333 | DUMP_PREFIX_ADDRESS, |
| 334 | DUMP_PREFIX_OFFSET |
| 335 | }; |
| 336 | extern void hex_dump_to_buffer(const void *buf, size_t len, |
| 337 | int rowsize, int groupsize, |
| 338 | char *linebuf, size_t linebuflen, bool ascii); |
| 339 | #ifdef CONFIG_PRINTK |
| 340 | extern void print_hex_dump(const char *level, const char *prefix_str, |
| 341 | int prefix_type, int rowsize, int groupsize, |
| 342 | const void *buf, size_t len, bool ascii); |
| 343 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
| 344 | const void *buf, size_t len); |
| 345 | #else |
| 346 | static inline void print_hex_dump(const char *level, const char *prefix_str, |
| 347 | int prefix_type, int rowsize, int groupsize, |
| 348 | const void *buf, size_t len, bool ascii) |
| 349 | { |
| 350 | } |
| 351 | static inline void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
| 352 | const void *buf, size_t len) |
| 353 | { |
| 354 | } |
| 355 | |
| 356 | #endif |
| 357 | |
Linus Torvalds | 968ab18 | 2010-11-15 13:37:37 -0800 | [diff] [blame] | 358 | #endif |