Commit 798cc27a authored by Petr Mladek's avatar Petr Mladek

vsprintf: Factor out %pO handler as kobject_string()

Move code from the long pointer() function. We are going to improve
error handling that will make it even more complicated.

This patch does not change the existing behavior.

Link: http://lkml.kernel.org/r/20190417115350.20479-7-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
Cc: Kees Cook <keescook@chromium.org>
Reviewed-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarPetr Mladek <pmladek@suse.com>
parent 45c3e93d
...@@ -1888,6 +1888,17 @@ char *device_node_string(char *buf, char *end, struct device_node *dn, ...@@ -1888,6 +1888,17 @@ char *device_node_string(char *buf, char *end, struct device_node *dn,
return widen_string(buf, buf - buf_start, end, spec); return widen_string(buf, buf - buf_start, end, spec);
} }
static char *kobject_string(char *buf, char *end, void *ptr,
struct printf_spec spec, const char *fmt)
{
switch (fmt[1]) {
case 'F':
return device_node_string(buf, end, ptr, spec, fmt + 1);
}
return ptr_to_id(buf, end, ptr, spec);
}
/* /*
* Show a '%p' thing. A kernel extension is that the '%p' is followed * Show a '%p' thing. A kernel extension is that the '%p' is followed
* by an extra set of alphanumeric characters that are extended format * by an extra set of alphanumeric characters that are extended format
...@@ -2082,11 +2093,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, ...@@ -2082,11 +2093,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
case 'G': case 'G':
return flags_string(buf, end, ptr, fmt); return flags_string(buf, end, ptr, fmt);
case 'O': case 'O':
switch (fmt[1]) { return kobject_string(buf, end, ptr, spec, fmt);
case 'F':
return device_node_string(buf, end, ptr, spec, fmt + 1);
}
break;
case 'x': case 'x':
return pointer_string(buf, end, ptr, spec); return pointer_string(buf, end, ptr, spec);
} }
......
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