[lkml]   [2007]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: + remove-current-defines-and-uses-of-pr_err-add-pr_emerg.patch added to -mm tree
On Sat, 2007-08-04 at 18:47 +0200, Jean Delvare wrote:
> On 8/4/2007, "Jan Engelhardt" <> wrote:
> >Ugh. What do we have printk for then? I do not like this.
> >For pr_debug() it makes sense because its semantics change with
> >-DDEBUG and -UDEBUG, but for these pr_()s it does not seem so.
> I think I agree with Jan here, I see no fundamental need for these
> additional macros. But if they are really added, then they should follow
> the same standard as pr_debug() and pr_info(), that is: no "\n" added
> automatically. Otherwise this will become quite messy.

2 reasons:

This change will eventually isolate multiple line
printk messages and allow easier insertion of


so that multiple line messages are kept together
in the message logs.

and I've done tree-wide patches for single line


(about 2000) and fixed several dozen lines without \n
or things like "KERN_<level> /n msg"

Here's the perl script I used.

It's imperfect of course. There are comments with
embedded semicolons where it fails, and #defines
aren't substituted too well.

if ($#ARGV < 2) {
print "usage: KERN_<level> pr_<level> files...\n";

for ($i=2; $i <= $#ARGV; $i++) {
PrintkSearchReplace($ARGV[$i], $ARGV[0], $ARGV[1]);

sub PrintkSearchReplace{
my($file, $search, $replace) = @_;

my $orig = "";
open(my $fh, $file) or die "File not found '$file'\n";
$orig = <$fh>;
close(my $fh);

my $parts = $orig;
my $whole = "";
@segments = split(/\;/, $parts);
foreach $line (@segments) {

if ($whole ne "") {
$whole = $whole . "\;";

my $origline = $line;

if ($line =~ m/\bprintk\s*\(\s*${search}\s*.*\".*\\n\s*\"/ms) {

$line =~ s/\bprintk\s*\(\s*${search}\s*([^\"]*)\"/${replace}\(\1\"/ms;
$line =~ s/\\n\s*\"\s*/\"/ms;

print "${file}: changed:\n" . $origline . "\;" . "\nto:\n" . $line . "\;" . "\n" ;

$whole = $whole . $line;

if ($orig ne $whole) {
open(my $fh, ">${file}") or die "Could not open '$file'\n";
print $fh $whole;
close(my $fh);


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-08-07 18:13    [W:0.045 / U:1.056 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site