Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199552
b: refs/heads/master
c: 91416cf
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and Michal Marek committed Mar 7, 2010
1 parent b1317a4 commit f1e3a06
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9c49fd307a6cb2d3255f9441bce5b7cb08dff79e
refs/heads/master: 91416cfdf98bdbc828fd3e5ca7208beba5979d63
37 changes: 20 additions & 17 deletions trunk/scripts/export_report.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -71,37 +71,40 @@ sub collectcfiles {
$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/);
Expand All @@ -124,7 +127,7 @@ sub collectcfiles {
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",
Expand Down

0 comments on commit f1e3a06

Please sign in to comment.