From: Alex Elder <elder@linaro.org>
To: akpm@linux-foundation.org
Cc: kay@vrfy.org, pmladek@suse.cz, bp@suse.de,
john.stultz@linaro.org, jack@suse.cz,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] printk: stop actually recording LOG_PREFIX
Date: Thu, 17 Jul 2014 12:59:11 -0500 [thread overview]
Message-ID: <1405619953-5475-4-git-send-email-elder@linaro.org> (raw)
In-Reply-To: <1405619953-5475-1-git-send-email-elder@linaro.org>
Whenever log_store() sees a LOG_PREFIX flag it marks the previous
log entry (if there is one) with LOG_NEWLINE, which (also) produces
the desired effect.
There's therefore no need to record LOG_PREFIX in log records.
If no log entries contain LOG_PREFIX, devkmsg_read() and
msg_print_text() don't need to check for it.
Signed-off-by: Alex Elder <elder@linaro.org>
---
kernel/printk/printk.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 6b72a77..df38b5e 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -432,8 +432,11 @@ static int log_store(int facility, int level,
* If we're forcing a new log record, update the flags for
* the previous one to mark it complete.
*/
- if (flags & LOG_PREFIX && log_last_msg)
- log_last_msg->flags |= LOG_NEWLINE;
+ if (flags & LOG_PREFIX) {
+ if (log_last_msg)
+ log_last_msg->flags |= LOG_NEWLINE;
+ flags &= ~LOG_PREFIX;
+ }
msg = (struct printk_log *)(log_buf + log_next_idx);
memcpy(log_text(msg), text, text_len);
@@ -633,7 +636,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
* a record that should be merged with one or more earlier records.
* And a '-' indicates a "normal" self-contained single record.
*/
- if (!(user->prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX))
+ if (!(user->prev & LOG_NEWLINE))
cont = '+';
else if (!(msg->flags & LOG_NEWLINE))
cont = 'c';
@@ -1020,7 +1023,7 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
bool newline = true;
size_t len = 0;
- if (!(prev & LOG_NEWLINE) && !(msg->flags & LOG_PREFIX))
+ if (!(prev & LOG_NEWLINE))
prefix = false;
if (!(msg->flags & LOG_NEWLINE))
--
1.9.1
next prev parent reply other threads:[~2014-07-17 17:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 17:59 [PATCH 0/5] printk: more log flag simplification Alex Elder
2014-07-17 17:59 ` [PATCH 1/5] printk: kill LOG_CONT Alex Elder
2014-07-17 17:59 ` [PATCH 2/5] printk: update previous message for LOG_PREFIX Alex Elder
2014-07-18 9:02 ` Petr Mládek
2014-07-18 12:04 ` Alex Elder
2014-07-17 17:59 ` Alex Elder [this message]
2014-07-17 17:59 ` [PATCH 4/5] printk: kill LOG_PREFIX Alex Elder
2014-07-17 17:59 ` [PATCH 5/5] printk: rename LOG_NEWLINE and tidy up Alex Elder
2014-07-18 1:37 ` [PATCH 0/5] printk: more log flag simplification Kay Sievers
2014-07-18 1:54 ` Alex Elder
2014-07-18 9:22 ` Petr Mládek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1405619953-5475-4-git-send-email-elder@linaro.org \
--to=elder@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=bp@suse.de \
--cc=jack@suse.cz \
--cc=john.stultz@linaro.org \
--cc=kay@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox