[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1190326465.26101.171.camel@localhost>
Date: Thu, 20 Sep 2007 15:14:25 -0700
From: Joe Perches <joe@...ches.com>
To: Tim Bird <tim.bird@...sony.com>
Cc: Rob Landley <rob@...dley.net>, linux-tiny@...enic.com,
linux kernel <linux-kernel@...r.kernel.org>,
CE Linux Developers List <celinux-dev@...e.celinuxforum.org>,
Michael Opdenacker <michael@...e-electrons.com>
Subject: Re: [Announce] Linux-tiny project revival
On Thu, 2007-09-20 at 14:58 -0700, Tim Bird wrote:
> Given that there are about 60,000 printks in the kernel (and that's
> not counting wrappers like dprintk() and other locally-defined
> functions and macros) it would be a huge task to examine the code
> and differentiate strings that really start a new log message
> (and thus should have an attached log level) and strings
> that don't.
I've converted most all of that treewide.
printk(KERN_<level> to pr_<level>(
It's pretty automated.
$ cat pr_alert.sh
#!/bin/sh
egrep -r -w --include=*.[ch] -l "printk[[:space:]]*\([[:space:]]*KERN_ALERT" * | \
xargs perl ../cvt_pr.pl KERN_ALERT pr_alert
$ cat cvt_pr.pl
if ($#ARGV < 3) {
print "usage: KERN_<level> pr_<level> files...\n";
exit;
}
for ($i=2; $i<$#ARGV; $i++) {
PrintkSearchReplace($ARGV[$i], $ARGV[0], $ARGV[1]);
}
sub PrintkSearchReplace{
my($file, $search, $replace) = @_;
my $content = "";
local( $/ );
open( my $fh, $file ) or die "File not found '$file'\n";
$content = <$fh>;
close(my $fh);
my $orig = $content;
$content =~ s/\bprintk[[:space:]]*\([[:space:]]*${search}[[:space:]]*([^\"]*)\"([^\\]*)\\n\"/${replace}\(\1 \"\2\"/mgs;
$content =~ s/\b${replace}\( /${replace}\(/mgs;
if ($orig ne $content)
{
open(my $fh, ">${file}") or die "Could not open '$file'\n";
print $fh $content;
close(my $fh);
}
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists