-
Ram Pai authored
Fixes some subtle perl coding bug observed by Jan Engelhardt <jengelh@computergmbh.de> This patch applies on top of Adrian's fix. Signed-off-by:
Ram Pai <linuxram@us.ibm.com> Acked-by:
Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
Ram Pai authoredFixes some subtle perl coding bug observed by Jan Engelhardt <jengelh@computergmbh.de> This patch applies on top of Adrian's fix. Signed-off-by:
Ram Pai <linuxram@us.ibm.com> Acked-by:
Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by:
Sam Ravnborg <sam@ravnborg.org>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
export_report.pl 4.22 KiB
#!/usr/bin/perl -w
#
# (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 Getopt::Std;
use strict;
sub numerically {
my $no1 = (split /\s+/, $a)[1];
my $no2 = (split /\s+/, $b)[1];
return $no1 <=> $no2;
}
sub alphabetically {
my ($module1, $value1) = @{$a};
my ($module2, $value2) = @{$b};
return $value1 <=> $value2 || $module2 cmp $module1;
}
sub print_depends_on {
my ($href) = @_;
print "\n";
while (my ($mod, $list) = each %$href) {
print "\t$mod:\n";
foreach my $sym (sort numerically @{$list}) {
my ($symbol, $no) = split /\s+/, $sym;
printf("\t\t%-25s\t%-25d\n", $symbol, $no);
}
print "\n";
}
print "\n";
print "~"x80 , "\n";
}
sub usage {
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 collectcfiles {
my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`;
@file = grep {s/\.ko/.mod.c/} @file;
chomp @file;
return @file;
}
my (%SYMBOL, %MODULE, %opt, @allcfiles);
if (not getopts('hk:o:f',\%opt) or defined $opt{'h'}) {
usage($0);
}
if (defined $opt{'f'}) {
@allcfiles = @ARGV;
} else {
@allcfiles = collectcfiles();
}
if (not defined $opt{'k'}) {