public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reduce syslog clutter
@ 2006-02-24  9:50 Tilman Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Tilman Schmidt @ 2006-02-24  9:50 UTC (permalink / raw)
  To: linux-usb-devel; +Cc: hjlipp, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1518 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.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---

 usb.h |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff -ru linux-2.6.16-rc4-mm1-orig/include/linux/usb.h linux-2.6.16-rc4-patch-splitpoint/include/linux/usb.h
--- linux-2.6.16-rc4-mm1-orig/include/linux/usb.h	2006-02-22 12:04:07.000000000 +0100
+++ linux-2.6.16-rc4-patch-splitpoint/include/linux/usb.h	2006-02-24 10:37:53.000000000 +0100
@@ -1211,11 +1211,11 @@
 #endif

 #define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## arg)
 #define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## 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: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread
* [PATCH] reduce syslog clutter
@ 2006-02-23 23:10 Tilman Schmidt
  2006-02-24  6:05 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Tilman Schmidt @ 2006-02-23 23:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: hjlipp

[-- Attachment #1: Type: text/plain, Size: 2409 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.

The patch also adds macros for the KERN_NOTICE severity level which
was so far uncatered for.

Signed-off-by: Tilman Schmidt <tilman@imap.cc>
---

 include/linux/device.h |    2 ++
 include/linux/usb.h    |    8 +++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff -ru linux-2.6.16-rc4/include/linux/device.h linux-2.6.16-rc4-new/include/linux/device.h
--- linux-2.6.16-rc4/include/linux/device.h	2006-02-13 01:27:25.000000000 +0100
+++ linux-2.6.16-rc4-new/include/linux/device.h	2006-02-23 23:28:00.000000000 +0100
@@ -424,6 +424,8 @@
 	dev_printk(KERN_INFO , dev , format , ## arg)
 #define dev_warn(dev, format, arg...)		\
 	dev_printk(KERN_WARNING , dev , format , ## arg)
+#define dev_notice(dev, format, arg...)		\
+	dev_printk(KERN_NOTICE , dev , format , ## arg)

 /* Create alias, so I can be autoloaded. */
 #define MODULE_ALIAS_CHARDEV(major,minor) \
diff -ru linux-2.6.16-rc4/include/linux/usb.h linux-2.6.16-rc4-new/include/linux/usb.h
--- linux-2.6.16-rc4/include/linux/usb.h	2006-02-22 12:04:07.000000000 +0100
+++ linux-2.6.16-rc4-new/include/linux/usb.h	2006-02-23 23:30:35.000000000 +0100
@@ -1211,11 +1211,13 @@
 #endif

 #define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## arg)
 #define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## arg)
 #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , \
-	__FILE__ , ## arg)
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## arg)
+#define notice(format, arg...) printk(KERN_NOTICE "%s: " format "\n", \
+	THIS_MODULE ? THIS_MODULE->name : __FILE__ , ## 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: 250 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-02-24  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-24  9:50 [PATCH] reduce syslog clutter Tilman Schmidt
  -- strict thread matches above, loose matches on Subject: below --
2006-02-23 23:10 Tilman Schmidt
2006-02-24  6:05 ` Greg KH
2006-02-24  9:29   ` Tilman Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox