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: Re: [PATCH v3 3/7] printk: LOG_CONT and LOG_NEWLINE are opposites
Date: Fri, 18 Jul 2014 14:34:57 -0500 [thread overview]
Message-ID: <53C976E1.9040505@linaro.org> (raw)
In-Reply-To: <1405692859-32500-4-git-send-email-elder@linaro.org>
On 07/18/2014 09:14 AM, Alex Elder wrote:
> Two log record flags--LOG_CONT and LOG_NEWLINE--are mutually
> exclusive. That is, one or the other is always set, but they are
> never both set at the same time in a log record flags field. What
> follows is a great deal of explanation that aims to prove this
> assertion.
>
> Having that knowledge allows us to simplify a bit of logic, and with
> a little more work (in follow-on patches) it allows us to do without
> some flag values, considerably simplifying things.
And in this patch I inadvertently deleted a hunk. It
goes at the end, and I've appended it below.
I'm really sorry I screwed these patches up. I got
sloppy, and tried to send them out in a hurry this
morning.
I'm going to post a new version 4 that will correct these
things.
-Alex
> Signed-off-by: Alex Elder <elder@linaro.org>
> Reviewed-by: Petr Mládek <pmladek@suse.cz>
> ---
> kernel/printk/printk.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index f2a069e..00367b5 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1006,11 +1006,9 @@ static size_t msg_print_text(const struct printk_log *msg, enum log_flags prev,
> prefix = false;
>
> if (msg->flags & LOG_CONT) {
> - if ((prev & LOG_CONT) && !(prev & LOG_NEWLINE))
> + if (prev & LOG_CONT)
> prefix = false;
> -
> - if (!(msg->flags & LOG_NEWLINE))
> - newline = false;
> + newline = false;
> }
>
> do {
> @@ -1639,10 +1637,16 @@ asmlinkage int vprintk_emit(int facility, int level,
> text_len += vscnprintf(text + text_len,
> sizeof(textbuf) - text_len, fmt, args);
>
> - /* mark and strip a trailing newline */
> + /*
> + * If there's a trailing newline, flag it and strip it off.
> + * Otherwise we assume this is a partial log message, to be
> + * continued with the next call.
> + */
> if (text_len && text[text_len-1] == '\n') {
> text_len--;
> - lflags |= LOG_NEWLINE;
> + lflags = LOG_NEWLINE;
> + } else {
> + lflags = LOG_CONT;
> }
>
> /* strip kernel syslog prefix and extract log level or control flags */
> @@ -1672,7 +1676,7 @@ asmlinkage int vprintk_emit(int facility, int level,
> level = default_message_loglevel;
>
> if (dict)
> - lflags |= LOG_PREFIX|LOG_NEWLINE;
> + lflags = LOG_PREFIX|LOG_NEWLINE;
>
> if (!(lflags & LOG_NEWLINE)) {
> /*
>
@@ -1700,8 +1700,7 @@ asmlinkage int vprintk_emit(int facility
if (cont_add(facility, level, text, text_len))
printed_len += text_len;
else
- printed_len += log_store(facility, level,
- lflags | LOG_CONT, 0,
+ printed_len += log_store(facility, level, lflags, 0,
dict, dictlen, text,
text_len);
} else {
bool stored = false;
next prev parent reply other threads:[~2014-07-18 19:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-18 14:14 [PATCH v3 0/7] printk: start simplifying some flags Alex Elder
2014-07-18 14:14 ` [PATCH v3 1/7] printk: report dropped messages on separate line Alex Elder
2014-07-18 19:21 ` Alex Elder
2014-07-18 14:14 ` [PATCH v3 2/7] printk: initialize syslog_prev and console_prev Alex Elder
2014-07-18 14:14 ` [PATCH v3 3/7] printk: LOG_CONT and LOG_NEWLINE are opposites Alex Elder
2014-07-18 19:34 ` Alex Elder [this message]
2014-07-18 14:14 ` [PATCH v3 4/7] printk: honor LOG_PREFIX in devkmsg_read() Alex Elder
2014-07-18 14:14 ` [PATCH v3 5/7] printk: honor LOG_PREFIX in msg_print_text() Alex Elder
2014-07-18 14:14 ` [PATCH v3 6/7] printk: insert newline in devkmsg_read() Alex Elder
2014-07-18 14:14 ` [PATCH v3 7/7] printk: correct some more typos Alex Elder
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=53C976E1.9040505@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
Powered by JetHome