From: Tilman Schmidt <tilman@imap.cc>
To: linux-usb-devel@lists.sourceforge.net
Cc: hjlipp@web.de, linux-kernel@vger.kernel.org, Greg KH <gregkh@suse.de>
Subject: [PATCH] reduce syslog clutter (take 2)
Date: Wed, 08 Mar 2006 23:54:23 +0100 [thread overview]
Message-ID: <440F609F.8090604@imap.cc> (raw)
[-- Attachment #1: Type: text/plain, Size: 1988 bytes --]
The current versions of the err() / info() / warn() syslog macros
insert __FILE__ at the beginning of the message, which expands to
the complete path name of the source file within the kernel tree.
With the following patch, when used in a module, they'll insert the
module name instead, which is significantly shorter and also tends to
be more useful to users trying to make sense of a particular message.
This patch replaces the one posted on 24 Feb 2006 10:50:52 +0100
which caused compile errors in non-modular drivers. It applies to
kernel 2.6.16-rc5 after the patch labeled
"add macros notice(), dev_notice() (take 2)".
Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---
usb.h | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
--- linux-2.6.16-rc5-patch-splitpoint/include/linux/usb.h 2006-03-08 12:36:03.000000000 +0100
+++ linux-2.6.16-rc5-patch-splitpoint2/include/linux/usb.h 2006-03-08 12:43:07.000000000 +0100
@@ -1199,14 +1199,20 @@
#define dbg(format, arg...) do {} while (0)
#endif
+#if defined(CONFIG_MODULES) && defined(THIS_MODULE)
+#define KMSG_LOCATION_PREFIX THIS_MODULE ? THIS_MODULE->name : __FILE__
+#else
+#define KMSG_LOCATION_PREFIX __FILE__
+#endif
+
#define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
- __FILE__ , ## arg)
+ KMSG_LOCATION_PREFIX , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
- __FILE__ , ## arg)
+ KMSG_LOCATION_PREFIX , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
- __FILE__ , ## arg)
+ KMSG_LOCATION_PREFIX , ## arg)
#define notice(format, arg...) printk(KERN_NOTICE "%s: " format "\n" , \
- __FILE__ , ## arg)
+ KMSG_LOCATION_PREFIX , ## arg)
#endif /* __KERNEL__ */
--
Tilman Schmidt E-Mail: tilman@imap.cc
Bonn, Germany
Diese Nachricht besteht zu 100% aus wiederverwerteten Bits.
Ungeöffnet mindestens haltbar bis: (siehe Rückseite)
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 253 bytes --]
next reply other threads:[~2006-03-08 22:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-08 22:54 Tilman Schmidt [this message]
2006-03-09 5:47 ` [PATCH] reduce syslog clutter (take 2) Randy.Dunlap
2006-03-09 10:15 ` Tilman Schmidt
2006-03-09 11:02 ` Andrew Morton
2006-03-09 16:34 ` Randy.Dunlap
2006-03-09 18:43 ` Tilman Schmidt
[not found] ` <9a8748490603091058l75aacacsfc5fdba3981fb074@mail.gmail.com>
2006-03-09 19:17 ` Tilman Schmidt
2006-03-09 21:03 ` Andrew Morton
2006-03-09 21:18 ` Pete Zaitcev
2006-03-09 22:42 ` Greg KH
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=440F609F.8090604@imap.cc \
--to=tilman@imap.cc \
--cc=gregkh@suse.de \
--cc=hjlipp@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/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