Commit d7ec9a05 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Linus Torvalds

lib/vsprintf.c: update documentation

%n is no longer just ignored; it results in early return from vsnprintf.
Also add a request to add test cases for future %p extensions.
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: default avatarMartin Kletzander <mkletzan@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 317dc34a
...@@ -23,6 +23,10 @@ Example: ...@@ -23,6 +23,10 @@ Example:
Reminder: sizeof() result is of type size_t. Reminder: sizeof() result is of type size_t.
The kernel's printf does not support %n. For obvious reasons, floating
point formats (%e, %f, %g, %a) are also not recognized. Use of any
unsupported specifier or length qualifier results in a WARN and early
return from vsnprintf.
Raw pointer value SHOULD be printed with %p. The kernel supports Raw pointer value SHOULD be printed with %p. The kernel supports
the following extended format specifiers for pointer types: the following extended format specifiers for pointer types:
...@@ -305,13 +309,9 @@ Command from struct task_struct ...@@ -305,13 +309,9 @@ Command from struct task_struct
Passed by reference. Passed by reference.
Ignored argument: If you add other %p extensions, please extend lib/test_printf.c with
one or more test cases, if at all feasible.
%n %n
The argument passed will be ignored. In other words, literal "%n" will
be in the output and the argument will be considered for next format
specifier.
Thank you for your cooperation and attention. Thank you for your cooperation and attention.
......
...@@ -1448,7 +1448,6 @@ int kptr_restrict __read_mostly; ...@@ -1448,7 +1448,6 @@ int kptr_restrict __read_mostly;
* - 'Cn' For a clock, it prints the name (Common Clock Framework) or address * - 'Cn' For a clock, it prints the name (Common Clock Framework) or address
* (legacy clock framework) of the clock * (legacy clock framework) of the clock
* - 'Cr' For a clock, it prints the current rate of the clock * - 'Cr' For a clock, it prints the current rate of the clock
* - 'n' For ignored argument
* *
* ** Please update also Documentation/printk-formats.txt when making changes ** * ** Please update also Documentation/printk-formats.txt when making changes **
* *
...@@ -1814,8 +1813,10 @@ int format_decode(const char *fmt, struct printf_spec *spec) ...@@ -1814,8 +1813,10 @@ int format_decode(const char *fmt, struct printf_spec *spec)
* @fmt: The format string to use * @fmt: The format string to use
* @args: Arguments for the format string * @args: Arguments for the format string
* *
* This function follows C99 vsnprintf, but has some extensions: * This function generally follows C99 vsnprintf, but has some
* %n is ignored * extensions and a few limitations:
*
* %n is unsupported
* %p* is handled by pointer() * %p* is handled by pointer()
* *
* See pointer() or Documentation/printk-formats.txt for more * See pointer() or Documentation/printk-formats.txt for more
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment