forked from Minki/linux
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: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
parent
9c49fd307a
commit
91416cfdf9
@ -49,10 +49,10 @@ sub usage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub collectcfiles {
|
sub collectcfiles {
|
||||||
my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`;
|
my @file
|
||||||
@file = grep {s/\.ko/.mod.c/} @file;
|
= `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`;
|
||||||
chomp @file;
|
chomp @file;
|
||||||
return @file;
|
return @file;
|
||||||
}
|
}
|
||||||
|
|
||||||
my (%SYMBOL, %MODULE, %opt, @allcfiles);
|
my (%SYMBOL, %MODULE, %opt, @allcfiles);
|
||||||
@ -71,37 +71,40 @@ if (not defined $opt{'k'}) {
|
|||||||
$opt{'k'} = "Module.symvers";
|
$opt{'k'} = "Module.symvers";
|
||||||
}
|
}
|
||||||
|
|
||||||
unless (open(MODULE_SYMVERS, $opt{'k'})) {
|
open (my $module_symvers, '<', $opt{'k'})
|
||||||
die "Sorry, cannot open $opt{'k'}: $!\n";
|
or die "Sorry, cannot open $opt{'k'}: $!\n";
|
||||||
}
|
|
||||||
|
|
||||||
if (defined $opt{'o'}) {
|
if (defined $opt{'o'}) {
|
||||||
unless (open(OUTPUT_HANDLE, ">$opt{'o'}")) {
|
open (my $out, '>', $opt{'o'})
|
||||||
die "Sorry, cannot open $opt{'o'} $!\n";
|
or die "Sorry, cannot open $opt{'o'} $!\n";
|
||||||
}
|
|
||||||
select OUTPUT_HANDLE;
|
select $out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# collect all the symbols and their attributes from the
|
# collect all the symbols and their attributes from the
|
||||||
# Module.symvers file
|
# Module.symvers file
|
||||||
#
|
#
|
||||||
while ( <MODULE_SYMVERS> ) {
|
while ( <$module_symvers> ) {
|
||||||
chomp;
|
chomp;
|
||||||
my (undef, $symbol, $module, $gpl) = split;
|
my (undef, $symbol, $module, $gpl) = split;
|
||||||
$SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
|
$SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl];
|
||||||
}
|
}
|
||||||
close(MODULE_SYMVERS);
|
close($module_symvers);
|
||||||
|
|
||||||
#
|
#
|
||||||
# collect the usage count of each symbol.
|
# collect the usage count of each symbol.
|
||||||
#
|
#
|
||||||
foreach my $thismod (@allcfiles) {
|
foreach my $thismod (@allcfiles) {
|
||||||
unless (open(MODULE_MODULE, $thismod)) {
|
my $module;
|
||||||
print "Sorry, cannot open $thismod: $!\n";
|
|
||||||
|
unless (open ($module, '<', $thismod)) {
|
||||||
|
warn "Sorry, cannot open $thismod: $!\n";
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $state=0;
|
my $state=0;
|
||||||
while ( <MODULE_MODULE> ) {
|
while ( <$module> ) {
|
||||||
chomp;
|
chomp;
|
||||||
if ($state == 0) {
|
if ($state == 0) {
|
||||||
$state = 1 if ($_ =~ /static const struct modversion_info/);
|
$state = 1 if ($_ =~ /static const struct modversion_info/);
|
||||||
@ -124,7 +127,7 @@ foreach my $thismod (@allcfiles) {
|
|||||||
if ($state != 2) {
|
if ($state != 2) {
|
||||||
print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n";
|
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",
|
print "\tThis file reports the exported symbols usage patterns by in-tree\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user