[Script] Changing the printk()s without KERNEL_ specification

From: Ph. Marek (philipp.marek@bmlv.gv.at)
Date: Mon Mar 10 2003 - 09:48:20 EST


Hello everybody,

Here's the latest version of my script.
I no longer advertise the patches as they are pretty big - for 2.5.64 it's
109022L and 3970383C.704649
bzip2'ed still 700KB - so I'm posting my script instead.

As some weeks ago it searches for occurrences of printk() without KERNEL_* -
specifications (eg KERNEL_DEBUG) and changes these. It tries to be
intelligent about that, ie it tracks if the last printk() in this function
had a \n at the end or not - continued lines shouldn't be messed up with <?>
characters.

This script couldn't parse the files (functions)
        ./fs/umsdos/mangle.c (umsdos_manglename)
        ./fs/affs/super.c (affs_write_super)
        ./sound/oss/emu10k1/audio.c (emu10k1_audio_ioctl)
        ./sound/oss/sb_ess.c (ess_init)
        ./sound/isa/sb/sb16.c (snd_sb16_probe)
        ./sound/isa/opti9xx/opti92x-ad1848.c (snd_card_opti9xx_probe)
and
        ./lib/zlib_deflate/deftree.c
- the first few because of #ifdef tricks with { or } and the last because of a
#define.

In
        ./lib/zlib_deflate/deftree.c
it correctly inserts a KERNEL_DEBUG - but as this printk() is the first in
this function AND in a loop you'll have to use this patch:

diff -u crypto/tcrypt.c.orig crypto/tcrypt.c
--- crypto/tcrypt.c.orig Wed Mar 5 04:29:33 2003
+++ crypto/tcrypt.c Mon Mar 10 15:43:16 2003
@@ -55,6 +55,8 @@
 static void
 hexdump(unsigned char *buf, unsigned int len)
 {
+ printk(KERNEL_DEBUG);
+
        while (len--)
                printk("%02x", *buf++);

to make my script work.

Usage is like
        find . -iname "*.c" | xargs perl -i.bak ~/perl/change_printk.pl
so parts of the tree can be changed as well as the full tree.

Please let me know if you're using this script (just for my pride :-) and let
me also know every problem you encounter.

Regards,

Phil



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:22 EST