summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2021-06-15 19:52:51 +0300
committerPetr Mladek <pmladek@suse.com>2021-07-19 12:57:18 +0300
commitf3d75cf537db57f7918a17a75527951de850e5ec (patch)
tree326c4bd0e0381370a607c4e5faacd68a2758627e
parenta1ad4b8a19566b11e0306f8b197f2fd4567340e5 (diff)
downloadlinux-f3d75cf537db57f7918a17a75527951de850e5ec.tar.xz
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> Reviewed-by: Petr Mladek <pmladek@suse.com> Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/b22ba314a860e5c7f887958f1eab2649f9bd1d06.1623775748.git.chris@chrisdown.name
-rw-r--r--kernel/printk/internal.h2
-rw-r--r--kernel/printk/printk.c8
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 39f1ec22a6a6..03956c3eb745 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1956,7 +1956,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.
@@ -1972,7 +1972,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;
@@ -2018,7 +2018,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);
@@ -2067,7 +2067,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;