[PATCH] introduce boot_printk()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Yinghai Lu
Date: Monday, September 15, 2008 - 1:05 am

could be enabled via "boot=verbose" to get more debug info

will use it to convert some printk(KERN_DEBUG ...)

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>

---
 include/linux/kernel.h |   19 +++++++++++++++++++
 kernel/printk.c        |   21 +++++++++++++++++++++
 2 files changed, 40 insertions(+)

Index: linux-2.6/include/linux/kernel.h
===================================================================
--- linux-2.6.orig/include/linux/kernel.h
+++ linux-2.6/include/linux/kernel.h
@@ -344,6 +344,25 @@ static inline char *pack_hex_byte(char *
 #endif
 
 /*
+ * Debugging macros
+ */
+#define BOOT_QUIET   0
+#define BOOT_VERBOSE 1
+#define BOOT_SPEW    2
+
+extern int boot_verbosity;
+/*
+ * Define the default level of output to be very little
+ * This can be turned up by using boot=verbose for more
+ * information and boot=spew for _lots_ of information.
+ * boot_verbosity is defined in printk.c
+ */
+#define boot_printk(v, s, a...) do {        \
+		if ((v) <= boot_verbosity)  \
+			printk(s, ##a);    \
+	} while (0)
+
+/*
  *      Display an IP address in readable format.
  */
 
Index: linux-2.6/kernel/printk.c
===================================================================
--- linux-2.6.orig/kernel/printk.c
+++ linux-2.6/kernel/printk.c
@@ -604,6 +604,27 @@ asmlinkage int printk(const char *fmt, .
 	return r;
 }
 
+int boot_verbosity;
+
+static int __init boot_set_verbosity(char *arg)
+{
+	if (!arg)
+		return -EINVAL;
+
+	if (strcmp("spew", arg) == 0)
+		boot_verbosity = BOOT_SPEW;
+	else if (strcmp("verbose", arg) == 0)
+		boot_verbosity = BOOT_VERBOSE;
+	else {
+		printk(KERN_WARNING "boot Verbosity level %s not recognised"
+			" use boot=verbose or boot=spew\n", arg);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+early_param("boot", boot_set_verbosity);
+
 /* cpu currently holding logbuf_lock */
 static volatile unsigned int printk_cpu = UINT_MAX;
 
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] introduce boot_printk(), Yinghai Lu, (Mon Sep 15, 1:05 am)
Re: [PATCH] introduce boot_printk(), Pavel Machek, (Mon Sep 15, 2:58 am)
Re: [PATCH] introduce boot_printk(), Randy Dunlap, (Mon Sep 15, 7:54 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Mon Sep 15, 9:14 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Mon Sep 15, 10:15 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Mon Sep 15, 10:18 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Mon Sep 15, 10:24 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Mon Sep 15, 10:34 am)
Re: [PATCH] introduce boot_printk(), Peter Zijlstra, (Tue Sep 16, 7:26 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Tue Sep 16, 9:06 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 9:42 am)
Re: [PATCH] introduce boot_printk(), Jeremy Fitzhardinge, (Tue Sep 16, 10:44 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 10:45 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 10:47 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Tue Sep 16, 10:53 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 11:10 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Tue Sep 16, 11:15 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 11:24 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Tue Sep 16, 11:31 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 11:37 am)
Re: [PATCH] introduce boot_printk(), H. Peter Anvin, (Tue Sep 16, 11:53 am)
Re: [PATCH] introduce boot_printk(), Yinghai Lu, (Tue Sep 16, 12:24 pm)