aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-15 07:46:29 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-15 07:46:29 -0400
commitb2aaf8f74cdc84a9182f6cabf198b7763bcb9d40 (patch)
tree53ccb1c2c14751fe69cf93102e76e97021f6df07 /include/linux/kernel.h
parent4f962d4d65923d7b722192e729840cfb79af0a5a (diff)
parent278429cff8809958d25415ba0ed32b59866ab1a8 (diff)
Merge branch 'linus' into stackprotector
Conflicts: arch/x86/kernel/Makefile include/asm-x86/pda.h
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h62
1 files changed, 21 insertions, 41 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 792bf0aa779..75d81f157d2 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
@@ -46,6 +48,9 @@ extern const char linux_proc_banner[];
46#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) 48#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
47#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) 49#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
48 50
51#define _RET_IP_ (unsigned long)__builtin_return_address(0)
52#define _THIS_IP_ ({ __label__ __here; __here: (unsigned long)&&__here; })
53
49#ifdef CONFIG_LBD 54#ifdef CONFIG_LBD
50# include <asm/div64.h> 55# include <asm/div64.h>
51# define sector_div(a, b) do_div(a, b) 56# define sector_div(a, b) do_div(a, b)
@@ -70,6 +75,12 @@ extern const char linux_proc_banner[];
70 */ 75 */
71#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) 76#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16))
72 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
73#define KERN_EMERG "<0>" /* system is unusable */ 84#define KERN_EMERG "<0>" /* system is unusable */
74#define KERN_ALERT "<1>" /* action must be taken immediately */ 85#define KERN_ALERT "<1>" /* action must be taken immediately */
75#define KERN_CRIT "<2>" /* critical conditions */ 86#define KERN_CRIT "<2>" /* critical conditions */
@@ -97,6 +108,13 @@ struct completion;
97struct pt_regs; 108struct pt_regs;
98struct user; 109struct user;
99 110
111#ifdef CONFIG_PREEMPT_VOLUNTARY
112extern int _cond_resched(void);
113# define might_resched() _cond_resched()
114#else
115# define might_resched() do { } while (0)
116#endif
117
100/** 118/**
101 * might_sleep - annotation for functions that can sleep 119 * might_sleep - annotation for functions that can sleep
102 * 120 *
@@ -107,13 +125,6 @@ struct user;
107 * 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
108 * supposed to. 126 * supposed to.
109 */ 127 */
110#ifdef CONFIG_PREEMPT_VOLUNTARY
111extern int _cond_resched(void);
112# define might_resched() _cond_resched()
113#else
114# define might_resched() do { } while (0)
115#endif
116
117#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP 128#ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
118 void __might_sleep(char *file, int line); 129 void __might_sleep(char *file, int line);
119# define might_sleep() \ 130# define might_sleep() \
@@ -171,7 +182,7 @@ extern int vsscanf(const char *, const char *, va_list)
171 182
172extern int get_option(char **str, int *pint); 183extern int get_option(char **str, int *pint);
173extern char *get_options(const char *str, int nints, int *ints); 184extern char *get_options(const char *str, int nints, int *ints);
174extern unsigned long long memparse(char *ptr, char **retptr); 185extern unsigned long long memparse(const char *ptr, char **retptr);
175 186
176extern int core_kernel_text(unsigned long addr); 187extern int core_kernel_text(unsigned long addr);
177extern int __kernel_text_address(unsigned long addr); 188extern int __kernel_text_address(unsigned long addr);
@@ -184,15 +195,9 @@ asmlinkage int vprintk(const char *fmt, va_list args)
184 __attribute__ ((format (printf, 1, 0))); 195 __attribute__ ((format (printf, 1, 0)));
185asmlinkage int printk(const char * fmt, ...) 196asmlinkage int printk(const char * fmt, ...)
186 __attribute__ ((format (printf, 1, 2))) __cold; 197 __attribute__ ((format (printf, 1, 2))) __cold;
187extern int log_buf_get_len(void);
188extern int log_buf_read(int idx);
189extern int log_buf_copy(char *dest, int idx, int len);
190 198
191extern int printk_ratelimit_jiffies; 199extern struct ratelimit_state printk_ratelimit_state;
192extern int printk_ratelimit_burst;
193extern int printk_ratelimit(void); 200extern int printk_ratelimit(void);
194extern int __ratelimit(int ratelimit_jiffies, int ratelimit_burst);
195extern int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst);
196extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 201extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
197 unsigned int interval_msec); 202 unsigned int interval_msec);
198#else 203#else
@@ -202,18 +207,13 @@ static inline int vprintk(const char *s, va_list args) { return 0; }
202static inline int printk(const char *s, ...) 207static inline int printk(const char *s, ...)
203 __attribute__ ((format (printf, 1, 2))); 208 __attribute__ ((format (printf, 1, 2)));
204static inline int __cold printk(const char *s, ...) { return 0; } 209static inline int __cold printk(const char *s, ...) { return 0; }
205static inline int log_buf_get_len(void) { return 0; }
206static inline int log_buf_read(int idx) { return 0; }
207static inline int log_buf_copy(char *dest, int idx, int len) { return 0; }
208static inline int printk_ratelimit(void) { return 0; } 210static inline int printk_ratelimit(void) { return 0; }
209static inline int __printk_ratelimit(int ratelimit_jiffies, \
210 int ratelimit_burst) { return 0; }
211static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ 211static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \
212 unsigned int interval_msec) \ 212 unsigned int interval_msec) \
213 { return false; } 213 { return false; }
214#endif 214#endif
215 215
216extern void __attribute__((format(printf, 1, 2))) 216extern void asmlinkage __attribute__((format(printf, 1, 2)))
217 early_printk(const char *fmt, ...); 217 early_printk(const char *fmt, ...);
218 218
219unsigned long int_sqrt(unsigned long); 219unsigned long int_sqrt(unsigned long);
@@ -444,26 +444,6 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
444 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 444 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
445 (type *)( (char *)__mptr - offsetof(type,member) );}) 445 (type *)( (char *)__mptr - offsetof(type,member) );})
446 446
447/*
448 * Check at compile time that something is of a particular type.
449 * Always evaluates to 1 so you may use it easily in comparisons.
450 */
451#define typecheck(type,x) \
452({ type __dummy; \
453 typeof(x) __dummy2; \
454 (void)(&__dummy == &__dummy2); \
455 1; \
456})
457
458/*
459 * Check at compile time that 'function' is a certain type, or is a pointer
460 * to that type (needs to use typedef for the function type.)
461 */
462#define typecheck_fn(type,function) \
463({ typeof(type) __tmp = function; \
464 (void)__tmp; \
465})
466
467struct sysinfo; 447struct sysinfo;
468extern int do_sysinfo(struct sysinfo *info); 448extern int do_sysinfo(struct sysinfo *info);
469 449