aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2010-11-28 16:27:07 -0500
committerJames Morris <jmorris@namei.org>2010-11-28 16:27:07 -0500
commit1d6d75684d869406e5bb2ac5d3ed9454f52d0cab (patch)
treeafb229254bed6415407b7b7d4641f9f792109966 /include/linux/kernel.h
parent074e61ec3751da9ab88ee66d3818574556c03489 (diff)
parent0f639a3c5ca63dd76ee07de9b02ebf0178ce9a17 (diff)
Merge branch 'master' into next
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h244
1 files changed, 1 insertions, 243 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3f648d204c37..a35b4f7332f0 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
24extern const char linux_banner[];
25extern 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))
@@ -112,31 +110,6 @@ extern const char linux_proc_banner[];
112 */ 110 */
113#define lower_32_bits(n) ((u32)(n)) 111#define lower_32_bits(n) ((u32)(n))
114 112
115#define KERN_EMERG "<0>" /* system is unusable */
116#define KERN_ALERT "<1>" /* action must be taken immediately */
117#define KERN_CRIT "<2>" /* critical conditions */
118#define KERN_ERR "<3>" /* error conditions */
119#define KERN_WARNING "<4>" /* warning conditions */
120#define KERN_NOTICE "<5>" /* normal but significant condition */
121#define KERN_INFO "<6>" /* informational */
122#define KERN_DEBUG "<7>" /* debug-level messages */
123
124/* Use the default kernel loglevel */
125#define KERN_DEFAULT "<d>"
126/*
127 * Annotation for a "continued" line of log printout (only done after a
128 * line that had no enclosing \n). Only to be used by core/arch code
129 * during early bootup (a continued line is not SMP-safe otherwise).
130 */
131#define KERN_CONT "<c>"
132
133extern int console_printk[];
134
135#define console_loglevel (console_printk[0])
136#define default_message_loglevel (console_printk[1])
137#define minimum_console_loglevel (console_printk[2])
138#define default_console_loglevel (console_printk[3])
139
140struct completion; 113struct completion;
141struct pt_regs; 114struct pt_regs;
142struct user; 115struct user;
@@ -189,11 +162,6 @@ static inline void might_fault(void)
189} 162}
190#endif 163#endif
191 164
192struct va_format {
193 const char *fmt;
194 va_list *va;
195};
196
197extern struct atomic_notifier_head panic_notifier_list; 165extern struct atomic_notifier_head panic_notifier_list;
198extern long (*panic_blink)(int state); 166extern long (*panic_blink)(int state);
199NORET_TYPE void panic(const char * fmt, ...) 167NORET_TYPE void panic(const char * fmt, ...)
@@ -247,114 +215,8 @@ extern int func_ptr_is_kernel_text(void *ptr);
247struct pid; 215struct pid;
248extern struct pid *session_of_pgrp(struct pid *pgrp); 216extern struct pid *session_of_pgrp(struct pid *pgrp);
249 217
250/*
251 * FW_BUG
252 * Add this to a message where you are sure the firmware is buggy or behaves
253 * really stupid or out of spec. Be aware that the responsible BIOS developer
254 * should be able to fix this issue or at least get a concrete idea of the
255 * problem by reading your message without the need of looking at the kernel
256 * code.
257 *
258 * Use it for definite and high priority BIOS bugs.
259 *
260 * FW_WARN
261 * Use it for not that clear (e.g. could the kernel messed up things already?)
262 * and medium priority BIOS bugs.
263 *
264 * FW_INFO
265 * Use this one if you want to tell the user or vendor about something
266 * suspicious, but generally harmless related to the firmware.
267 *
268 * Use it for information or very low priority BIOS bugs.
269 */
270#define FW_BUG "[Firmware Bug]: "
271#define FW_WARN "[Firmware Warn]: "
272#define FW_INFO "[Firmware Info]: "
273
274/*
275 * HW_ERR
276 * Add this to a message for hardware errors, so that user can report
277 * it to hardware vendor instead of LKML or software vendor.
278 */
279#define HW_ERR "[Hardware Error]: "
280
281#ifdef CONFIG_PRINTK
282asmlinkage int vprintk(const char *fmt, va_list args)
283 __attribute__ ((format (printf, 1, 0)));
284asmlinkage int printk(const char * fmt, ...)
285 __attribute__ ((format (printf, 1, 2))) __cold;
286
287/*
288 * Please don't use printk_ratelimit(), because it shares ratelimiting state
289 * with all other unrelated printk_ratelimit() callsites. Instead use
290 * printk_ratelimited() or plain old __ratelimit().
291 */
292extern int __printk_ratelimit(const char *func);
293#define printk_ratelimit() __printk_ratelimit(__func__)
294extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
295 unsigned int interval_msec);
296
297extern int printk_delay_msec;
298
299/*
300 * Print a one-time message (analogous to WARN_ONCE() et al):
301 */
302#define printk_once(x...) ({ \
303 static bool __print_once; \
304 \
305 if (!__print_once) { \
306 __print_once = true; \
307 printk(x); \
308 } \
309})
310
311void log_buf_kexec_setup(void);
312#else
313static inline int vprintk(const char *s, va_list args)
314 __attribute__ ((format (printf, 1, 0)));
315static inline int vprintk(const char *s, va_list args) { return 0; }
316static inline int printk(const char *s, ...)
317 __attribute__ ((format (printf, 1, 2)));
318static inline int __cold printk(const char *s, ...) { return 0; }
319static inline int printk_ratelimit(void) { return 0; }
320static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
321 unsigned int interval_msec) \
322 { return false; }
323
324/* No effect, but we still get type checking even in the !PRINTK case: */
325#define printk_once(x...) printk(x)
326
327static inline void log_buf_kexec_setup(void)
328{
329}
330#endif
331
332/*
333 * Dummy printk for disabled debugging statements to use whilst maintaining
334 * gcc's format and side-effect checking.
335 */
336static inline __attribute__ ((format (printf, 1, 2)))
337int no_printk(const char *s, ...) { return 0; }
338
339extern int printk_needs_cpu(int cpu);
340extern void printk_tick(void);
341
342extern void asmlinkage __attribute__((format(printf, 1, 2)))
343 early_printk(const char *fmt, ...);
344
345unsigned long int_sqrt(unsigned long); 218unsigned long int_sqrt(unsigned long);
346 219
347static inline void console_silent(void)
348{
349 console_loglevel = 0;
350}
351
352static inline void console_verbose(void)
353{
354 if (console_loglevel)
355 console_loglevel = 15;
356}
357
358extern void bust_spinlocks(int yes); 220extern void bust_spinlocks(int yes);
359extern void wake_up_klogd(void); 221extern void wake_up_klogd(void);
360extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ 222extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */
@@ -391,22 +253,6 @@ extern enum system_states {
391#define TAINT_CRAP 10 253#define TAINT_CRAP 10
392#define TAINT_FIRMWARE_WORKAROUND 11 254#define TAINT_FIRMWARE_WORKAROUND 11
393 255
394extern void dump_stack(void) __cold;
395
396enum {
397 DUMP_PREFIX_NONE,
398 DUMP_PREFIX_ADDRESS,
399 DUMP_PREFIX_OFFSET
400};
401extern void hex_dump_to_buffer(const void *buf, size_t len,
402 int rowsize, int groupsize,
403 char *linebuf, size_t linebuflen, bool ascii);
404extern void print_hex_dump(const char *level, const char *prefix_str,
405 int prefix_type, int rowsize, int groupsize,
406 const void *buf, size_t len, bool ascii);
407extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
408 const void *buf, size_t len);
409
410extern const char hex_asc[]; 256extern const char hex_asc[];
411#define hex_asc_lo(x) hex_asc[((x) & 0x0f)] 257#define hex_asc_lo(x) hex_asc[((x) & 0x0f)]
412#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4] 258#define hex_asc_hi(x) hex_asc[((x) & 0xf0) >> 4]
@@ -420,94 +266,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
420 266
421extern int hex_to_bin(char ch); 267extern int hex_to_bin(char ch);
422 268
423#ifndef pr_fmt
424#define pr_fmt(fmt) fmt
425#endif
426
427#define pr_emerg(fmt, ...) \
428 printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
429#define pr_alert(fmt, ...) \
430 printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
431#define pr_crit(fmt, ...) \
432 printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
433#define pr_err(fmt, ...) \
434 printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
435#define pr_warning(fmt, ...) \
436 printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
437#define pr_warn pr_warning
438#define pr_notice(fmt, ...) \
439 printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
440#define pr_info(fmt, ...) \
441 printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
442#define pr_cont(fmt, ...) \
443 printk(KERN_CONT fmt, ##__VA_ARGS__)
444
445/* pr_devel() should produce zero code unless DEBUG is defined */
446#ifdef DEBUG
447#define pr_devel(fmt, ...) \
448 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
449#else
450#define pr_devel(fmt, ...) \
451 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
452#endif
453
454/* If you are writing a driver, please use dev_dbg instead */
455#if defined(DEBUG)
456#define pr_debug(fmt, ...) \
457 printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
458#elif defined(CONFIG_DYNAMIC_DEBUG)
459/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
460#define pr_debug(fmt, ...) \
461 dynamic_pr_debug(fmt, ##__VA_ARGS__)
462#else
463#define pr_debug(fmt, ...) \
464 ({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
465#endif
466
467/*
468 * ratelimited messages with local ratelimit_state,
469 * no local ratelimit_state used in the !PRINTK case
470 */
471#ifdef CONFIG_PRINTK
472#define printk_ratelimited(fmt, ...) ({ \
473 static DEFINE_RATELIMIT_STATE(_rs, \
474 DEFAULT_RATELIMIT_INTERVAL, \
475 DEFAULT_RATELIMIT_BURST); \
476 \
477 if (__ratelimit(&_rs)) \
478 printk(fmt, ##__VA_ARGS__); \
479})
480#else
481/* No effect, but we still get type checking even in the !PRINTK case: */
482#define printk_ratelimited printk
483#endif
484
485#define pr_emerg_ratelimited(fmt, ...) \
486 printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
487#define pr_alert_ratelimited(fmt, ...) \
488 printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__)
489#define pr_crit_ratelimited(fmt, ...) \
490 printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__)
491#define pr_err_ratelimited(fmt, ...) \
492 printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
493#define pr_warning_ratelimited(fmt, ...) \
494 printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
495#define pr_warn_ratelimited pr_warning_ratelimited
496#define pr_notice_ratelimited(fmt, ...) \
497 printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__)
498#define pr_info_ratelimited(fmt, ...) \
499 printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)
500/* no pr_cont_ratelimited, don't do that... */
501/* If you are writing a driver, please use dev_dbg instead */
502#if defined(DEBUG)
503#define pr_debug_ratelimited(fmt, ...) \
504 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
505#else
506#define pr_debug_ratelimited(fmt, ...) \
507 ({ if (0) printk_ratelimited(KERN_DEBUG pr_fmt(fmt), \
508 ##__VA_ARGS__); 0; })
509#endif
510
511/* 269/*
512 * General tracing related utility functions - trace_printk(), 270 * General tracing related utility functions - trace_printk(),
513 * tracing_on/tracing_off and tracing_start()/tracing_stop 271 * tracing_on/tracing_off and tracing_start()/tracing_stop