diff options
author | Kay Sievers <kay@vrfy.org> | 2012-07-09 01:00:32 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-07-09 01:00:32 +0200 |
commit | eae8c82b8a054ca8a0165c994a16bf48c74a5d50 (patch) | |
tree | 9a9406caf568d76f8e5636bfbb473fa8f5c6165f | |
parent | 4ffdcd450aab78b7d178d28d8641345f759493c4 (diff) | |
download | patches-eae8c82b8a054ca8a0165c994a16bf48c74a5d50.tar.gz |
update kmsg-merge-cont.patch with multi-line fix
-rw-r--r-- | kmsg-merge-cont.patch | 98 |
1 files changed, 47 insertions, 51 deletions
diff --git a/kmsg-merge-cont.patch b/kmsg-merge-cont.patch index dc17f52..2fd6098 100644 --- a/kmsg-merge-cont.patch +++ b/kmsg-merge-cont.patch @@ -12,8 +12,8 @@ reconstruct the full line again, when the separated records are printed. Reported-By: Michael Neuling <mikey@neuling.org> Signed-off-by: Kay Sievers <kay@vrfy.org> --- - kernel/printk.c | 119 ++++++++++++++++++++++++++++++++++++-------------------- - 1 file changed, 77 insertions(+), 42 deletions(-) + kernel/printk.c | 120 ++++++++++++++++++++++++++++++++++++-------------------- + 1 file changed, 78 insertions(+), 42 deletions(-) --- a/kernel/printk.c +++ b/kernel/printk.c @@ -38,7 +38,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> static size_t syslog_partial; /* index and sequence number of the first record stored in the buffer */ -@@ -839,8 +842,8 @@ static size_t print_prefix(const struct +@@ -839,13 +842,26 @@ static size_t print_prefix(const struct return len; } @@ -49,32 +49,25 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> { const char *text = log_text(msg); size_t text_size = msg->text_len; -@@ -849,6 +852,8 @@ static size_t msg_print_text(const struc - do { - const char *next = memchr(text, '\n', text_size); - size_t text_len; -+ bool prefix = true; -+ bool newline = true; ++ bool prefix = true; ++ bool newline = true; + size_t len = 0; - if (next) { - text_len = next - text; -@@ -858,19 +863,35 @@ static size_t msg_print_text(const struc - text_len = text_size; - } - -+ if ((prev & LOG_CONT) && !(msg->flags & LOG_PREFIX)) -+ prefix = false; ++ if ((prev & LOG_CONT) && !(msg->flags & LOG_PREFIX)) ++ prefix = false; + -+ if (msg->flags & LOG_CONT) { -+ if ((prev & LOG_CONT) && !(prev & LOG_NEWLINE)) -+ prefix = false; ++ if (msg->flags & LOG_CONT) { ++ if ((prev & LOG_CONT) && !(prev & LOG_NEWLINE)) ++ prefix = false; + -+ if (!(msg->flags & LOG_NEWLINE)) -+ newline = false; -+ } ++ if (!(msg->flags & LOG_NEWLINE)) ++ newline = false; ++ } + - if (buf) { - if (print_prefix(msg, syslog, NULL) + + do { + const char *next = memchr(text, '\n', text_size); + size_t text_len; +@@ -863,16 +879,22 @@ static size_t msg_print_text(const struc text_len + 1>= size - len) break; @@ -84,7 +77,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> memcpy(buf + len, text, text_len); len += text_len; - buf[len++] = '\n'; -+ if (newline) ++ if (next || newline) + buf[len++] = '\n'; } else { /* SYSLOG_ACTION_* buffer size only calculation */ @@ -93,12 +86,15 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> + if (prefix) + len += print_prefix(msg, syslog, NULL); + len += text_len; -+ if (newline) ++ if (next || newline) + len++; } ++ prefix = true; text = next; -@@ -898,6 +919,7 @@ static int syslog_print(char __user *buf + } while (text); + +@@ -898,6 +920,7 @@ static int syslog_print(char __user *buf /* messages are gone, move to first one */ syslog_seq = log_first_seq; syslog_idx = log_first_idx; @@ -106,7 +102,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> syslog_partial = 0; } if (syslog_seq == log_next_seq) { -@@ -907,11 +929,12 @@ static int syslog_print(char __user *buf +@@ -907,11 +930,12 @@ static int syslog_print(char __user *buf skip = syslog_partial; msg = log_from_idx(syslog_idx); @@ -120,7 +116,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> n -= syslog_partial; syslog_partial = 0; } else if (!len){ -@@ -954,6 +977,7 @@ static int syslog_print_all(char __user +@@ -954,6 +978,7 @@ static int syslog_print_all(char __user u64 next_seq; u64 seq; u32 idx; @@ -128,7 +124,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> if (clear_seq < log_first_seq) { /* messages are gone, move to first available one */ -@@ -967,10 +991,11 @@ static int syslog_print_all(char __user +@@ -967,10 +992,11 @@ static int syslog_print_all(char __user */ seq = clear_seq; idx = clear_idx; @@ -141,7 +137,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> idx = log_next(idx); seq++; } -@@ -978,10 +1003,11 @@ static int syslog_print_all(char __user +@@ -978,10 +1004,11 @@ static int syslog_print_all(char __user /* move first record forward until length fits into the buffer */ seq = clear_seq; idx = clear_idx; @@ -154,7 +150,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> idx = log_next(idx); seq++; } -@@ -990,17 +1016,19 @@ static int syslog_print_all(char __user +@@ -990,17 +1017,19 @@ static int syslog_print_all(char __user next_seq = log_next_seq; len = 0; @@ -175,7 +171,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> raw_spin_unlock_irq(&logbuf_lock); if (copy_to_user(buf + len, text, textlen)) -@@ -1013,6 +1041,7 @@ static int syslog_print_all(char __user +@@ -1013,6 +1042,7 @@ static int syslog_print_all(char __user /* messages are gone, move to next one */ seq = log_first_seq; idx = log_first_idx; @@ -183,7 +179,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> } } } -@@ -1117,6 +1146,7 @@ int do_syslog(int type, char __user *buf +@@ -1117,6 +1147,7 @@ int do_syslog(int type, char __user *buf /* messages are gone, move to first one */ syslog_seq = log_first_seq; syslog_idx = log_first_idx; @@ -191,7 +187,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> syslog_partial = 0; } if (from_file) { -@@ -1127,18 +1157,18 @@ int do_syslog(int type, char __user *buf +@@ -1127,18 +1158,18 @@ int do_syslog(int type, char __user *buf */ error = log_next_idx - syslog_idx; } else { @@ -215,7 +211,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> } error -= syslog_partial; } -@@ -1408,10 +1438,9 @@ asmlinkage int vprintk_emit(int facility +@@ -1408,10 +1439,9 @@ asmlinkage int vprintk_emit(int facility static char textbuf[LOG_LINE_MAX]; char *text = textbuf; size_t text_len; @@ -227,7 +223,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> int printed_len = 0; boot_delay_msec(); -@@ -1450,7 +1479,7 @@ asmlinkage int vprintk_emit(int facility +@@ -1450,7 +1480,7 @@ asmlinkage int vprintk_emit(int facility recursion_bug = 0; printed_len += strlen(recursion_msg); /* emit KERN_CRIT message */ @@ -236,7 +232,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> NULL, 0, recursion_msg, printed_len); } -@@ -1463,7 +1492,7 @@ asmlinkage int vprintk_emit(int facility +@@ -1463,7 +1493,7 @@ asmlinkage int vprintk_emit(int facility /* mark and strip a trailing newline */ if (text_len && text[text_len-1] == '\n') { text_len--; @@ -245,7 +241,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> } /* strip syslog prefix and extract log level or control flags */ -@@ -1473,7 +1502,7 @@ asmlinkage int vprintk_emit(int facility +@@ -1473,7 +1503,7 @@ asmlinkage int vprintk_emit(int facility if (level == -1) level = text[1] - '0'; case 'd': /* KERN_DEFAULT */ @@ -254,7 +250,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> case 'c': /* KERN_CONT */ text += 3; text_len -= 3; -@@ -1483,22 +1512,20 @@ asmlinkage int vprintk_emit(int facility +@@ -1483,22 +1513,20 @@ asmlinkage int vprintk_emit(int facility if (level == -1) level = default_message_loglevel; @@ -282,7 +278,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> dict, dictlen, text, text_len); } else { bool stored = false; -@@ -1510,13 +1537,13 @@ asmlinkage int vprintk_emit(int facility +@@ -1510,13 +1538,13 @@ asmlinkage int vprintk_emit(int facility * flush it out and store this line separately. */ if (cont.len && cont.owner == current) { @@ -298,7 +294,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> dict, dictlen, text, text_len); } printed_len += text_len; -@@ -1615,8 +1642,8 @@ static struct cont { +@@ -1615,8 +1643,8 @@ static struct cont { static struct log *log_from_idx(u32 idx) { return NULL; } static u32 log_next(u32 idx) { return 0; } static void call_console_drivers(int level, const char *text, size_t len) {} @@ -309,7 +305,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> static size_t cont_print_text(char *text, size_t size) { return 0; } #endif /* CONFIG_PRINTK */ -@@ -1892,6 +1919,7 @@ void wake_up_klogd(void) +@@ -1892,6 +1920,7 @@ void wake_up_klogd(void) /* the next printk record to write to the console */ static u64 console_seq; static u32 console_idx; @@ -317,7 +313,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> /** * console_unlock - unlock the console system -@@ -1952,6 +1980,7 @@ again: +@@ -1952,6 +1981,7 @@ again: /* messages are gone, move to first one */ console_seq = log_first_seq; console_idx = log_first_idx; @@ -325,7 +321,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> } skip: if (console_seq == log_next_seq) -@@ -1975,10 +2004,11 @@ skip: +@@ -1975,10 +2005,11 @@ skip: } level = msg->level; @@ -339,7 +335,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> raw_spin_unlock(&logbuf_lock); stop_critical_timings(); /* don't trace print latency */ -@@ -2241,6 +2271,7 @@ void register_console(struct console *ne +@@ -2241,6 +2272,7 @@ void register_console(struct console *ne raw_spin_lock_irqsave(&logbuf_lock, flags); console_seq = syslog_seq; console_idx = syslog_idx; @@ -347,7 +343,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> raw_spin_unlock_irqrestore(&logbuf_lock, flags); /* * We're about to replay the log buffer. Only do this to the -@@ -2534,8 +2565,7 @@ bool kmsg_dump_get_line(struct kmsg_dump +@@ -2534,8 +2566,7 @@ bool kmsg_dump_get_line(struct kmsg_dump } msg = log_from_idx(dumper->cur_idx); @@ -357,7 +353,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> dumper->cur_idx = log_next(dumper->cur_idx); dumper->cur_seq++; -@@ -2575,6 +2605,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du +@@ -2575,6 +2606,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du u32 idx; u64 next_seq; u32 next_idx; @@ -365,7 +361,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> size_t l = 0; bool ret = false; -@@ -2597,23 +2628,27 @@ bool kmsg_dump_get_buffer(struct kmsg_du +@@ -2597,23 +2629,27 @@ bool kmsg_dump_get_buffer(struct kmsg_du /* calculate length of entire buffer */ seq = dumper->cur_seq; idx = dumper->cur_idx; @@ -395,7 +391,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org> } /* last message in next interation */ -@@ -2621,14 +2656,14 @@ bool kmsg_dump_get_buffer(struct kmsg_du +@@ -2621,14 +2657,14 @@ bool kmsg_dump_get_buffer(struct kmsg_du next_idx = idx; l = 0; |