vsprintf: Factor out %pV handler as va_format()
Move the code from the long pointer() function. We are going to improve error handling that will make it more complicated. This patch does not change the existing behavior. Link: http://lkml.kernel.org/r/20190417115350.20479-6-pmladek@suse.com To: Rasmus Villemoes <linux@rasmusvillemoes.dk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: "Tobin C . Harding" <me@tobin.cc> Cc: Joe Perches <joe@perches.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> Cc: linux-kernel@vger.kernel.org Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Petr Mladek <pmladek@suse.com>
This commit is contained in:
parent
f00cc102b8
commit
45c3e93d75
|
@ -1520,6 +1520,17 @@ char *escaped_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *va_format(char *buf, char *end, struct va_format *va_fmt)
|
||||||
|
{
|
||||||
|
va_list va;
|
||||||
|
|
||||||
|
va_copy(va, *va_fmt->va);
|
||||||
|
buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
|
||||||
|
va_end(va);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static noinline_for_stack
|
static noinline_for_stack
|
||||||
char *uuid_string(char *buf, char *end, const u8 *addr,
|
char *uuid_string(char *buf, char *end, const u8 *addr,
|
||||||
struct printf_spec spec, const char *fmt)
|
struct printf_spec spec, const char *fmt)
|
||||||
|
@ -2046,15 +2057,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
||||||
case 'U':
|
case 'U':
|
||||||
return uuid_string(buf, end, ptr, spec, fmt);
|
return uuid_string(buf, end, ptr, spec, fmt);
|
||||||
case 'V':
|
case 'V':
|
||||||
{
|
return va_format(buf, end, ptr);
|
||||||
va_list va;
|
|
||||||
|
|
||||||
va_copy(va, *((struct va_format *)ptr)->va);
|
|
||||||
buf += vsnprintf(buf, end > buf ? end - buf : 0,
|
|
||||||
((struct va_format *)ptr)->fmt, va);
|
|
||||||
va_end(va);
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
case 'K':
|
case 'K':
|
||||||
return restricted_pointer(buf, end, ptr, spec);
|
return restricted_pointer(buf, end, ptr, spec);
|
||||||
case 'N':
|
case 'N':
|
||||||
|
|
Loading…
Reference in New Issue