From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Michael Holzheu <holzheu@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 01/15] kmsg: Kernel message catalog macros.
Date: Mon, 28 Jul 2008 19:53:56 +0200 [thread overview]
Message-ID: <20080728175511.023246676@de.ibm.com> (raw)
In-Reply-To: 20080728175355.734299984@de.ibm.com
[-- Attachment #1: 800-kmsg-macros.diff --]
[-- Type: text/plain, Size: 6283 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/asm-s390/kmsg.h | 124 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 133 insertions(+)
Index: quilt-2.6/arch/s390/Kconfig
===================================================================
--- quilt-2.6.orig/arch/s390/Kconfig
+++ quilt-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: quilt-2.6/include/asm-s390/kmsg.h
===================================================================
--- /dev/null
+++ quilt-2.6/include/asm-s390/kmsg.h
@@ -0,0 +1,124 @@
+#ifndef _ASM_KMSG_H
+#define _ASM_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 /* _ASM_KMSG_H */
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-07-28 17:53 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 17:53 [patch 00/15] [RFC] kmsg macros and script Martin Schwidefsky
2008-07-28 17:53 ` Martin Schwidefsky [this message]
2008-07-28 18:12 ` [patch 01/15] kmsg: Kernel message catalog macros Joe Perches
2008-07-29 8:07 ` Martin Schwidefsky
2008-07-30 8:30 ` Andrew Morton
2008-07-30 9:13 ` Martin Schwidefsky
2008-07-30 9:23 ` Andrew Morton
2008-07-28 17:53 ` [patch 02/15] kmsg: Kernel message catalog script Martin Schwidefsky
2008-07-28 19:28 ` Sam Ravnborg
2008-07-29 8:42 ` Martin Schwidefsky
2008-07-29 8:45 ` Sam Ravnborg
2008-07-29 11:09 ` Martin Schwidefsky
2008-07-29 15:01 ` Jochen Voß
2008-07-29 15:15 ` Martin Schwidefsky
2008-07-28 17:53 ` [patch 03/15] kmsg: convert cio message to kmsg api Martin Schwidefsky
2008-07-28 17:53 ` [patch 04/15] kmsg: convert vmcp " Martin Schwidefsky
2008-07-28 17:54 ` [patch 05/15] kmsg: convert cpcmd " Martin Schwidefsky
2008-07-28 17:54 ` [patch 06/15] kmsg: convert vmur " Martin Schwidefsky
2008-07-28 17:54 ` [patch 07/15] kmsg: convert xpram messages " Martin Schwidefsky
2008-07-28 17:54 ` [patch 08/15] kmsg: convert cpacf printk " Martin Schwidefsky
2008-07-28 17:54 ` [patch 09/15] kmsg: convert time " Martin Schwidefsky
2008-07-28 17:54 ` [patch 10/15] kmsg: convert hypfs " Martin Schwidefsky
2008-07-28 17:54 ` [patch 11/15] kmsg: convert setup " Martin Schwidefsky
2008-07-28 17:54 ` [patch 12/15] kmsg: convert appldata " Martin Schwidefsky
2008-07-28 17:54 ` [patch 13/15] kmsg: convert monreader " Martin Schwidefsky
2008-07-28 17:54 ` [patch 14/15] kmsg: convert s390 debug feature " Martin Schwidefsky
2008-07-28 17:54 ` [patch 15/15] kmsg: convert monwriter printk messages " 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=20080728175511.023246676@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=holzheu@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/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