diff options
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 8c21aaa248b..4d00988dad0 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -31,7 +31,10 @@ extern const char linux_banner[]; | |||
31 | #define STACK_MAGIC 0xdeadbeef | 31 | #define STACK_MAGIC 0xdeadbeef |
32 | 32 | ||
33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
34 | #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1)) | 34 | #define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL)) |
35 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | ||
36 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | ||
37 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | ||
35 | 38 | ||
36 | #define KERN_EMERG "<0>" /* system is unusable */ | 39 | #define KERN_EMERG "<0>" /* system is unusable */ |
37 | #define KERN_ALERT "<1>" /* action must be taken immediately */ | 40 | #define KERN_ALERT "<1>" /* action must be taken immediately */ |
@@ -117,6 +120,8 @@ extern int scnprintf(char * buf, size_t size, const char * fmt, ...) | |||
117 | __attribute__ ((format (printf, 3, 4))); | 120 | __attribute__ ((format (printf, 3, 4))); |
118 | extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) | 121 | extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) |
119 | __attribute__ ((format (printf, 3, 0))); | 122 | __attribute__ ((format (printf, 3, 0))); |
123 | extern char *kasprintf(gfp_t gfp, const char *fmt, ...) | ||
124 | __attribute__ ((format (printf, 2, 3))); | ||
120 | 125 | ||
121 | extern int sscanf(const char *, const char *, ...) | 126 | extern int sscanf(const char *, const char *, ...) |
122 | __attribute__ ((format (scanf, 2, 3))); | 127 | __attribute__ ((format (scanf, 2, 3))); |
@@ -182,6 +187,7 @@ extern void bust_spinlocks(int yes); | |||
182 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ | 187 | extern int oops_in_progress; /* If set, an oops, panic(), BUG() or die() is in progress */ |
183 | extern int panic_timeout; | 188 | extern int panic_timeout; |
184 | extern int panic_on_oops; | 189 | extern int panic_on_oops; |
190 | extern int panic_on_unrecovered_nmi; | ||
185 | extern int tainted; | 191 | extern int tainted; |
186 | extern const char *print_tainted(void); | 192 | extern const char *print_tainted(void); |
187 | extern void add_taint(unsigned); | 193 | extern void add_taint(unsigned); |
@@ -206,6 +212,7 @@ extern enum system_states { | |||
206 | extern void dump_stack(void); | 212 | extern void dump_stack(void); |
207 | 213 | ||
208 | #ifdef DEBUG | 214 | #ifdef DEBUG |
215 | /* If you are writing a driver, please use dev_dbg instead */ | ||
209 | #define pr_debug(fmt,arg...) \ | 216 | #define pr_debug(fmt,arg...) \ |
210 | printk(KERN_DEBUG fmt,##arg) | 217 | printk(KERN_DEBUG fmt,##arg) |
211 | #else | 218 | #else |
@@ -334,7 +341,20 @@ struct sysinfo { | |||
334 | /* Force a compilation error if condition is true */ | 341 | /* Force a compilation error if condition is true */ |
335 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | 342 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) |
336 | 343 | ||
344 | /* Force a compilation error if condition is true, but also produce a | ||
345 | result (of value 0 and type size_t), so the expression can be used | ||
346 | e.g. in a structure initializer (or where-ever else comma expressions | ||
347 | aren't permitted). */ | ||
348 | #define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) | ||
349 | |||
337 | /* Trap pasters of __FUNCTION__ at compile-time */ | 350 | /* Trap pasters of __FUNCTION__ at compile-time */ |
338 | #define __FUNCTION__ (__func__) | 351 | #define __FUNCTION__ (__func__) |
339 | 352 | ||
353 | /* This helps us to avoid #ifdef CONFIG_NUMA */ | ||
354 | #ifdef CONFIG_NUMA | ||
355 | #define NUMA_BUILD 1 | ||
356 | #else | ||
357 | #define NUMA_BUILD 0 | ||
358 | #endif | ||
359 | |||
340 | #endif | 360 | #endif |