From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
lf_kernel_messages@lists.linux-foundation.org
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
"Michael Holzheu" <holzheu@de.ibm.com>,
"Gerrit Huizenga" <gh@us.ibm.com>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
"Randy Dunlap" <randy.dunlap@oracle.com>,
"Jan Kara" <jack@suse.cz>, "Pavel Machek" <pavel@ucw.cz>,
"Sam Ravnborg" <sam@ravnborg.org>,
"Joe Perches" <joe@perches.com>,
"Jochen Voß" <jochen.voss@googlemail.com>,
"Kunai Takashi" <kunai@linux-foundation.jp>,
"Tim Bird" <tim.bird@am.sony.com>,
"Martin Schwidefsky" <schwidefsky@de.ibm.com>
Subject: [patch 1/3] kmsg: Kernel message catalog macros.
Date: Wed, 30 Jul 2008 18:56:57 +0200 [thread overview]
Message-ID: <20080730171156.824640459@de.ibm.com> (raw)
In-Reply-To: 20080730165656.118280544@de.ibm.com
[-- Attachment #1: 800-kmsg-macros.diff --]
[-- Type: text/plain, Size: 6281 bytes --]
From: Michael Holzheu <holzheu@de.ibm.com>
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
Introduce a new family of printk macros which prefixes each kmsg message
with a component name and allows to tag the printk with a message id.
The kmsg component name is defined per source file with the KMSG_COMPONENT
macro. The first argument of each kmsg printk is the message id. The
message id "0" is special as it will suppress the message id prefix.
If the message id will be printed to the console / syslog at all depends
on CONFIG_MSG_IDS. If it is "n" then a kmsg_xxx call is just another
printk wrapper. These macros are intended to be used uniformly in the
s390 architecture and the s390 device drivers.
Signed-off-by: Michael Holzheu <holzheu@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/Kconfig | 9 +++
include/linux/kmsg.h | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+)
Index: linux-2.6/arch/s390/Kconfig
===================================================================
--- linux-2.6.orig/arch/s390/Kconfig
+++ linux-2.6/arch/s390/Kconfig
@@ -568,6 +568,15 @@ bool "s390 guest support (EXPERIMENTAL)"
select VIRTIO_CONSOLE
help
Select this option if you want to run the kernel under s390 linux
+
+config KMSG_IDS
+ bool "Kernel message numbers"
+ default y
+ help
+ Select this option if you want to include a message number to the
+ prefix for kernel messages issued by the s390 architecture and
+ driver code. See "Documentation/s390/kmsg.txt" for more details.
+
endmenu
source "net/Kconfig"
Index: linux-2.6/include/linux/kmsg.h
===================================================================
--- /dev/null
+++ linux-2.6/include/linux/kmsg.h
@@ -0,0 +1,124 @@
+#ifndef _LINUX_KMSG_H
+#define _LINUX_KMSG_H
+
+#ifndef __KMSG_CHECKER
+#define __KMSG_CHECK(level, id) KERN_##level
+#endif
+
+#if defined(__KMSG_CHECKER) || !defined(CONFIG_KMSG_IDS)
+
+#define kmsg_dev_alert(id, dev, format, arg...) \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_err(id, dev, format, arg...) \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_warn(id, dev, format, arg...) \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_info(id, dev, format, arg...) \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_notice(id, dev, format, arg...) \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_alert(id, format, arg...) \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_err(id, format, arg...) \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_warn(id, format, arg...) \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_info(id, format, arg...) \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_notice(id, format, arg...) \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#else /* __KMSG_CHECKER || !CONFIG_KMSG_IDS */
+
+#define kmsg_dev_alert(id, dev, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ "." #id ": %s: " format, (dev)->bus_id , ## arg) : \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_err(id, dev, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ "." #id ": %s: " format, (dev)->bus_id , ## arg) : \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_warn(id, dev, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ "." #id ": %s: " format, (dev)->bus_id , ## arg) : \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_info(id, dev, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ "." #id ": %s: " format, (dev)->bus_id , ## arg) : \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_dev_notice(id, dev, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ "." #id ": %s: " format, (dev)->bus_id , ## arg) : \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ ": %s: " format, (dev)->bus_id , ## arg)
+
+#define kmsg_alert(id, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ "." #id ": " format, ## arg) : \
+ printk(__KMSG_CHECK(ALERT, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_err(id, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ "." #id ": " format, ## arg) : \
+ printk(__KMSG_CHECK(ERR, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_warn(id, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ "." #id ": " format, ## arg) : \
+ printk(__KMSG_CHECK(WARNING, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_info(id, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ "." #id ": " format, ## arg) : \
+ printk(__KMSG_CHECK(INFO, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#define kmsg_notice(id, format, arg...) \
+ (__builtin_constant_p(id) && (id) > 0) ? \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ "." #id ": " format, ## arg) : \
+ printk(__KMSG_CHECK(NOTICE, id) KMSG_COMPONENT \
+ ": " format, ## arg)
+
+#endif /* __KMSG_CHECKER || !CONFIG_KMSG_IDS */
+
+#endif /* _LINUX_KMSG_H */
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-07-30 17:12 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-30 16:56 [patch 0/3] [RFC] kmsg macros and script, take x+1 Martin Schwidefsky
2008-07-30 16:56 ` Martin Schwidefsky [this message]
2008-07-30 19:39 ` [patch 1/3] kmsg: Kernel message catalog macros Greg KH
2008-07-31 8:35 ` Martin Schwidefsky
2008-07-30 22:02 ` Kay Sievers
2008-07-30 22:04 ` Greg KH
2008-07-31 9:10 ` Martin Schwidefsky
2008-08-05 22:31 ` Greg KH
2008-08-06 8:35 ` Martin Schwidefsky
2008-08-06 20:07 ` Greg KH
2008-08-07 8:31 ` Martin Schwidefsky
2008-08-07 15:59 ` Joe Perches
2008-08-10 0:08 ` Martin Schwidefsky
2008-08-16 19:36 ` Joe Perches
2008-08-17 17:27 ` Martin Schwidefsky
2008-08-07 17:01 ` Greg KH
2008-08-10 0:03 ` Martin Schwidefsky
2008-08-11 10:54 ` Jan Kara
2008-07-31 8:36 ` Martin Schwidefsky
2008-08-13 0:35 ` Tim Hockin
2008-08-14 17:04 ` Martin Schwidefsky
2008-08-14 18:50 ` Tim Hockin
2008-08-15 3:08 ` Joe Perches
2008-08-15 3:44 ` Greg KH
2008-08-15 5:33 ` Tim Hockin
2008-08-15 11:21 ` Jan Blunck
2008-08-15 15:39 ` Tim Hockin
2008-08-18 9:23 ` Pavel Machek
2008-08-18 10:39 ` Jan Kara
2008-08-18 17:51 ` Tim Hockin
2008-08-15 16:03 ` Greg KH
2008-08-15 17:03 ` Tim Hockin
2008-08-16 18:06 ` Martin Schwidefsky
2008-08-13 4:33 ` Rusty Russell
2008-08-13 7:04 ` Tim Hockin
2008-08-13 7:13 ` Pavel Machek
2008-08-13 14:50 ` Tim Hockin
2008-08-14 1:53 ` Rusty Russell
2008-08-14 15:40 ` Tim Hockin
2008-08-14 17:11 ` Martin Schwidefsky
2008-08-14 17:07 ` Martin Schwidefsky
2008-08-14 23:22 ` Rusty Russell
2008-08-16 17:49 ` Martin Schwidefsky
2008-08-16 20:40 ` Tim Hockin
2008-08-17 3:39 ` Rick Troth
2008-08-17 5:11 ` Rusty Russell
2008-08-17 17:33 ` Martin Schwidefsky
2008-08-17 17:28 ` Martin Schwidefsky
2008-08-17 17:31 ` Tim Hockin
2008-08-15 20:05 ` Rick Troth
2008-08-16 17:45 ` Martin Schwidefsky
2008-08-25 15:56 ` Martin Schwidefsky
2008-08-26 1:38 ` Rusty Russell
2008-09-01 12:28 ` Martin Schwidefsky
2008-09-02 13:34 ` Rusty Russell
2008-09-02 14:16 ` Martin Schwidefsky
2008-07-30 16:56 ` [patch 2/3] kmsg: Kernel message catalog script Martin Schwidefsky
2008-07-31 6:40 ` KOSAKI Motohiro
2008-07-31 10:23 ` Takashi Nishiie
2008-08-01 11:39 ` Martin Schwidefsky
2008-07-30 16:56 ` [patch 3/3] kmsg: convert xpram messages to kmsg api Martin Schwidefsky
2008-07-30 19:43 ` Greg KH
2008-07-31 8:33 ` Martin Schwidefsky
2008-08-05 22:34 ` Greg KH
2008-08-06 8:46 ` Martin Schwidefsky
2008-08-06 20:11 ` Greg KH
2008-08-07 8:39 ` Martin Schwidefsky
2008-08-07 17:03 ` Greg KH
2008-08-04 6:48 ` Pavel Machek
2008-08-04 8:06 ` Martin Schwidefsky
[not found] ` <20080804202614.GA29170@uranus.ravnborg.org>
2008-08-05 8:03 ` [patch 0/3] [RFC] kmsg macros and script, take x+1 Martin Schwidefsky
[not found] <OF576C88F7.D38E7FE6-ONC12574B1.00547361-C12574B1.005502D2@de.ibm.com>
2008-09-01 12:30 ` [patch 1/3] kmsg: Kernel message catalog macros Martin Schwidefsky
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=20080730171156.824640459@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=gh@us.ibm.com \
--cc=gregkh@suse.de \
--cc=holzheu@de.ibm.com \
--cc=jack@suse.cz \
--cc=jochen.voss@googlemail.com \
--cc=joe@perches.com \
--cc=kunai@linux-foundation.jp \
--cc=lf_kernel_messages@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=randy.dunlap@oracle.com \
--cc=sam@ravnborg.org \
--cc=tim.bird@am.sony.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;
as well as URLs for NNTP newsgroup(s).