[PATCH] makedumpfile: Fix dmesg format after crash utility
Atsushi Kumagai
kumagai-atsushi at mxc.nes.nec.co.jp
Thu Aug 28 18:43:31 PDT 2014
Hello,
I made a trivial patch for v1.5.7.
This isn't essential but it's better than nothing.
Thanks
Atsushi Kumagai
From: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
Date: Thu, 28 Aug 2014 18:58:38 +0900
Subject: [PATCH] Fix dmesg format after crash utility.
Add some spaces before a new line as much as the length
of the timestamp like crash utility as:
$ diff -u current.dmesg fixed.dmesg
--- current.dmesg 2014-08-28 17:39:53.000000000 +0900
+++ fixed.dmesg 2014-08-27 16:46:09.000000000 +0900
@@ -150,8 +150,8 @@
[ 0.015251] Disabled fast string operations
[ 0.015285] mce: CPU supports 10 MCE banks
[ 0.015402] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
-Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
-tlb_flushall_shift: 6
+ Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
+ tlb_flushall_shift: 6
[ 0.015535] Freeing SMP alternatives memory: 20K (ffffffff81964000 - ffffffff81969000)
[ 0.018265] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[ 0.028286] smpboot: CPU0: Intel QEMU Virtual CPU version (cpu64-rhel6) (fam: 06, model: 0d, stepping: 03)
$
Signed-off-by: Atsushi Kumagai <kumagai-atsushi at mxc.nes.nec.co.jp>
---
makedumpfile.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/makedumpfile.c b/makedumpfile.c
index b4b6eca..632daba 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -3950,6 +3950,7 @@ dump_log_entry(char *logptr, int fp)
{
char *msg, *p, *bufp;
unsigned int i, text_len;
+ unsigned int indent_len;
unsigned long long ts_nsec;
char buf[BUFSIZE];
ulonglong nanos;
@@ -3965,6 +3966,7 @@ dump_log_entry(char *logptr, int fp)
bufp = buf;
bufp += sprintf(buf, "[%5lld.%06ld] ", nanos, rem/1000);
+ indent_len = strlen(buf);
for (i = 0, p = msg; i < text_len; i++, p++) {
/* 6bytes = "\\x%02x" + '\n' + '\0' */
@@ -3974,7 +3976,9 @@ dump_log_entry(char *logptr, int fp)
bufp = buf;
}
- if (isprint(*p) || isspace(*p))
+ if (*p == '\n')
+ bufp += sprintf(bufp, "\n%-*s", indent_len, "");
+ else if (isprint(*p) || isspace(*p))
*bufp++ = *p;
else
bufp += sprintf(bufp, "\\x%02x", *p);
--
1.9.0
More information about the kexec
mailing list