]> git.baikalelectronics.ru Git - kernel.git/commit
hexdump: make it return number of bytes placed in buffer
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Thu, 12 Feb 2015 23:02:29 +0000 (15:02 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 13 Feb 2015 02:54:15 +0000 (18:54 -0800)
commit06bc5bea7bcfb5f8ea4f8b2a47ca7899eebb43c1
tree414c7731a5a4743cbdba6583a1b79f3723ec190d
parent37296e3be6179a2fc951d6ac6a46641748064ace
hexdump: make it return number of bytes placed in buffer

This patch makes hexdump return the number of bytes placed in the buffer
excluding trailing NUL.  In the case of overflow it returns the desired
amount of bytes to produce the entire dump.  Thus, it mimics snprintf().

This will be useful for users that would like to repeat with a bigger
buffer.

[akpm@linux-foundation.org: fix printk warning]
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/printk.h
lib/hexdump.c
lib/test-hexdump.c