diff options
| author | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2008-10-28 11:26:12 -0400 |
| commit | 7a9787e1eba95a166265e6a260cf30af04ef0a99 (patch) | |
| tree | e730a4565e0318140d2fbd2f0415d18a339d7336 /include/linux/kernel.h | |
| parent | 41b9eb264c8407655db57b60b4457fe1b2ec9977 (diff) | |
| parent | 0173a3265b228da319ceb9c1ec6a5682fd1b2d92 (diff) | |
Merge commit 'v2.6.28-rc2' into x86/pci-ioapic-boot-irq-quirks
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 116 |
1 files changed, 69 insertions, 47 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f9cd7a513f9c..396a350b87a6 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -14,6 +14,9 @@ | |||
| 14 | #include <linux/compiler.h> | 14 | #include <linux/compiler.h> |
| 15 | #include <linux/bitops.h> | 15 | #include <linux/bitops.h> |
| 16 | #include <linux/log2.h> | 16 | #include <linux/log2.h> |
| 17 | #include <linux/typecheck.h> | ||
| 18 | #include <linux/ratelimit.h> | ||
| 19 | #include <linux/dynamic_printk.h> | ||
| 17 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
| 18 | #include <asm/bug.h> | 21 | #include <asm/bug.h> |
| 19 | 22 | ||
| @@ -73,6 +76,12 @@ extern const char linux_proc_banner[]; | |||
| 73 | */ | 76 | */ |
| 74 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) | 77 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) |
| 75 | 78 | ||
| 79 | /** | ||
| 80 | * lower_32_bits - return bits 0-31 of a number | ||
| 81 | * @n: the number we're accessing | ||
| 82 | */ | ||
| 83 | #define lower_32_bits(n) ((u32)(n)) | ||
| 84 | |||
| 76 | #define KERN_EMERG "<0>" /* system is unusable */ | 85 | #define KERN_EMERG "<0>" /* system is unusable */ |
| 77 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | 86 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
| 78 | #define KERN_CRIT "<2>" /* critical conditions */ | 87 | #define KERN_CRIT "<2>" /* critical conditions */ |
| @@ -100,6 +109,13 @@ struct completion; | |||
| 100 | struct pt_regs; | 109 | struct pt_regs; |
| 101 | struct user; | 110 | struct user; |
| 102 | 111 | ||
| 112 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
| 113 | extern int _cond_resched(void); | ||
| 114 | # define might_resched() _cond_resched() | ||
| 115 | #else | ||
| 116 | # define might_resched() do { } while (0) | ||
| 117 | #endif | ||
| 118 | |||
| 103 | /** | 119 | /** |
| 104 | * might_sleep - annotation for functions that can sleep | 120 | * might_sleep - annotation for functions that can sleep |
| 105 | * | 121 | * |
| @@ -110,13 +126,6 @@ struct user; | |||
| 110 | * be bitten later when the calling function happens to sleep when it is not | 126 | * be bitten later when the calling function happens to sleep when it is not |
| 111 | * supposed to. | 127 | * supposed to. |
| 112 | */ | 128 | */ |
| 113 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
| 114 | extern int _cond_resched(void); | ||
| 115 | # define might_resched() _cond_resched() | ||
| 116 | #else | ||
| 117 | # define might_resched() do { } while (0) | ||
| 118 | #endif | ||
| 119 | |||
| 120 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 129 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
| 121 | void __might_sleep(char *file, int line); | 130 | void __might_sleep(char *file, int line); |
| 122 | # define might_sleep() \ | 131 | # define might_sleep() \ |
| @@ -174,7 +183,7 @@ extern int vsscanf(const char *, const char *, va_list) | |||
| 174 | 183 | ||
| 175 | extern int get_option(char **str, int *pint); | 184 | extern int get_option(char **str, int *pint); |
| 176 | extern char *get_options(const char *str, int nints, int *ints); | 185 | extern char *get_options(const char *str, int nints, int *ints); |
| 177 | extern unsigned long long memparse(char *ptr, char **retptr); | 186 | extern unsigned long long memparse(const char *ptr, char **retptr); |
| 178 | 187 | ||
| 179 | extern int core_kernel_text(unsigned long addr); | 188 | extern int core_kernel_text(unsigned long addr); |
| 180 | extern int __kernel_text_address(unsigned long addr); | 189 | extern int __kernel_text_address(unsigned long addr); |
| @@ -182,17 +191,38 @@ extern int kernel_text_address(unsigned long addr); | |||
| 182 | struct pid; | 191 | struct pid; |
| 183 | extern struct pid *session_of_pgrp(struct pid *pgrp); | 192 | extern struct pid *session_of_pgrp(struct pid *pgrp); |
| 184 | 193 | ||
| 194 | /* | ||
| 195 | * FW_BUG | ||
| 196 | * Add this to a message where you are sure the firmware is buggy or behaves | ||
| 197 | * really stupid or out of spec. Be aware that the responsible BIOS developer | ||
| 198 | * should be able to fix this issue or at least get a concrete idea of the | ||
| 199 | * problem by reading your message without the need of looking at the kernel | ||
| 200 | * code. | ||
| 201 | * | ||
| 202 | * Use it for definite and high priority BIOS bugs. | ||
| 203 | * | ||
| 204 | * FW_WARN | ||
| 205 | * Use it for not that clear (e.g. could the kernel messed up things already?) | ||
| 206 | * and medium priority BIOS bugs. | ||
| 207 | * | ||
| 208 | * FW_INFO | ||
| 209 | * Use this one if you want to tell the user or vendor about something | ||
| 210 | * suspicious, but generally harmless related to the firmware. | ||
| 211 | * | ||
| 212 | * Use it for information or very low priority BIOS bugs. | ||
| 213 | */ | ||
| 214 | #define FW_BUG "[Firmware Bug]: " | ||
| 215 | #define FW_WARN "[Firmware Warn]: " | ||
| 216 | #define FW_INFO "[Firmware Info]: " | ||
| 217 | |||
| 185 | #ifdef CONFIG_PRINTK | 218 | #ifdef CONFIG_PRINTK |
| 186 | asmlinkage int vprintk(const char *fmt, va_list args) | 219 | asmlinkage int vprintk(const char *fmt, va_list args) |
| 187 | __attribute__ ((format (printf, 1, 0))); | 220 | __attribute__ ((format (printf, 1, 0))); |
| 188 | asmlinkage int printk(const char * fmt, ...) | 221 | asmlinkage int printk(const char * fmt, ...) |
| 189 | __attribute__ ((format (printf, 1, 2))) __cold; | 222 | __attribute__ ((format (printf, 1, 2))) __cold; |
| 190 | 223 | ||
| 191 | extern int printk_ratelimit_jiffies; | 224 | extern struct ratelimit_state printk_ratelimit_state; |
| 192 | extern int printk_ratelimit_burst; | ||
| 193 | extern int printk_ratelimit(void); | 225 | extern int printk_ratelimit(void); |
| 194 | extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
| 195 | extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst); | ||
| 196 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 226 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 197 | unsigned int interval_msec); | 227 | unsigned int interval_msec); |
| 198 | #else | 228 | #else |
| @@ -203,13 +233,14 @@ static inline int printk(const char *s, ...) | |||
| 203 | __attribute__ ((format (printf, 1, 2))); | 233 | __attribute__ ((format (printf, 1, 2))); |
| 204 | static inline int __cold printk(const char *s, ...) { return 0; } | 234 | static inline int __cold printk(const char *s, ...) { return 0; } |
| 205 | static inline int printk_ratelimit(void) { return 0; } | 235 | static inline int printk_ratelimit(void) { return 0; } |
| 206 | static inline int __printk_ratelimit(int ratelimit_jiffies, \ | ||
| 207 | int ratelimit_burst) { return 0; } | ||
| 208 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | 236 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
| 209 | unsigned int interval_msec) \ | 237 | unsigned int interval_msec) \ |
| 210 | { return false; } | 238 | { return false; } |
| 211 | #endif | 239 | #endif |
| 212 | 240 | ||
| 241 | extern int printk_needs_cpu(int cpu); | ||
| 242 | extern void printk_tick(void); | ||
| 243 | |||
| 213 | extern void asmlinkage __attribute__((format(printf, 1, 2))) | 244 | extern void asmlinkage __attribute__((format(printf, 1, 2))) |
| 214 | early_printk(const char *fmt, ...); | 245 | early_printk(const char *fmt, ...); |
| 215 | 246 | ||
| @@ -232,9 +263,10 @@ extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in | |||
| 232 | extern int panic_timeout; | 263 | extern int panic_timeout; |
| 233 | extern int panic_on_oops; | 264 | extern int panic_on_oops; |
| 234 | extern int panic_on_unrecovered_nmi; | 265 | extern int panic_on_unrecovered_nmi; |
| 235 | extern int tainted; | ||
| 236 | extern const char *print_tainted(void); | 266 | extern const char *print_tainted(void); |
| 237 | extern void add_taint(unsigned); | 267 | extern void add_taint(unsigned flag); |
| 268 | extern int test_taint(unsigned flag); | ||
| 269 | extern unsigned long get_taint(void); | ||
| 238 | extern int root_mountflags; | 270 | extern int root_mountflags; |
| 239 | 271 | ||
| 240 | /* Values used for system_state */ | 272 | /* Values used for system_state */ |
| @@ -247,16 +279,17 @@ extern enum system_states { | |||
| 247 | SYSTEM_SUSPEND_DISK, | 279 | SYSTEM_SUSPEND_DISK, |
| 248 | } system_state; | 280 | } system_state; |
| 249 | 281 | ||
| 250 | #define TAINT_PROPRIETARY_MODULE (1<<0) | 282 | #define TAINT_PROPRIETARY_MODULE 0 |
| 251 | #define TAINT_FORCED_MODULE (1<<1) | 283 | #define TAINT_FORCED_MODULE 1 |
| 252 | #define TAINT_UNSAFE_SMP (1<<2) | 284 | #define TAINT_UNSAFE_SMP 2 |
| 253 | #define TAINT_FORCED_RMMOD (1<<3) | 285 | #define TAINT_FORCED_RMMOD 3 |
| 254 | #define TAINT_MACHINE_CHECK (1<<4) | 286 | #define TAINT_MACHINE_CHECK 4 |
| 255 | #define TAINT_BAD_PAGE (1<<5) | 287 | #define TAINT_BAD_PAGE 5 |
| 256 | #define TAINT_USER (1<<6) | 288 | #define TAINT_USER 6 |
| 257 | #define TAINT_DIE (1<<7) | 289 | #define TAINT_DIE 7 |
| 258 | #define TAINT_OVERRIDDEN_ACPI_TABLE (1<<8) | 290 | #define TAINT_OVERRIDDEN_ACPI_TABLE 8 |
| 259 | #define TAINT_WARN (1<<9) | 291 | #define TAINT_WARN 9 |
| 292 | #define TAINT_CRAP 10 | ||
| 260 | 293 | ||
| 261 | extern void dump_stack(void) __cold; | 294 | extern void dump_stack(void) __cold; |
| 262 | 295 | ||
| @@ -300,8 +333,12 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 300 | #define pr_info(fmt, arg...) \ | 333 | #define pr_info(fmt, arg...) \ |
| 301 | printk(KERN_INFO fmt, ##arg) | 334 | printk(KERN_INFO fmt, ##arg) |
| 302 | 335 | ||
| 303 | #ifdef DEBUG | ||
| 304 | /* If you are writing a driver, please use dev_dbg instead */ | 336 | /* If you are writing a driver, please use dev_dbg instead */ |
| 337 | #if defined(CONFIG_DYNAMIC_PRINTK_DEBUG) | ||
| 338 | #define pr_debug(fmt, ...) do { \ | ||
| 339 | dynamic_pr_debug(fmt, ##__VA_ARGS__); \ | ||
| 340 | } while (0) | ||
| 341 | #elif defined(DEBUG) | ||
| 305 | #define pr_debug(fmt, arg...) \ | 342 | #define pr_debug(fmt, arg...) \ |
| 306 | printk(KERN_DEBUG fmt, ##arg) | 343 | printk(KERN_DEBUG fmt, ##arg) |
| 307 | #else | 344 | #else |
| @@ -441,26 +478,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
| 441 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 478 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
| 442 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 479 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
| 443 | 480 | ||
| 444 | /* | ||
| 445 | * Check at compile time that something is of a particular type. | ||
| 446 | * Always evaluates to 1 so you may use it easily in comparisons. | ||
| 447 | */ | ||
| 448 | #define typecheck(type,x) \ | ||
| 449 | ({ type __dummy; \ | ||
| 450 | typeof(x) __dummy2; \ | ||
| 451 | (void)(&__dummy == &__dummy2); \ | ||
| 452 | 1; \ | ||
| 453 | }) | ||
| 454 | |||
| 455 | /* | ||
| 456 | * Check at compile time that 'function' is a certain type, or is a pointer | ||
| 457 | * to that type (needs to use typedef for the function type.) | ||
| 458 | */ | ||
| 459 | #define typecheck_fn(type,function) \ | ||
| 460 | ({ typeof(type) __tmp = function; \ | ||
| 461 | (void)__tmp; \ | ||
| 462 | }) | ||
| 463 | |||
| 464 | struct sysinfo; | 481 | struct sysinfo; |
| 465 | extern int do_sysinfo(struct sysinfo *info); | 482 | extern int do_sysinfo(struct sysinfo *info); |
| 466 | 483 | ||
| @@ -503,4 +520,9 @@ struct sysinfo { | |||
| 503 | #define NUMA_BUILD 0 | 520 | #define NUMA_BUILD 0 |
| 504 | #endif | 521 | #endif |
| 505 | 522 | ||
| 523 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | ||
| 524 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | ||
| 525 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | ||
| 526 | #endif | ||
| 527 | |||
| 506 | #endif | 528 | #endif |
