diff options
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 1eb9cde550c4..d9725a28a265 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
| @@ -34,6 +34,7 @@ extern const char linux_proc_banner[]; | |||
| 34 | 34 | ||
| 35 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) | 35 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) |
| 36 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) | 36 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) |
| 37 | #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) | ||
| 37 | 38 | ||
| 38 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | 39 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
| 39 | 40 | ||
| @@ -41,6 +42,20 @@ extern const char linux_proc_banner[]; | |||
| 41 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 42 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
| 42 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 43 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
| 43 | 44 | ||
| 45 | #ifdef CONFIG_LBD | ||
| 46 | # include <asm/div64.h> | ||
| 47 | # define sector_div(a, b) do_div(a, b) | ||
| 48 | #else | ||
| 49 | # define sector_div(n, b)( \ | ||
| 50 | { \ | ||
| 51 | int _res; \ | ||
| 52 | _res = (n) % (b); \ | ||
| 53 | (n) /= (b); \ | ||
| 54 | _res; \ | ||
| 55 | } \ | ||
| 56 | ) | ||
| 57 | #endif | ||
| 58 | |||
| 44 | /** | 59 | /** |
| 45 | * upper_32_bits - return bits 32-63 of a number | 60 | * upper_32_bits - return bits 32-63 of a number |
| 46 | * @n: the number we're accessing | 61 | * @n: the number we're accessing |
| @@ -106,7 +121,7 @@ extern int cond_resched(void); | |||
| 106 | extern struct atomic_notifier_head panic_notifier_list; | 121 | extern struct atomic_notifier_head panic_notifier_list; |
| 107 | extern long (*panic_blink)(long time); | 122 | extern long (*panic_blink)(long time); |
| 108 | NORET_TYPE void panic(const char * fmt, ...) | 123 | NORET_TYPE void panic(const char * fmt, ...) |
| 109 | __attribute__ ((NORET_AND format (printf, 1, 2))); | 124 | __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; |
| 110 | extern void oops_enter(void); | 125 | extern void oops_enter(void); |
| 111 | extern void oops_exit(void); | 126 | extern void oops_exit(void); |
| 112 | extern int oops_may_print(void); | 127 | extern int oops_may_print(void); |
| @@ -155,14 +170,14 @@ extern void dump_thread(struct pt_regs *regs, struct user *dump); | |||
| 155 | asmlinkage int vprintk(const char *fmt, va_list args) | 170 | asmlinkage int vprintk(const char *fmt, va_list args) |
| 156 | __attribute__ ((format (printf, 1, 0))); | 171 | __attribute__ ((format (printf, 1, 0))); |
| 157 | asmlinkage int printk(const char * fmt, ...) | 172 | asmlinkage int printk(const char * fmt, ...) |
| 158 | __attribute__ ((format (printf, 1, 2))); | 173 | __attribute__ ((format (printf, 1, 2))) __cold; |
| 159 | #else | 174 | #else |
| 160 | static inline int vprintk(const char *s, va_list args) | 175 | static inline int vprintk(const char *s, va_list args) |
| 161 | __attribute__ ((format (printf, 1, 0))); | 176 | __attribute__ ((format (printf, 1, 0))); |
| 162 | static inline int vprintk(const char *s, va_list args) { return 0; } | 177 | static inline int vprintk(const char *s, va_list args) { return 0; } |
| 163 | static inline int printk(const char *s, ...) | 178 | static inline int printk(const char *s, ...) |
| 164 | __attribute__ ((format (printf, 1, 2))); | 179 | __attribute__ ((format (printf, 1, 2))); |
| 165 | static inline int printk(const char *s, ...) { return 0; } | 180 | static inline int __cold printk(const char *s, ...) { return 0; } |
| 166 | #endif | 181 | #endif |
| 167 | 182 | ||
| 168 | unsigned long int_sqrt(unsigned long); | 183 | unsigned long int_sqrt(unsigned long); |
| @@ -212,7 +227,7 @@ extern enum system_states { | |||
| 212 | #define TAINT_USER (1<<6) | 227 | #define TAINT_USER (1<<6) |
| 213 | #define TAINT_DIE (1<<7) | 228 | #define TAINT_DIE (1<<7) |
| 214 | 229 | ||
| 215 | extern void dump_stack(void); | 230 | extern void dump_stack(void) __cold; |
| 216 | 231 | ||
| 217 | enum { | 232 | enum { |
| 218 | DUMP_PREFIX_NONE, | 233 | DUMP_PREFIX_NONE, |
| @@ -224,9 +239,9 @@ extern void hex_dump_to_buffer(const void *buf, size_t len, | |||
| 224 | char *linebuf, size_t linebuflen, bool ascii); | 239 | char *linebuf, size_t linebuflen, bool ascii); |
| 225 | extern void print_hex_dump(const char *level, const char *prefix_str, | 240 | extern void print_hex_dump(const char *level, const char *prefix_str, |
| 226 | int prefix_type, int rowsize, int groupsize, | 241 | int prefix_type, int rowsize, int groupsize, |
| 227 | void *buf, size_t len, bool ascii); | 242 | const void *buf, size_t len, bool ascii); |
| 228 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, | 243 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
| 229 | void *buf, size_t len); | 244 | const void *buf, size_t len); |
| 230 | #define hex_asc(x) "0123456789abcdef"[x] | 245 | #define hex_asc(x) "0123456789abcdef"[x] |
| 231 | 246 | ||
| 232 | #ifdef DEBUG | 247 | #ifdef DEBUG |
