提交 e28d7137 编写于 作者: L Linus Torvalds

printk: Add KERN_DEFAULT printk log-level

This adds a KERN_DEFAULT loglevel marker, for when you cannot decide
which loglevel you want, and just want to keep an existing printk
with the default loglevel.

The difference between having KERN_DEFAULT and having no log-level
marker at all is two-fold:

 - having the log-level marker will now force a new-line if the
   previous printout had not added one (perhaps because it forgot,
   but perhaps because it expected a continuation)

 - having a log-level marker is required if you are printing out a
   message that otherwise itself could perhaps otherwise be mistaken
   for a log-level.
Signed-of-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 5fd29d6c
...@@ -97,6 +97,8 @@ extern const char linux_proc_banner[]; ...@@ -97,6 +97,8 @@ extern const char linux_proc_banner[];
#define KERN_INFO "<6>" /* informational */ #define KERN_INFO "<6>" /* informational */
#define KERN_DEBUG "<7>" /* debug-level messages */ #define KERN_DEBUG "<7>" /* debug-level messages */
/* Use the default kernel loglevel */
#define KERN_DEFAULT "<d>"
/* /*
* Annotation for a "continued" line of log printout (only done after a * Annotation for a "continued" line of log printout (only done after a
* line that had no enclosing \n). Only to be used by core/arch code * line that had no enclosing \n). Only to be used by core/arch code
......
...@@ -696,6 +696,8 @@ asmlinkage int vprintk(const char *fmt, va_list args) ...@@ -696,6 +696,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
switch (c) { switch (c) {
case '0' ... '7': /* loglevel */ case '0' ... '7': /* loglevel */
current_log_level = c - '0'; current_log_level = c - '0';
/* Fallthrough - make sure we're on a new line */
case 'd': /* KERN_DEFAULT */
if (!new_text_line) { if (!new_text_line) {
emit_log_char('\n'); emit_log_char('\n');
new_text_line = 1; new_text_line = 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册