Skip to content

Commit

Permalink
vsprintf: add binary printf
Browse files Browse the repository at this point in the history
Impact: add new APIs for binary trace printk infrastructure

vbin_printf(): write args to binary buffer, string is copied
when "%s" is occurred.

bstr_printf(): read from binary buffer for args and format a string

[[email protected]: rebase]

Signed-off-by: Lai Jiangshan <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
Cc: Linus Torvalds <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Lai Jiangshan authored and Ingo Molnar committed Mar 6, 2009
1 parent f036be9 commit 4370aa4
Show file tree
Hide file tree
Showing 3 changed files with 452 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/linux/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# Library configuration
#

config BINARY_PRINTF
def_bool n

menu "Library routines"

config BITREVERSE
Expand Down
Loading

0 comments on commit 4370aa4

Please sign in to comment.