diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2011-03-01 15:04:39 -0500 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-03-01 15:04:39 -0500 |
commit | 6fae9c25134baffbeeb20031479e7ff6f6d8eec0 (patch) | |
tree | c9ab89992ce5293a43cd455a81dc8a5926a28a5e /include/linux/kernel.h | |
parent | c186794dbb466b45cf40f942f2d09d6d5b4b0e42 (diff) | |
parent | f5412be599602124d2bdd49947b231dd77c0bf99 (diff) |
Merge commit 'v2.6.38-rc6' into for-2.6.39/core
Conflicts:
block/cfq-iosched.c
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 63 |
1 files changed, 54 insertions, 9 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index b6de9a6f7018..2fe6e84894a4 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -56,6 +56,8 @@ | |||
56 | 56 | ||
57 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 57 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
58 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 58 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
59 | |||
60 | /* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */ | ||
59 | #define roundup(x, y) ( \ | 61 | #define roundup(x, y) ( \ |
60 | { \ | 62 | { \ |
61 | const typeof(y) __y = y; \ | 63 | const typeof(y) __y = y; \ |
@@ -141,9 +143,22 @@ extern int _cond_resched(void); | |||
141 | 143 | ||
142 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) | 144 | #define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0) |
143 | 145 | ||
144 | #define abs(x) ({ \ | 146 | /* |
145 | long __x = (x); \ | 147 | * abs() handles unsigned and signed longs, ints, shorts and chars. For all |
146 | (__x < 0) ? -__x : __x; \ | 148 | * input types abs() returns a signed long. |
149 | * abs() should not be used for 64-bit types (s64, u64, long long) - use abs64() | ||
150 | * for those. | ||
151 | */ | ||
152 | #define abs(x) ({ \ | ||
153 | long ret; \ | ||
154 | if (sizeof(x) == sizeof(long)) { \ | ||
155 | long __x = (x); \ | ||
156 | ret = (__x < 0) ? -__x : __x; \ | ||
157 | } else { \ | ||
158 | int __x = (x); \ | ||
159 | ret = (__x < 0) ? -__x : __x; \ | ||
160 | } \ | ||
161 | ret; \ | ||
147 | }) | 162 | }) |
148 | 163 | ||
149 | #define abs64(x) ({ \ | 164 | #define abs64(x) ({ \ |
@@ -228,6 +243,8 @@ extern int test_taint(unsigned flag); | |||
228 | extern unsigned long get_taint(void); | 243 | extern unsigned long get_taint(void); |
229 | extern int root_mountflags; | 244 | extern int root_mountflags; |
230 | 245 | ||
246 | extern bool early_boot_irqs_disabled; | ||
247 | |||
231 | /* Values used for system_state */ | 248 | /* Values used for system_state */ |
232 | extern enum system_states { | 249 | extern enum system_states { |
233 | SYSTEM_BOOTING, | 250 | SYSTEM_BOOTING, |
@@ -263,6 +280,7 @@ static inline char *pack_hex_byte(char *buf, u8 byte) | |||
263 | } | 280 | } |
264 | 281 | ||
265 | extern int hex_to_bin(char ch); | 282 | extern int hex_to_bin(char ch); |
283 | extern void hex2bin(u8 *dst, const char *src, size_t count); | ||
266 | 284 | ||
267 | /* | 285 | /* |
268 | * General tracing related utility functions - trace_printk(), | 286 | * General tracing related utility functions - trace_printk(), |
@@ -557,12 +575,6 @@ struct sysinfo { | |||
557 | char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ | 575 | char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ |
558 | }; | 576 | }; |
559 | 577 | ||
560 | /* Force a compilation error if condition is true */ | ||
561 | #define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition)) | ||
562 | |||
563 | /* Force a compilation error if condition is constant and true */ | ||
564 | #define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)])) | ||
565 | |||
566 | /* Force a compilation error if a constant expression is not a power of 2 */ | 578 | /* Force a compilation error if a constant expression is not a power of 2 */ |
567 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | 579 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ |
568 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | 580 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) |
@@ -574,6 +586,32 @@ struct sysinfo { | |||
574 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | 586 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) |
575 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | 587 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) |
576 | 588 | ||
589 | /** | ||
590 | * BUILD_BUG_ON - break compile if a condition is true. | ||
591 | * @condition: the condition which the compiler should know is false. | ||
592 | * | ||
593 | * If you have some code which relies on certain constants being equal, or | ||
594 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
595 | * detect if someone changes it. | ||
596 | * | ||
597 | * The implementation uses gcc's reluctance to create a negative array, but | ||
598 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
599 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
600 | * prove the condition is false, it will cause a link error on the undefined | ||
601 | * "__build_bug_on_failed". This error message can be harder to track down | ||
602 | * though, hence the two different methods. | ||
603 | */ | ||
604 | #ifndef __OPTIMIZE__ | ||
605 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
606 | #else | ||
607 | extern int __build_bug_on_failed; | ||
608 | #define BUILD_BUG_ON(condition) \ | ||
609 | do { \ | ||
610 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
611 | if (condition) __build_bug_on_failed = 1; \ | ||
612 | } while(0) | ||
613 | #endif | ||
614 | |||
577 | /* Trap pasters of __FUNCTION__ at compile-time */ | 615 | /* Trap pasters of __FUNCTION__ at compile-time */ |
578 | #define __FUNCTION__ (__func__) | 616 | #define __FUNCTION__ (__func__) |
579 | 617 | ||
@@ -584,6 +622,13 @@ struct sysinfo { | |||
584 | #define NUMA_BUILD 0 | 622 | #define NUMA_BUILD 0 |
585 | #endif | 623 | #endif |
586 | 624 | ||
625 | /* This helps us avoid #ifdef CONFIG_COMPACTION */ | ||
626 | #ifdef CONFIG_COMPACTION | ||
627 | #define COMPACTION_BUILD 1 | ||
628 | #else | ||
629 | #define COMPACTION_BUILD 0 | ||
630 | #endif | ||
631 | |||
587 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ | 632 | /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ |
588 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 633 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
589 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD | 634 | # define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD |