summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-07-08 17:50:11 +0200
committerKay Sievers <kay@vrfy.org>2012-07-08 17:55:55 +0200
commit31d0db399837dc2a3c17afc32e23e176bde26d22 (patch)
tree71b7242463b26cdd79ba8b879216a58fbe26ae63
parentbeed9a18aa1182fef9a8955a16735bb665e12e88 (diff)
downloadpatches-31d0db399837dc2a3c17afc32e23e176bde26d22.tar.gz
update kmsg-merge-cont.patch
-rw-r--r--kmsg-merge-cont.patch119
1 files changed, 67 insertions, 52 deletions
diff --git a/kmsg-merge-cont.patch b/kmsg-merge-cont.patch
index 1246a48..cb95b95 100644
--- a/kmsg-merge-cont.patch
+++ b/kmsg-merge-cont.patch
@@ -12,8 +12,8 @@ when the separated records are printed.
Cc: Michael Neuling <mikey@neuling.org>
Signed-off-by: Kay Sievers <kay@vrfy.org>
---
- kernel/printk.c | 113 ++++++++++++++++++++++++++++++++++++--------------------
- 1 file changed, 74 insertions(+), 39 deletions(-)
+ kernel/printk.c | 119 ++++++++++++++++++++++++++++++++++++--------------------
+ 1 file changed, 77 insertions(+), 42 deletions(-)
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -26,11 +26,19 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
+ LOG_NOCONS = 1, /* already flushed, do not print to console */
+ LOG_NEWLINE = 2, /* text ended with a newline */
+ LOG_PREFIX = 4, /* text started with a prefix */
-+ LOG_CONT = 8, /* text is part of continuation line */
++ LOG_CONT = 8, /* text is a fragment of a continuation line */
};
struct log {
-@@ -839,8 +841,8 @@ static size_t print_prefix(const struct
+@@ -217,6 +219,7 @@ static DEFINE_RAW_SPINLOCK(logbuf_lock);
+ /* the next printk record to read by syslog(READ) or /proc/kmsg */
+ static u64 syslog_seq;
+ static u32 syslog_idx;
++static enum log_flags syslog_prev;
+ 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
return len;
}
@@ -41,7 +49,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
{
const char *text = log_text(msg);
size_t text_size = msg->text_len;
-@@ -849,6 +851,8 @@ static size_t msg_print_text(const struc
+@@ -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;
@@ -50,7 +58,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
if (next) {
text_len = next - text;
-@@ -858,19 +862,35 @@ static size_t msg_print_text(const struc
+@@ -858,19 +863,35 @@ static size_t msg_print_text(const struc
text_len = text_size;
}
@@ -90,38 +98,28 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
text = next;
-@@ -883,6 +903,7 @@ static int syslog_print(char __user *buf
- {
- char *text;
- struct log *msg;
-+ enum log_flags prev = 0;
- int len = 0;
-
- text = kmalloc(LOG_LINE_MAX, GFP_KERNEL);
-@@ -899,6 +920,7 @@ static int syslog_print(char __user *buf
+@@ -898,6 +919,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;
++ syslog_prev = 0;
syslog_partial = 0;
-+ prev = 0;
}
if (syslog_seq == log_next_seq) {
- raw_spin_unlock_irq(&logbuf_lock);
-@@ -907,13 +929,14 @@ static int syslog_print(char __user *buf
+@@ -907,11 +929,12 @@ static int syslog_print(char __user *buf
skip = syslog_partial;
msg = log_from_idx(syslog_idx);
- n = msg_print_text(msg, true, text, LOG_LINE_MAX);
-+ n = msg_print_text(msg, prev, true, text, LOG_LINE_MAX);
++ n = msg_print_text(msg, syslog_prev, true, text, LOG_LINE_MAX);
if (n - syslog_partial <= size) {
/* message fits into buffer, move forward */
syslog_idx = log_next(syslog_idx);
syslog_seq++;
++ syslog_prev = msg->flags;
n -= syslog_partial;
syslog_partial = 0;
-+ prev = msg->flags;
} else if (!len){
- /* partial read(), remember position */
- n = size;
@@ -954,6 +977,7 @@ static int syslog_print_all(char __user
u64 next_seq;
u64 seq;
@@ -185,7 +183,15 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
}
}
-@@ -1127,18 +1156,18 @@ int do_syslog(int type, char __user *buf
+@@ -1117,6 +1146,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;
++ syslog_prev = 0;
+ syslog_partial = 0;
+ }
+ if (from_file) {
+@@ -1127,18 +1157,18 @@ int do_syslog(int type, char __user *buf
*/
error = log_next_idx - syslog_idx;
} else {
@@ -193,7 +199,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
- u32 idx;
+ u64 seq = syslog_seq;
+ u32 idx = syslog_idx;
-+ enum log_flags prev = 0;
++ enum log_flags prev = syslog_prev;
error = 0;
- seq = syslog_seq;
@@ -209,7 +215,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
error -= syslog_partial;
}
-@@ -1408,10 +1437,9 @@ asmlinkage int vprintk_emit(int facility
+@@ -1408,10 +1438,9 @@ asmlinkage int vprintk_emit(int facility
static char textbuf[LOG_LINE_MAX];
char *text = textbuf;
size_t text_len;
@@ -221,7 +227,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
int printed_len = 0;
boot_delay_msec();
-@@ -1450,7 +1478,7 @@ asmlinkage int vprintk_emit(int facility
+@@ -1450,7 +1479,7 @@ asmlinkage int vprintk_emit(int facility
recursion_bug = 0;
printed_len += strlen(recursion_msg);
/* emit KERN_CRIT message */
@@ -230,7 +236,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
NULL, 0, recursion_msg, printed_len);
}
-@@ -1463,7 +1491,7 @@ asmlinkage int vprintk_emit(int facility
+@@ -1463,7 +1492,7 @@ asmlinkage int vprintk_emit(int facility
/* mark and strip a trailing newline */
if (text_len && text[text_len-1] == '\n') {
text_len--;
@@ -239,7 +245,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
/* strip syslog prefix and extract log level or control flags */
-@@ -1473,7 +1501,7 @@ asmlinkage int vprintk_emit(int facility
+@@ -1473,7 +1502,7 @@ asmlinkage int vprintk_emit(int facility
if (level == -1)
level = text[1] - '0';
case 'd': /* KERN_DEFAULT */
@@ -248,7 +254,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
case 'c': /* KERN_CONT */
text += 3;
text_len -= 3;
-@@ -1483,22 +1511,20 @@ asmlinkage int vprintk_emit(int facility
+@@ -1483,22 +1512,20 @@ asmlinkage int vprintk_emit(int facility
if (level == -1)
level = default_message_loglevel;
@@ -276,7 +282,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
dict, dictlen, text, text_len);
} else {
bool stored = false;
-@@ -1510,13 +1536,13 @@ asmlinkage int vprintk_emit(int facility
+@@ -1510,13 +1537,13 @@ asmlinkage int vprintk_emit(int facility
* flush it out and store this line separately.
*/
if (cont.len && cont.owner == current) {
@@ -292,7 +298,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
dict, dictlen, text, text_len);
}
printed_len += text_len;
-@@ -1615,8 +1641,8 @@ static struct cont {
+@@ -1615,8 +1642,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) {}
@@ -303,36 +309,45 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
static size_t cont_print_text(char *text, size_t size) { return 0; }
#endif /* CONFIG_PRINTK */
-@@ -1913,6 +1939,7 @@ void console_unlock(void)
- static u64 seen_seq;
- unsigned long flags;
- bool wake_klogd = false;
-+ enum log_flags prev = 0;
- bool retry;
-
- if (console_suspended) {
-@@ -1952,6 +1979,7 @@ again:
+@@ -1892,6 +1919,7 @@ void wake_up_klogd(void)
+ /* the next printk record to write to the console */
+ static u64 console_seq;
+ static u32 console_idx;
++static enum log_flags console_prev;
+
+ /**
+ * console_unlock - unlock the console system
+@@ -1952,6 +1980,7 @@ again:
/* messages are gone, move to first one */
console_seq = log_first_seq;
console_idx = log_first_idx;
-+ prev = 0;
++ console_prev = 0;
}
skip:
if (console_seq == log_next_seq)
-@@ -1975,10 +2003,11 @@ skip:
+@@ -1975,10 +2004,11 @@ skip:
}
level = msg->level;
- len = msg_print_text(msg, false, text, sizeof(text));
-+ len = msg_print_text(msg, prev, false, text, sizeof(text));
-
+-
++ len = msg_print_text(msg, console_prev, false,
++ text, sizeof(text));
console_idx = log_next(console_idx);
console_seq++;
-+ prev = msg->flags;
++ console_prev = msg->flags;
raw_spin_unlock(&logbuf_lock);
stop_critical_timings(); /* don't trace print latency */
-@@ -2534,8 +2563,7 @@ bool kmsg_dump_get_line(struct kmsg_dump
+@@ -2241,6 +2271,7 @@ void register_console(struct console *ne
+ raw_spin_lock_irqsave(&logbuf_lock, flags);
+ console_seq = syslog_seq;
+ console_idx = syslog_idx;
++ console_prev = syslog_prev;
+ 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
}
msg = log_from_idx(dumper->cur_idx);
@@ -342,7 +357,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
dumper->cur_idx = log_next(dumper->cur_idx);
dumper->cur_seq++;
-@@ -2575,6 +2603,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du
+@@ -2575,6 +2605,7 @@ bool kmsg_dump_get_buffer(struct kmsg_du
u32 idx;
u64 next_seq;
u32 next_idx;
@@ -350,7 +365,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
size_t l = 0;
bool ret = false;
-@@ -2597,23 +2626,27 @@ bool kmsg_dump_get_buffer(struct kmsg_du
+@@ -2597,23 +2628,27 @@ bool kmsg_dump_get_buffer(struct kmsg_du
/* calculate length of entire buffer */
seq = dumper->cur_seq;
idx = dumper->cur_idx;
@@ -380,7 +395,7 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
}
/* last message in next interation */
-@@ -2621,14 +2654,16 @@ bool kmsg_dump_get_buffer(struct kmsg_du
+@@ -2621,14 +2656,14 @@ bool kmsg_dump_get_buffer(struct kmsg_du
next_idx = idx;
l = 0;
@@ -389,9 +404,9 @@ Signed-off-by: Kay Sievers <kay@vrfy.org>
struct log *msg = log_from_idx(idx);
- l += msg_print_text(msg, syslog,
-+ l += msg_print_text(msg, prev, syslog,
- buf + l, size - l);
-
+- buf + l, size - l);
+-
++ l += msg_print_text(msg, prev, syslog, buf + l, size - l);
idx = log_next(idx);
seq++;
+ prev = msg->flags;