Commit 91416cfd authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Michal Marek

export_report: fix perl warnings

Use local file handles, use three argument open.
Don't modify arguments in perl grep (use sed instead)
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarWANG Cong <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent 9c49fd30
......@@ -49,10 +49,10 @@ sub usage {
}
sub collectcfiles {
my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`;
@file = grep {s/\.ko/.mod.c/} @file;
chomp @file;
return @file;
my @file
= `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
chomp @file;
return @file;
}
my (%SYMBOL, %MODULE, %opt, @allcfiles);
......@@ -71,37 +71,40 @@ if (not defined $opt{'k'}) {
$opt{'k'} = "Module.symvers";
}
unless (open(MODULE_SYMVERS, $opt{'k'})) {
die "Sorry, cannot open $opt{'k'}: $!\n";
}
open (my $module_symvers, '<', $opt{'k'})
or die "Sorry, cannot open $opt{'k'}: $!\n";
if (defined $opt{'o'}) {
unless (open(OUTPUT_HANDLE, ">$opt{'o'}")) {
die "Sorry, cannot open $opt{'o'} $!\n";
}
select OUTPUT_HANDLE;
open (my $out, '>', $opt{'o'})
or die "Sorry, cannot open $opt{'o'} $!\n";
select $out;
}
#
# collect all the symbols and their attributes from the
# Module.symvers file
#
while ( <MODULE_SYMVERS> ) {
while ( <$module_symvers> ) {
chomp;
my (undef, $symbol, $module, $gpl) = split;
$SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
}
close(MODULE_SYMVERS);
close($module_symvers);
#
# collect the usage count of each symbol.
#
foreach my $thismod (@allcfiles) {
unless (open(MODULE_MODULE, $thismod)) {
print "Sorry, cannot open $thismod: $!\n";
my $module;
unless (open ($module, '<', $thismod)) {
warn "Sorry, cannot open $thismod: $!\n";
next;
}
my $state=0;
while ( <MODULE_MODULE> ) {
while ( <$module> ) {
chomp;
if ($state == 0) {
$state = 1 if ($_ =~ /static const struct modversion_info/);
......@@ -124,7 +127,7 @@ foreach my $thismod (@allcfiles) {
if ($state != 2) {
print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n";
}
close(MODULE_MODULE);
close($module);
}
print "\tThis file reports the exported symbols usage patterns by in-tree\n",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment