diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-06-02 08:15:10 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-06-02 08:15:10 -0400 |
commit | e4caa8bab3862a7694ab7c6dfede223227ad7fc5 (patch) | |
tree | 9fa537a72f00f6b4f86c2da7be2e9554304a8ec4 /scripts/export_report.pl | |
parent | 9f75c1b12c5ef392ddcea575b13560842c28b1b3 (diff) | |
parent | edb39935c8b19fcd9a8f619d0bc1e9d04594cd2b (diff) |
Merge branch 'master' of git.alsa-project.org:alsa-kernel into fix/hda
Diffstat (limited to 'scripts/export_report.pl')
-rw-r--r-- | scripts/export_report.pl | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/scripts/export_report.pl b/scripts/export_report.pl index 705b5ba7c152..04dce7c15f83 100644 --- a/scripts/export_report.pl +++ b/scripts/export_report.pl | |||
@@ -49,10 +49,10 @@ sub usage { | |||
49 | } | 49 | } |
50 | 50 | ||
51 | sub collectcfiles { | 51 | sub collectcfiles { |
52 | my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`; | 52 | my @file |
53 | @file = grep {s/\.ko/.mod.c/} @file; | 53 | = `cat .tmp_versions/*.mod | grep '.*\.ko\$' | sed s/\.ko$/.mod.c/`; |
54 | chomp @file; | 54 | chomp @file; |
55 | return @file; | 55 | return @file; |
56 | } | 56 | } |
57 | 57 | ||
58 | my (%SYMBOL, %MODULE, %opt, @allcfiles); | 58 | my (%SYMBOL, %MODULE, %opt, @allcfiles); |
@@ -71,37 +71,40 @@ if (not defined $opt{'k'}) { | |||
71 | $opt{'k'} = "Module.symvers"; | 71 | $opt{'k'} = "Module.symvers"; |
72 | } | 72 | } |
73 | 73 | ||
74 | unless (open(MODULE_SYMVERS, $opt{'k'})) { | 74 | open (my $module_symvers, '<', $opt{'k'}) |
75 | die "Sorry, cannot open $opt{'k'}: $!\n"; | 75 | or die "Sorry, cannot open $opt{'k'}: $!\n"; |
76 | } | ||
77 | 76 | ||
78 | if (defined $opt{'o'}) { | 77 | if (defined $opt{'o'}) { |
79 | unless (open(OUTPUT_HANDLE, ">$opt{'o'}")) { | 78 | open (my $out, '>', $opt{'o'}) |
80 | die "Sorry, cannot open $opt{'o'} $!\n"; | 79 | or die "Sorry, cannot open $opt{'o'} $!\n"; |
81 | } | 80 | |
82 | select OUTPUT_HANDLE; | 81 | select $out; |
83 | } | 82 | } |
83 | |||
84 | # | 84 | # |
85 | # collect all the symbols and their attributes from the | 85 | # collect all the symbols and their attributes from the |
86 | # Module.symvers file | 86 | # Module.symvers file |
87 | # | 87 | # |
88 | while ( <MODULE_SYMVERS> ) { | 88 | while ( <$module_symvers> ) { |
89 | chomp; | 89 | chomp; |
90 | my (undef, $symbol, $module, $gpl) = split; | 90 | my (undef, $symbol, $module, $gpl) = split; |
91 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; | 91 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; |
92 | } | 92 | } |
93 | close(MODULE_SYMVERS); | 93 | close($module_symvers); |
94 | 94 | ||
95 | # | 95 | # |
96 | # collect the usage count of each symbol. | 96 | # collect the usage count of each symbol. |
97 | # | 97 | # |
98 | foreach my $thismod (@allcfiles) { | 98 | foreach my $thismod (@allcfiles) { |
99 | unless (open(MODULE_MODULE, $thismod)) { | 99 | my $module; |
100 | print "Sorry, cannot open $thismod: $!\n"; | 100 | |
101 | unless (open ($module, '<', $thismod)) { | ||
102 | warn "Sorry, cannot open $thismod: $!\n"; | ||
101 | next; | 103 | next; |
102 | } | 104 | } |
105 | |||
103 | my $state=0; | 106 | my $state=0; |
104 | while ( <MODULE_MODULE> ) { | 107 | while ( <$module> ) { |
105 | chomp; | 108 | chomp; |
106 | if ($state == 0) { | 109 | if ($state == 0) { |
107 | $state = 1 if ($_ =~ /static const struct modversion_info/); | 110 | $state = 1 if ($_ =~ /static const struct modversion_info/); |
@@ -124,7 +127,7 @@ foreach my $thismod (@allcfiles) { | |||
124 | if ($state != 2) { | 127 | if ($state != 2) { |
125 | print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; | 128 | print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; |
126 | } | 129 | } |
127 | close(MODULE_MODULE); | 130 | close($module); |
128 | } | 131 | } |
129 | 132 | ||
130 | print "\tThis file reports the exported symbols usage patterns by in-tree\n", | 133 | print "\tThis file reports the exported symbols usage patterns by in-tree\n", |