diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 16:37:37 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 16:37:37 -0500 |
| commit | 968ab1838a5d48f02f5b471aa1d0e59e2cc2ccbc (patch) | |
| tree | 0f4258c00afbb2a8ad137acf34805cfeb0ed1077 /include/linux | |
| parent | 22d3243de86bc92d874abb7c5b185d5c47aba323 (diff) | |
include/linux/kernel.h: Move logging bits to include/linux/printk.h
Move the logging bits from kernel.h into printk.h so that
there is a bit more logical separation of the generic from
the printk logging specific parts.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kernel.h | 245 | ||||
| -rw-r--r-- | include/linux/printk.h | 248 |
2 files changed, 249 insertions, 244 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index fc3da9e4da19..b6de9a6f7018 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -17,13 +17,11 @@ | |||
| 17 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
| 18 | #include <linux/log2.h> | 18 | #include <linux/log2.h> |
| 19 | #include <linux/typecheck.h> | 19 | #include <linux/typecheck.h> |
| 20 | #include <linux/printk.h> | ||
| 20 | #include <linux/dynamic_debug.h> | 21 | #include <linux/dynamic_debug.h> |
| 21 | #include <asm/byteorder.h> | 22 | #include <asm/byteorder.h> |
| 22 | #include <asm/bug.h> | 23 | #include <asm/bug.h> |
| 23 | 24 | ||
| 24 | extern const char linux_banner[]; | ||
| 25 | extern const char linux_proc_banner[]; | ||
| 26 | |||
| 27 | #define USHRT_MAX ((u16)(~0U)) | 25 | #define USHRT_MAX ((u16)(~0U)) |
| 28 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) | 26 | #define SHRT_MAX ((s16)(USHRT_MAX>>1)) |
| 29 | #define SHRT_MIN ((s16)(-SHRT_MAX - 1)) | 27 | #define SHRT_MIN ((s16)(-SHRT_MAX - 1)) |
| @@ -110,31 +108,6 @@ extern const char linux_proc_banner[]; | |||
| 110 | */ | 108 | */ |
| 111 | #define lower_32_bits(n) ((u32)(n)) | 109 | #define lower_32_bits(n) ((u32)(n)) |
| 112 | 110 | ||
| 113 | #define KERN_EMERG "<0>" /* system is unusable */ | ||
| 114 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | ||
| 115 | #define KERN_CRIT "<2>" /* critical conditions */ | ||
| 116 | #define KERN_ERR "<3>" /* error conditions */ | ||
| 117 | #define KERN_WARNING "<4>" /* warning conditions */ | ||
| 118 | #define KERN_NOTICE "<5>" /* normal but significant condition */ | ||
| 119 | #define KERN_INFO "<6>" /* informational */ | ||
| 120 | #define KERN_DEBUG "<7>" /* debug-level messages */ | ||
| 121 | |||
| 122 | /* Use the default kernel loglevel */ | ||
| 123 | #define KERN_DEFAULT "<d>" | ||
| 124 | /* | ||
| 125 | * Annotation for a "continued" line of log printout (only done after a | ||
| 126 | * line that had no enclosing \n). Only to be used by core/arch code | ||
| 127 | * during early bootup (a continued line is not SMP-safe otherwise). | ||
| 128 | */ | ||
| 129 | #define KERN_CONT "<c>" | ||
| 130 | |||
| 131 | extern int console_printk[]; | ||
| 132 | |||
| 133 | #define console_loglevel (console_printk[0]) | ||
| 134 | #define default_message_loglevel (console_printk[1]) | ||
| 135 | #define minimum_console_loglevel (console_printk[2]) | ||
| 136 | #define default_console_loglevel (console_printk[3]) | ||
| 137 | |||
| 138 | struct completion; | 111 | struct completion; |
| 139 | struct pt_regs; | 112 | struct pt_regs; |
| 140 | struct user; | 113 | struct user; |
| @@ -187,11 +160,6 @@ static inline void might_fault(void) | |||
| 187 | } | 160 | } |
| 188 | #endif | 161 | #endif |
| 189 | 162 | ||
| 190 | struct va_format { | ||
| 191 | const char *fmt; | ||
| 192 | va_list *va; | ||
| 193 | }; | ||
| 194 | |||
| 195 | extern struct atomic_notifier_head panic_notifier_list; | 163 | extern struct atomic_notifier_head panic_notifier_list; |
| 196 | extern long (*panic_blink)(int state); | 164 | extern long (*panic_blink)(int state); |
| 197 | NORET_TYPE void panic(const char * fmt, ...) | 165 | NORET_TYPE void panic(const char * fmt, ...) |
| @@ -245,115 +213,8 @@ extern int func_ptr_is_kernel_text(void *ptr); | |||
| 245 | struct pid; | 213 | struct pid; |
| 246 | extern struct pid *session_of_pgrp(struct pid *pgrp); | 214 | extern struct pid *session_of_pgrp(struct pid *pgrp); |
| 247 | 215 | ||
| 248 | /* | ||
| 249 | * FW_BUG | ||
| 250 | * Add this to a message where you are sure the firmware is buggy or behaves | ||
| 251 | * really stupid or out of spec. Be aware that the responsible BIOS developer | ||
| 252 | * should be able to fix this issue or at least get a concrete idea of the | ||
| 253 | * problem by reading your message without the need of looking at the kernel | ||
| 254 | * code. | ||
| 255 | * | ||
| 256 | * Use it for definite and high priority BIOS bugs. | ||
| 257 | * | ||
| 258 | * FW_WARN | ||
| 259 | * Use it for not that clear (e.g. could the kernel messed up things already?) | ||
| 260 | * and medium priority BIOS bugs. | ||
| 261 | * | ||
| 262 | * FW_INFO | ||
| 263 | * Use this one if you want to tell the user or vendor about something | ||
| 264 | * suspicious, but generally harmless related to the firmware. | ||
| 265 | * | ||
| 266 | * Use it for information or very low priority BIOS bugs. | ||
| 267 | */ | ||
| 268 | #define FW_BUG "[Firmware Bug]: " | ||
| 269 | #define FW_WARN "[Firmware Warn]: " | ||
| 270 | #define FW_INFO "[Firmware Info]: " | ||
| 271 | |||
| 272 | /* | ||
| 273 | * HW_ERR | ||
| 274 | * Add this to a message for hardware errors, so that user can report | ||
| 275 | * it to hardware vendor instead of LKML or software vendor. | ||
| 276 | */ | ||
| 277 | #define HW_ERR "[Hardware Error]: " | ||
| 278 | |||
| 279 | #ifdef CONFIG_PRINTK | ||
| 280 | asmlinkage int vprintk(const char *fmt, va_list args) | ||
| 281 | __attribute__ ((format (printf, 1, 0))); | ||
| 282 | asmlinkage int printk(const char * fmt, ...) | ||
| 283 | __attribute__ ((format (printf, 1, 2))) __cold; | ||
| 284 | |||
| 285 | /* | ||
| 286 | * Please don't use printk_ratelimit(), because it shares ratelimiting state | ||
| 287 | * with all other unrelated printk_ratelimit() callsites. Instead use | ||
| 288 | * printk_ratelimited() or plain old __ratelimit(). | ||
| 289 | */ | ||
| 290 | extern int __printk_ratelimit(const char *func); | ||
| 291 | #define printk_ratelimit() __printk_ratelimit(__func__) | ||
| 292 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | ||
| 293 | unsigned int interval_msec); | ||
| 294 | |||
| 295 | extern int printk_delay_msec; | ||
| 296 | extern int dmesg_restrict; | ||
| 297 | |||
| 298 | /* | ||
| 299 | * Print a one-time message (analogous to WARN_ONCE() et al): | ||
| 300 | */ | ||
| 301 | #define printk_once(x...) ({ \ | ||
| 302 | static bool __print_once; \ | ||
| 303 | \ | ||
| 304 | if (!__print_once) { \ | ||
| 305 | __print_once = true; \ | ||
| 306 | printk(x); \ | ||
| 307 | } \ | ||
| 308 | }) | ||
| 309 | |||
| 310 | void log_buf_kexec_setup(void); | ||
| 311 | #else | ||
| 312 | static inline int vprintk(const char *s, va_list args) | ||
| 313 | __attribute__ ((format (printf, 1, 0))); | ||
| 314 | static inline int vprintk(const char *s, va_list args) { return 0; } | ||
| 315 | static inline int printk(const char *s, ...) | ||
| 316 | __attribute__ ((format (printf, 1, 2))); | ||
| 317 | static inline int __cold printk(const char *s, ...) { return 0; } | ||
| 318 | static inline int printk_ratelimit(void) { return 0; } | ||
| 319 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | ||
| 320 | unsigned int interval_msec) \ | ||
| 321 | { return false; } | ||
| 322 | |||
| 323 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
| 324 | #define printk_once(x...) printk(x) | ||
| 325 | |||
| 326 | static inline void log_buf_kexec_setup(void) | ||
| 327 | { | ||
| 328 | } | ||
| 329 | #endif | ||
| 330 | |||
| 331 | /* | ||
| 332 | * Dummy printk for disabled debugging statements to use whilst maintaining | ||
| 333 | * gcc's format and side-effect checking. | ||
| 334 | */ | ||
| 335 | static inline __attribute__ ((format (printf, 1, 2))) | ||
| 336 | int no_printk(const char *s, ...) { return 0; } | ||
| 337 | |||
| 338 | extern int printk_needs_cpu(int cpu); | ||
| 339 | extern void printk_tick(void); | ||
| 340 | |||
| 341 | extern void asmlinkage __attribute__((format(printf, 1, 2))) | ||
| 342 | early_printk(const char *fmt, ...); | ||
| 343 | |||
| 344 | unsigned long int_sqrt(unsigned long); | 216 | unsigned long int_sqrt(unsigned long); |
| 345 | 217 | ||
| 346 | static inline void console_silent(void) | ||
| 347 | { | ||
| 348 | console_loglevel = 0; | ||
| 349 | } | ||
| 350 | |||
| 351 | static inline void console_verbose(void) | ||
| 352 | { | ||
| 353 | if (console_loglevel) | ||
| 354 | console_loglevel = 15; | ||
| 355 | } | ||
| 356 | |||
| 357 | extern void bust_spinlocks(int yes); | 218 | extern void bust_spinlocks(int yes); |
| 358 | extern void wake_up_klogd(void); | 219 | extern void wake_up_klogd(void); |
| 359 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 220 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
| @@ -390,22 +251,6 @@ extern enum system_states { | |||
| 390 | #define TAINT_CRAP 10 | 251 | #define TAINT_CRAP 10 |
| 391 | #define TAINT_FIRMWARE_WORKAROUND 11 | 252 | #define TAINT_FIRMWARE_WORKAROUND 11 |
| 392 | 253 | ||
| 393 | extern void dump_stack(void) __cold; | ||
| 394 | |||
| 395 | |||
