printk changes for v2.6.30
Subsystems (3)
Linus,
Please pull the latest printk-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip.git printk-for-linus
Highlights:
- the introduction of these 'binary printk' APIs:
+int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args); +int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf); +int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4);
Relied on by the tracing tree.
Known risks:
- The vsnprintf changes are intrusive, and printk formatting bugs do not tend to be functional (they are visual mostly), so they get found later than other types of bugs. We had two bugs there.
- There are no known regressions.
Thanks,
Ingo
------------------>
Frederic Weisbecker (2):
vsprintf: unify the format decoding layer for its 3 users
vsprintf: fix bug in negative value printing
Guillaume Knispel (1):
printk: correct the behavior of printk_timed_ratelimit()
Ingo Molnar (1):
printk: introduce printk_once()
Lai Jiangshan (1):
vsprintf: add binary printf
Vegard Nossum (2):
fix regression from "vsprintf: unify the format decoding layer for its 3 users"
vsprintf: unify the format decoding layer for its 3 users, cleanup
include/linux/kernel.h | 17 + include/linux/string.h | 7 + kernel/printk.c | 7 +- lib/Kconfig | 3 + lib/vsprintf.c | 1005 +++++++++++++++++++++++++++++++++++++----------- 5 files changed, 810 insertions(+), 229 deletions(-)
include/linux/kernel.h +17 -0
@@ -242,6 +242,19 @@ extern struct ratelimit_state printk_ratelimit_state;extern int printk_ratelimit (void );extern bool printk_timed_ratelimit (unsigned long *caller_jiffies,unsigned int interval_msec); + +/* +* Print a one-time message (analogous to WARN_ONCE() et al): +*/ +#define printk_once(x...) ({ \ + static int __print_once = 1; \ + \ + if (__print_once) { \ + __print_once = 0; \ + printk(x); \ + } \ +}) +#else static inline int vprintk (const char *s,va_list args) __attribute__ ((format (printf,1 ,0 )));
@@ -253,6 +266,10 @@ static inline int printk_ratelimit(void) { return 0; }static inline bool printk_timed_ratelimit (unsigned long *caller_jiffies, \unsigned int interval_msec) \ {return false; } + +/* No effect, but we still get type checking even in the !PRINTK case: */ +#define printk_once(x...) printk(x) +#endif extern int printk_needs_cpu (int cpu);
include/linux/string.h +7 -0
@@ -10,6 +10,7 @@#include <linux/compiler.h> /* for inline */ #include <linux/types.h> /* for size_t */ #include <linux/stddef.h> /* for NULL */ +#include <stdarg.h> extern char *strndup_user (const char __user *,long );
@@ -111,6 +112,12 @@ extern void argv_free(char **argv);extern bool sysfs_streq (const char *s1,const char *s2); +#ifdef CONFIG_BINARY_PRINTF +int vbin_printf (u32 *bin_buf,size_t size,const char *fmt,va_list args); +int bstr_printf (char *buf,size_t size,const char *fmt,const u32 *bin_buf); +int bprintf(u32 *bin_buf, size_t size, const char *fmt, ...) __printf(3, 4); +#endif +extern ssize_t memory_read_from_buffer (void *to,size_t count,loff_t *ppos,const void *from,size_t available);
kernel/printk.c +5 -2
@@ -1292,8 +1292,11 @@ EXPORT_SYMBOL(printk_ratelimit);bool printk_timed_ratelimit (unsigned long *caller_jiffies,unsigned int interval_msecs) { -if (*caller_jiffies ==0 ||time_after (jiffies, *caller_jiffies)) { - *caller_jiffies = jiffies +msecs_to_jiffies (interval_msecs); +if (*caller_jiffies ==0 + || !time_in_range (jiffies, *caller_jiffies, + *caller_jiffies + +msecs_to_jiffies (interval_msecs))) { + *caller_jiffies = jiffies;return true; }return false;
lib/Kconfig +3 -0
@@ -2,6 +2,9 @@ # Library configuration # +config BINARY_PRINTF + def_bool n + menu "Library routines" config BITREVERSE
lib/vsprintf.c +778 -227
1,227 lines not on this page · raw message