log: support "log -t|-m" option for output of printk safe buffers

Suppress the output of safe buffer name with the "log -t" option and
display the message log level with "log -m" option.

Signed-off-by: Shogo Matsumoto <shogo.matsumoto@fujitsu.com>
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
This commit is contained in:
Shogo Matsumoto 2022-01-28 04:22:07 +00:00 committed by Kazuhito Hagio
parent b0d447d78b
commit 3ed30b5128

View File

@ -11596,8 +11596,14 @@ __dump_printk_safe_seq_buf(char *buf_name, int msg_flags)
if (show_header) {
ilen = PRINTK_SAFE_SEQ_BUF_INDENT;
} else {
ilen = strlen(buf_name) + 3; // "[%s] "
if (msg_flags & SHOW_LOG_TEXT)
ilen = 0;
else
ilen = strlen(buf_name) + 3; // "[%s] "
}
if (msg_flags & SHOW_LOG_LEVEL)
ilen += 3; // "<%c>"
readmem(buffer_addr + per_cpu_offset, KVADDR,
buffer, buffer_size,
"printk_safe_seq_buf buffer", FAULT_ON_ERROR);
@ -11615,9 +11621,17 @@ __dump_printk_safe_seq_buf(char *buf_name, int msg_flags)
if (show_header)
fprintf(fp, "%s", space(PRINTK_SAFE_SEQ_BUF_INDENT));
else
else if (!(msg_flags & SHOW_LOG_TEXT))
fprintf(fp, "[%s] ", buf_name);
if ((msg_flags & SHOW_LOG_LEVEL) && (i < n)) {
switch (*p) {
case '0' ... '7':
case 'c':
fprintf(fp, "<%c>", *p);
}
}
continue;
} else {
if (sol)