Messages in this thread Patch in this message | | | Date | Tue, 15 Jun 2021 17:52:51 +0100 | From | Chris Down <> | Subject | [PATCH v7 3/5] printk: Rework parse_prefix into printk_parse_prefix |
| |
parse_prefix is needed externally by later patches, so move it into a context where it can be used as such. Also give it the printk_ prefix to reduce the chance of collisions.
Signed-off-by: Chris Down <chris@chrisdown.name> Cc: Petr Mladek <pmladek@suse.com> --- kernel/printk/internal.h | 2 ++ kernel/printk/printk.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h index 1075e60fcd98..1596e2837318 100644 --- a/kernel/printk/internal.h +++ b/kernel/printk/internal.h @@ -57,6 +57,8 @@ bool printk_percpu_data_ready(void); void defer_console_output(void); +u16 printk_parse_prefix(const char *text, int *level, + enum printk_info_flags *flags); #else /* diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 3201bb0c269c..26d52aea9969 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -1957,7 +1957,7 @@ static inline u32 printk_caller_id(void) } /** - * parse_prefix - Parse level and control flags. + * printk_parse_prefix - Parse level and control flags. * * @text: The terminated text message. * @level: A pointer to the current level value, will be updated. @@ -1973,7 +1973,7 @@ static inline u32 printk_caller_id(void) * * Return: The length of the parsed level and control flags. */ -static u16 parse_prefix(char *text, int *level, +u16 printk_parse_prefix(const char *text, int *level, enum printk_info_flags *flags) { u16 prefix_len = 0; @@ -2019,7 +2019,7 @@ static u16 printk_sprint(char *text, u16 size, int facility, if (facility == 0) { u16 prefix_len; - prefix_len = parse_prefix(text, NULL, NULL); + prefix_len = printk_parse_prefix(text, NULL, NULL); if (prefix_len) { text_len -= prefix_len; memmove(text, text + prefix_len, text_len); @@ -2068,7 +2068,7 @@ int vprintk_store(int facility, int level, /* Extract log level or control flags. */ if (facility == 0) - parse_prefix(&prefix_buf[0], &level, &flags); + printk_parse_prefix(&prefix_buf[0], &level, &flags); if (level == LOGLEVEL_DEFAULT) level = default_message_loglevel; -- 2.31.1
| |