mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-28 15:20:41 +00:00
printk: Split the code for storing a message into the log buffer
commit ba55239995
upstream.
It is just a preparation step. The patch does not change
the existing behavior.
Link: http://lkml.kernel.org/r/20180627140817.27764-2-pmladek@suse.com
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Acked-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
b48522b788
commit
646e7c0480
1 changed files with 26 additions and 17 deletions
|
@ -1680,28 +1680,16 @@ static size_t log_output(int facility, int level, enum log_flags lflags, const c
|
|||
return log_store(facility, level, lflags, 0, dict, dictlen, text, text_len);
|
||||
}
|
||||
|
||||
asmlinkage int vprintk_emit(int facility, int level,
|
||||
const char *dict, size_t dictlen,
|
||||
const char *fmt, va_list args)
|
||||
/* Must be called under logbuf_lock. */
|
||||
int vprintk_store(int facility, int level,
|
||||
const char *dict, size_t dictlen,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
static char textbuf[LOG_LINE_MAX];
|
||||
char *text = textbuf;
|
||||
size_t text_len;
|
||||
enum log_flags lflags = 0;
|
||||
unsigned long flags;
|
||||
int printed_len;
|
||||
bool in_sched = false;
|
||||
|
||||
if (level == LOGLEVEL_SCHED) {
|
||||
level = LOGLEVEL_DEFAULT;
|
||||
in_sched = true;
|
||||
}
|
||||
|
||||
boot_delay_msec(level);
|
||||
printk_delay();
|
||||
|
||||
/* This stops the holder of console_sem just where we want him */
|
||||
logbuf_lock_irqsave(flags);
|
||||
/*
|
||||
* The printf needs to come first; we need the syslog
|
||||
* prefix which might be passed-in as a parameter.
|
||||
|
@ -1742,8 +1730,29 @@ asmlinkage int vprintk_emit(int facility, int level,
|
|||
if (dict)
|
||||
lflags |= LOG_PREFIX|LOG_NEWLINE;
|
||||
|
||||
printed_len = log_output(facility, level, lflags, dict, dictlen, text, text_len);
|
||||
return log_output(facility, level, lflags,
|
||||
dict, dictlen, text, text_len);
|
||||
}
|
||||
|
||||
asmlinkage int vprintk_emit(int facility, int level,
|
||||
const char *dict, size_t dictlen,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
int printed_len;
|
||||
bool in_sched = false;
|
||||
unsigned long flags;
|
||||
|
||||
if (level == LOGLEVEL_SCHED) {
|
||||
level = LOGLEVEL_DEFAULT;
|
||||
in_sched = true;
|
||||
}
|
||||
|
||||
boot_delay_msec(level);
|
||||
printk_delay();
|
||||
|
||||
/* This stops the holder of console_sem just where we want him */
|
||||
logbuf_lock_irqsave(flags);
|
||||
printed_len = vprintk_store(facility, level, dict, dictlen, fmt, args);
|
||||
logbuf_unlock_irqrestore(flags);
|
||||
|
||||
/* If called from the scheduler, we can not call up(). */
|
||||
|
|
Loading…
Reference in a new issue