diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-03 13:28:46 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-03 13:28:46 -0400 |
commit | f68ec0c24755e5cdb779be6240925f2175311d84 (patch) | |
tree | a7b7128e61a8456385d82bd1c7ca5f14eecbf2ca /include/linux/kernel.h | |
parent | 98920dc3d1113b883cbc73e3293446d3525c6042 (diff) | |
parent | 94aca1dac6f6d21f4b07e4864baf7768cabcc6e7 (diff) |
Merge commit 'v2.6.27-rc8' into x86/setup
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 49 |
1 files changed, 16 insertions, 33 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index f9cd7a513f9c..2651f805ba6d 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -14,6 +14,8 @@ | |||
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> | ||
17 | #include <asm/byteorder.h> | 19 | #include <asm/byteorder.h> |
18 | #include <asm/bug.h> | 20 | #include <asm/bug.h> |
19 | 21 | ||
@@ -73,6 +75,12 @@ extern const char linux_proc_banner[]; | |||
73 | */ | 75 | */ |
74 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) | 76 | #define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) |
75 | 77 | ||
78 | /** | ||
79 | * lower_32_bits - return bits 0-31 of a number | ||
80 | * @n: the number we're accessing | ||
81 | */ | ||
82 | #define lower_32_bits(n) ((u32)(n)) | ||
83 | |||
76 | #define KERN_EMERG "<0>" /* system is unusable */ | 84 | #define KERN_EMERG "<0>" /* system is unusable */ |
77 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | 85 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
78 | #define KERN_CRIT "<2>" /* critical conditions */ | 86 | #define KERN_CRIT "<2>" /* critical conditions */ |
@@ -100,6 +108,13 @@ struct completion; | |||
100 | struct pt_regs; | 108 | struct pt_regs; |
101 | struct user; | 109 | struct user; |
102 | 110 | ||
111 | #ifdef CONFIG_PREEMPT_VOLUNTARY | ||
112 | extern int _cond_resched(void); | ||
113 | # define might_resched() _cond_resched() | ||
114 | #else | ||
115 | # define might_resched() do { } while (0) | ||
116 | #endif | ||
117 | |||
103 | /** | 118 | /** |
104 | * might_sleep - annotation for functions that can sleep | 119 | * might_sleep - annotation for functions that can sleep |
105 | * | 120 | * |
@@ -110,13 +125,6 @@ struct user; | |||
110 | * be bitten later when the calling function happens to sleep when it is not | 125 | * be bitten later when the calling function happens to sleep when it is not |
111 | * supposed to. | 126 | * supposed to. |
112 | */ | 127 | */ |
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 | 128 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
121 | void __might_sleep(char *file, int line); | 129 | void __might_sleep(char *file, int line); |
122 | # define might_sleep() \ | 130 | # define might_sleep() \ |
@@ -188,11 +196,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
188 | asmlinkage int printk(const char * fmt, ...) | 196 | asmlinkage int printk(const char * fmt, ...) |
189 | __attribute__ ((format (printf, 1, 2))) __cold; | 197 | __attribute__ ((format (printf, 1, 2))) __cold; |
190 | 198 | ||
191 | extern int printk_ratelimit_jiffies; | 199 | extern struct ratelimit_state printk_ratelimit_state; |
192 | extern int printk_ratelimit_burst; | ||
193 | extern int printk_ratelimit(void); | 200 | 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, | 201 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
197 | unsigned int interval_msec); | 202 | unsigned int interval_msec); |
198 | #else | 203 | #else |
@@ -203,8 +208,6 @@ static inline int printk(const char *s, ...) | |||
203 | __attribute__ ((format (printf, 1, 2))); | 208 | __attribute__ ((format (printf, 1, 2))); |
204 | static inline int __cold printk(const char *s, ...) { return 0; } | 209 | static inline int __cold printk(const char *s, ...) { return 0; } |
205 | static inline int printk_ratelimit(void) { return 0; } | 210 | 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, \ | 211 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
209 | unsigned int interval_msec) \ | 212 | unsigned int interval_msec) \ |
210 | { return false; } | 213 | { return false; } |
@@ -441,26 +444,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
441 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | 444 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
442 | (type *)( (char *)__mptr - offsetof(type,member) );}) | 445 | (type *)( (char *)__mptr - offsetof(type,member) );}) |
443 | 446 | ||
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; | 447 | struct sysinfo; |
465 | extern int do_sysinfo(struct sysinfo *info); | 448 | extern int do_sysinfo(struct sysinfo *info); |
466 | 449 | ||