Source
print "\ - \",
#!/usr/bin/env perl
#
# (C) Copyright IBM Corporation 2006.
# Released under GPL v2.
# Author : Ram Pai (linuxram@us.ibm.com)
#
# Usage: export_report.pl -k Module.symvers [-o report_file ] -f *.mod.c
#
use ;
use :: ;
use ;
sub {
my $no1 = (split /\ +/, $a)[1];
my $no2 = (split /\ +/, $b)[1];
return $no1 <=> $no2;
}
sub {
my ($module1, $value1) = @{$a};
my ($module2, $value2) = @{$b};
return $value1 <=> $value2 || $module2 cmp $module1;
}
sub {
my ($href) = @_;
print "\n";
for my $mod (sort keys %$href) {
my $list = $href->{$mod};
print "\t$mod:\n";
foreach my $sym (sort @{$list}) {
my ($symbol, $no) = split /\ +/, $sym;
printf("\t\t%-25s\n", $symbol);
}
print "\n";
}
print "\n";
print "~" , "\n";
}
sub {
print "Usage: @_ -h -k Module.symvers [ -o outputfile ] \n",
"\t-f: treat all the non-option argument as .mod.c files. ",
"Recommend using this as the last option\n",
"\t-h: print detailed help\n",
"\t-k: the path to Module.symvers file. By default uses ",
"the file from the current directory\n",
"\t-o outputfile: output the report to outputfile\n";
exit 0;
}
sub {
my @file;
while (<./*.>) {
open my $fh, '<', $_ or die "cannot open $_: $!\n";
push (@file,
grep s/\.ko/.mod.c/, # change the suffix
grep m/.+\.ko/, # find the .ko path
<$fh>); # lines in opened file
}
chomp @file;
return @file;