aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@redhat.com>2012-07-18 13:18:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-19 20:14:18 -0400
commit6791457a090d9a234a40b501c2536f0aefaeae4b (patch)
tree39ba0f7e11dca9a88a38f85ca94b26f46f76365e /kernel
parentbd8a4f06d0310326f89fd58fed74f2db8e345056 (diff)
printk: Export struct log size and member offsets through vmcoreinfo
There are tools like makedumpfile and vmcore-dmesg which can extract kernel log buffer from vmcore. Since we introduced structured logging, that functionality is broken. Now user space tools need to know about "struct log" and offsets of various fields to be able to parse struct log data and extract text message or dictonary. This patch exports some of the fields. Currently I am not exporting log "level" info as that is a bitfield and offsetof() bitfields can't be calculated. But if people start asking for log level info in the output then we probably either need to seprate out "level" or use bit shift operations for flags and level. Signed-off-by: Vivek Goyal <vgoyal@redhat.com> Acked-by: Kay Sievers <kay@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/printk.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 4da2377131b0..449364f07a1e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -671,6 +671,15 @@ void log_buf_kexec_setup(void)
671 VMCOREINFO_SYMBOL(log_buf_len); 671 VMCOREINFO_SYMBOL(log_buf_len);
672 VMCOREINFO_SYMBOL(log_first_idx); 672 VMCOREINFO_SYMBOL(log_first_idx);
673 VMCOREINFO_SYMBOL(log_next_idx); 673 VMCOREINFO_SYMBOL(log_next_idx);
674 /*
675 * Export struct log size and field offsets. User space tools can
676 * parse it and detect any changes to structure down the line.
677 */
678 VMCOREINFO_STRUCT_SIZE(log);
679 VMCOREINFO_OFFSET(log, ts_nsec);
680 VMCOREINFO_OFFSET(log, len);
681 VMCOREINFO_OFFSET(log, text_len);
682 VMCOREINFO_OFFSET(log, dict_len);
674} 683}
675#endif 684#endif
676 685