From: Joe Perches <joe@perches.com>
To: Jean Delvare <khali@linux-fr.org>
Cc: jengelh@computergmbh.de, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, mm-commits@vger.kernel.org,
adaplas@pol.net, greg@kroah.com, jeff@garzik.org
Subject: Re: + remove-current-defines-and-uses-of-pr_err-add-pr_emerg.patch added to -mm tree
Date: Tue, 07 Aug 2007 09:10:16 -0700 [thread overview]
Message-ID: <1186503016.5983.20.camel@localhost> (raw)
In-Reply-To: <0H03p0ll.1186246070.5043630.khali@localhost>
On Sat, 2007-08-04 at 18:47 +0200, Jean Delvare wrote:
> On 8/4/2007, "Jan Engelhardt" <jengelh@computergmbh.de> 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
printk_block_start
printks
printk_block_end
so that multiple line messages are kept together
in the message logs.
and I've done tree-wide patches for single line
printk(KERN_\(emerg|alert|notice|crit\),
(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";
exit;
}
for ($i=2; $i <= $#ARGV; $i++) {
PrintkSearchReplace($ARGV[$i], $ARGV[0], $ARGV[1]);
}
sub PrintkSearchReplace{
my($file, $search, $replace) = @_;
my $orig = "";
local($/);
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);
}
}
next prev parent reply other threads:[~2007-08-07 16:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tI4NY5SL.1186153543.0764100.khali@localhost>
2007-08-03 22:16 ` + remove-current-defines-and-uses-of-pr_err-add-pr_emerg.patch added to -mm tree Joe Perches
2007-08-04 9:43 ` Jan Engelhardt
2007-08-04 16:47 ` Jean Delvare
2007-08-07 16:10 ` Joe Perches [this message]
2007-08-07 16:16 ` Jan Engelhardt
2007-08-07 20:19 ` Andrew Morton
2007-08-08 20:02 ` Jean Delvare
2007-08-08 20:31 ` Joe Perches
2007-08-08 20:39 ` Jan Engelhardt
2007-08-08 21:36 ` Joe Perches
2007-08-08 21:57 ` Jan Engelhardt
2007-08-08 22:21 ` Joe Perches
2007-08-10 20:22 ` Jean Delvare
2007-08-01 22:27 akpm
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=1186503016.5983.20.camel@localhost \
--to=joe@perches.com \
--cc=adaplas@pol.net \
--cc=akpm@linux-foundation.org \
--cc=greg@kroah.com \
--cc=jeff@garzik.org \
--cc=jengelh@computergmbh.de \
--cc=khali@linux-fr.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mm-commits@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.