diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kernel.h | 17 | ||||
-rw-r--r-- | include/linux/string.h | 7 |
2 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 914918abfdd1..6e4406e12c6b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state; | |||
242 | extern int printk_ratelimit(void); | 242 | extern int printk_ratelimit(void); |
243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, | 243 | extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
244 | unsigned int interval_msec); | 244 | unsigned int interval_msec); |
245 | |||
246 | /* | ||
247 | * Print a one-time message (analogous to WARN_ONCE() et al): | ||
248 | */ | ||
249 | #define printk_once(x...) ({ \ | ||
250 | static int __print_once = 1; \ | ||
251 | \ | ||
252 | if (__print_once) { \ | ||
253 | __print_once = 0; \ | ||
254 | printk(x); \ | ||
255 | } \ | ||
256 | }) | ||
257 | |||
245 | #else | 258 | #else |
246 | static inline int vprintk(const char *s, va_list args) | 259 | static inline int vprintk(const char *s, va_list args) |
247 | __attribute__ ((format (printf, 1, 0))); | 260 | __attribute__ ((format (printf, 1, 0))); |
@@ -253,6 +266,10 @@ static inline int printk_ratelimit(void) { return 0; } | |||
253 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ | 266 | static inline bool printk_timed_ratelimit(unsigned long *caller_jiffies, \ |
254 | unsigned int interval_msec) \ | 267 | unsigned int interval_msec) \ |
255 | { return false; } | 268 | { return false; } |
269 | |||
270 | /* No effect, but we still get type checking even in the !PRINTK case: */ | ||
271 | #define printk_once(x...) printk(x) | ||
272 | |||
256 | #endif | 273 | #endif |
257 | 274 | ||
258 | extern int printk_needs_cpu(int cpu); | 275 | extern int printk_needs_cpu(int cpu); |
diff --git a/include/linux/string.h b/include/linux/string.h index d18fc198aa2f..27ac31784ad2 100644 --- a/include/linux/string.h +++ b/include/linux/string.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/compiler.h> /* for inline */ | 10 | #include <linux/compiler.h> /* for inline */ |
11 | #include <linux/types.h> /* for size_t */ | 11 | #include <linux/types.h> /* for size_t */ |
12 | #include <linux/stddef.h> /* for NULL */ | 12 | #include <linux/stddef.h> /* for NULL */ |
13 | #include <stdarg.h> | ||
13 | 14 | ||
14 | extern char *strndup_user(const char __user *, long); | 15 | extern char *strndup_user(const char __user *, long); |
15 | 16 | ||
@@ -111,6 +112,12 @@ extern void argv_free(char **argv); | |||
111 | 112 | ||
112 | extern bool sysfs_streq(const char *s1, const char *s2); | 113 | extern bool sysfs_streq(const char *s1, const char *s2); |
113 | 114 | ||
115 | #ifdef CONFIG_BINARY_PRINTF | ||
116 | int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); | ||
117 | int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); | ||
118 | int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); | ||
119 | #endif | ||
120 | |||
114 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, | 121 | extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos, |
115 | const void *from, size_t available); | 122 | const void *from, size_t available); |
116 | 123 | ||