Skip to content

Commit f3d75cf

Browse files
cdownpmladek
authored andcommitted
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 <[email protected]> Cc: Petr Mladek <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/b22ba314a860e5c7f887958f1eab2649f9bd1d06.1623775748.git.chris@chrisdown.name
1 parent a1ad4b8 commit f3d75cf

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

kernel/printk/internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ bool printk_percpu_data_ready(void);
5757

5858
void defer_console_output(void);
5959

60+
u16 printk_parse_prefix(const char *text, int *level,
61+
enum printk_info_flags *flags);
6062
#else
6163

6264
/*

kernel/printk/printk.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,7 +1956,7 @@ static inline u32 printk_caller_id(void)
19561956
}
19571957

19581958
/**
1959-
* parse_prefix - Parse level and control flags.
1959+
* printk_parse_prefix - Parse level and control flags.
19601960
*
19611961
* @text: The terminated text message.
19621962
* @level: A pointer to the current level value, will be updated.
@@ -1972,7 +1972,7 @@ static inline u32 printk_caller_id(void)
19721972
*
19731973
* Return: The length of the parsed level and control flags.
19741974
*/
1975-
static u16 parse_prefix(char *text, int *level,
1975+
u16 printk_parse_prefix(const char *text, int *level,
19761976
enum printk_info_flags *flags)
19771977
{
19781978
u16 prefix_len = 0;
@@ -2018,7 +2018,7 @@ static u16 printk_sprint(char *text, u16 size, int facility,
20182018
if (facility == 0) {
20192019
u16 prefix_len;
20202020

2021-
prefix_len = parse_prefix(text, NULL, NULL);
2021+
prefix_len = printk_parse_prefix(text, NULL, NULL);
20222022
if (prefix_len) {
20232023
text_len -= prefix_len;
20242024
memmove(text, text + prefix_len, text_len);
@@ -2067,7 +2067,7 @@ int vprintk_store(int facility, int level,
20672067

20682068
/* Extract log level or control flags. */
20692069
if (facility == 0)
2070-
parse_prefix(&prefix_buf[0], &level, &flags);
2070+
printk_parse_prefix(&prefix_buf[0], &level, &flags);
20712071

20722072
if (level == LOGLEVEL_DEFAULT)
20732073
level = default_message_loglevel;

0 commit comments

Comments
 (0)