From: "he, bo" <bo.he@intel.com>
To: Ingo Molnar <mingo@kernel.org>,
akpm@linux-foudation.org, mingo@elte.hu, rusty@rustcorp.com.au,
a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org,
william.douglas@intel.com
Cc: yanmin_zhang@linux.intel.com
Subject: [PATCH_V2 1/2] fix the bug that printk can't support printk(KERN_LEVEL)
Date: Mon, 26 Mar 2012 09:36:27 +0800 [thread overview]
Message-ID: <1332725787.2359.27.camel@hebo> (raw)
In-Reply-To: <20120323122208.GB13920@gmail.com>
From: he bo <bo.he@intel.com>
Usually, there is a special scenario that developer wants to
call printk to just set up a log level (might be transferred
here as a parameter from upper level), then, later calling
of printk prints out real string with the same log level
continuously.
Current function vprintk has an issue to support this capability.
When the whole string in one calling to printk is just a log level,
it ignores it.
Signed-off-by: he, bo <bo.he@intel.com>
Reviewed-by: Zhang, Yanmin <yanmin.zhang@intel.com>
---
kernel/printk.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/printk.c b/kernel/printk.c
index b663c2c..473afdb 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -909,7 +909,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
* Copy the output into log_buf. If the caller didn't provide
* the appropriate log prefix, we insert them here
*/
- for (; *p; p++) {
+ for (; plen || *p; p++) {
if (new_text_line) {
new_text_line = 0;
@@ -920,6 +920,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
for (i = 0; i < plen; i++)
emit_log_char(printk_buf[i]);
printed_len += plen;
+ plen = 0;
} else {
/* Add log prefix */
emit_log_char('<');
@@ -946,10 +947,10 @@ asmlinkage int vprintk(const char *fmt, va_list args)
printed_len += tlen;
}
- if (!*p)
- break;
}
+ if (!*p)
+ break;
emit_log_char(*p);
if (*p == '\n')
new_text_line = 1;
--
1.7.1
next prev parent reply other threads:[~2012-03-26 1:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1332493027.2359.5.camel@hebo>
2012-03-23 9:01 ` [PATCH 2/2] enable dumpstack() to printk log level he, bo
2012-03-23 12:22 ` Ingo Molnar
2012-03-26 0:59 ` he, bo
2012-03-26 1:36 ` he, bo [this message]
2012-03-28 3:28 ` [PATCH_V2 1/2] fix the bug that printk can't support printk(KERN_LEVEL) Yanmin Zhang
2012-04-06 0:57 ` he, bo
2012-03-26 1:36 ` [PATCH_V2 2/2] enable dumpstack() to printk log level he, bo
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=1332725787.2359.27.camel@hebo \
--to=bo.he@intel.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foudation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=william.douglas@intel.com \
--cc=yanmin_zhang@linux.intel.com \
/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