* [PATCH 0/2] namespace.pl fixes
@ 2010-09-28 8:44 Stephen Hemminger
2010-09-28 8:44 ` [PATCH 1/2] namespace.pl: fix source tree name mangling Stephen Hemminger
2010-09-28 8:44 ` [PATCH 2/2] namespace.pl : update file exclusion list Stephen Hemminger
0 siblings, 2 replies; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-28 8:44 UTC (permalink / raw)
To: Andrew Morton, Michal Marek; +Cc: linux-kernel
Tried looking for code that should be static using the
namespace.pl script, but it appears to have been unused and
broken for a while.
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-28 8:44 [PATCH 0/2] namespace.pl fixes Stephen Hemminger
@ 2010-09-28 8:44 ` Stephen Hemminger
2010-09-29 4:31 ` Américo Wang
2010-09-28 8:44 ` [PATCH 2/2] namespace.pl : update file exclusion list Stephen Hemminger
1 sibling, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-28 8:44 UTC (permalink / raw)
To: Andrew Morton, Michal Marek; +Cc: linux-kernel
[-- Attachment #1: namespace-find-source.patch --]
[-- Type: text/plain, Size: 774 bytes --]
The current namespace.pl script does not find source files correctly.
The problem is that the current directory is not the base of the kernel
tree at the point where it calls objdump.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
@@ -167,8 +167,10 @@ sub do_nm
printf STDERR "$fullname is not an object file\n";
return;
}
- ($source = $fullname) =~ s/\.o$//;
- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
+ $fullname =~ s/\.o$//;
+ $source = $basename;
+ $source =~ s/\.o$//;
+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
$source = "$objtree$source";
} else {
$source = "$srctree$source";
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/2] namespace.pl : update file exclusion list
2010-09-28 8:44 [PATCH 0/2] namespace.pl fixes Stephen Hemminger
2010-09-28 8:44 ` [PATCH 1/2] namespace.pl: fix source tree name mangling Stephen Hemminger
@ 2010-09-28 8:44 ` Stephen Hemminger
2010-09-29 4:43 ` Américo Wang
2010-10-03 3:29 ` Ævar Arnfjörð Bjarmason
1 sibling, 2 replies; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-28 8:44 UTC (permalink / raw)
To: Andrew Morton, Michal Marek; +Cc: linux-kernel
[-- Attachment #1: namespace-hash.patch --]
[-- Type: text/plain, Size: 4451 bytes --]
The list of exceptions in kernel tree was out of date. Convert
the long list of if clauses to a hashes which is more efficient
and more common in perl.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900
+++ b/scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900
@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear in
my %ref = (); # $ref{$name} exists if there is a true external reference to $name
my %export = (); # $export{$name} exists if there is an EXPORT_... of $name
+my %nmexception = (
+ 'fs/ext3/bitmap' => 1,
+ 'fs/ext4/bitmap' => 1,
+ 'arch/x86/lib/thunk_32' => 1,
+ 'arch/x86/lib/cmpxchg' => 1,
+ 'arch/x86/vdso/vdso32/note' => 1,
+ 'lib/irq_regs' => 1,
+ 'usr/initramfs_data' => 1,
+ 'drivers/scsi/aic94xx/aic94xx_dump' => 1,
+ 'drivers/scsi/libsas/sas_dump' => 1,
+ 'lib/dec_and_lock' => 1,
+ 'drivers/ide/ide-probe-mini' => 1,
+ 'usr/initramfs_data' => 1,
+ 'drivers/acpi/acpia/exdump' => 1,
+ 'drivers/acpi/acpia/rsdump' => 1,
+ 'drivers/acpi/acpia/nsdumpdv' => 1,
+ 'drivers/acpi/acpia/nsdump' => 1,
+ 'arch/ia64/sn/kernel/sn2/io' => 1,
+ 'arch/ia64/kernel/gate-data' => 1,
+ 'security/capability' => 1,
+ 'fs/ntfs/sysctl' => 1,
+ 'fs/jfs/jfs_debug' => 1,
+);
+
+my %nameexception = (
+ 'mod_use_count_' => 1,
+ '__initramfs_end' => 1,
+ '__initramfs_start' => 1,
+ '_einittext' => 1,
+ '_sinittext' => 1,
+ 'kallsyms_names' => 1,
+ 'kallsyms_num_syms' => 1,
+ 'kallsyms_addresses'=> 1,
+ '__this_module' => 1,
+ '_etext' => 1,
+ '_edata' => 1,
+ '_end' => 1,
+ '__bss_start' => 1,
+ '_text' => 1,
+ '_stext' => 1,
+ '__gp' => 1,
+ 'ia64_unw_start' => 1,
+ 'ia64_unw_end' => 1,
+ '__init_begin' => 1,
+ '__init_end' => 1,
+ '__bss_stop' => 1,
+ '__nosave_begin' => 1,
+ '__nosave_end' => 1,
+ 'pg0' => 1,
+);
+
+
&find(\&linux_objects, '.'); # find the objects and do_nm on them
&list_multiply_defined();
&resolve_external_references();
@@ -272,27 +324,9 @@ sub do_nm
close($nmdata);
if ($#nmdata < 0) {
- if (
- $fullname ne "lib/brlock.o"
- && $fullname ne "lib/dec_and_lock.o"
- && $fullname ne "fs/xfs/xfs_macros.o"
- && $fullname ne "drivers/ide/ide-probe-mini.o"
- && $fullname ne "usr/initramfs_data.o"
- && $fullname ne "drivers/acpi/executer/exdump.o"
- && $fullname ne "drivers/acpi/resources/rsdump.o"
- && $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
- && $fullname ne "drivers/acpi/namespace/nsdump.o"
- && $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
- && $fullname ne "arch/ia64/kernel/gate-data.o"
- && $fullname ne "drivers/ieee1394/oui.o"
- && $fullname ne "security/capability.o"
- && $fullname ne "sound/core/wrappers.o"
- && $fullname ne "fs/ntfs/sysctl.o"
- && $fullname ne "fs/jfs/jfs_debug.o"
- ) {
- printf "No nm data for $fullname\n";
- }
- return;
+ printf "No nm data for $fullname\n"
+ unless $nmexception{$fullname};
+ return;
}
$nmdata{$fullname} = \@nmdata;
}
@@ -374,31 +408,7 @@ sub resolve_external_references
$ref{$name} = ""
}
}
- elsif ( $name ne "mod_use_count_"
- && $name ne "__initramfs_end"
- && $name ne "__initramfs_start"
- && $name ne "_einittext"
- && $name ne "_sinittext"
- && $name ne "kallsyms_names"
- && $name ne "kallsyms_num_syms"
- && $name ne "kallsyms_addresses"
- && $name ne "__this_module"
- && $name ne "_etext"
- && $name ne "_edata"
- && $name ne "_end"
- && $name ne "__bss_start"
- && $name ne "_text"
- && $name ne "_stext"
- && $name ne "__gp"
- && $name ne "ia64_unw_start"
- && $name ne "ia64_unw_end"
- && $name ne "__init_begin"
- && $name ne "__init_end"
- && $name ne "__bss_stop"
- && $name ne "__nosave_begin"
- && $name ne "__nosave_end"
- && $name ne "pg0"
- && $name ne "__module_text_address"
+ elsif ( ! $nameexception{$name}
&& $name !~ /^__sched_text_/
&& $name !~ /^__start_/
&& $name !~ /^__end_/
@@ -409,7 +419,6 @@ sub resolve_external_references
&& $name !~ /^__.*per_cpu_end/
&& $name !~ /^__alt_instructions/
&& $name !~ /^__setup_/
- && $name !~ /^jiffies/
&& $name !~ /^__mod_timer/
&& $name !~ /^__mod_page_state/
&& $name !~ /^init_module/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-28 8:44 ` [PATCH 1/2] namespace.pl: fix source tree name mangling Stephen Hemminger
@ 2010-09-29 4:31 ` Américo Wang
2010-09-29 5:11 ` Stephen Hemminger
0 siblings, 1 reply; 15+ messages in thread
From: Américo Wang @ 2010-09-29 4:31 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Andrew Morton, Michal Marek, linux-kernel
On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
>The current namespace.pl script does not find source files correctly.
>The problem is that the current directory is not the base of the kernel
>tree at the point where it calls objdump.
>
>Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
>--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
>+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
>@@ -167,8 +167,10 @@ sub do_nm
> printf STDERR "$fullname is not an object file\n";
> return;
> }
>- ($source = $fullname) =~ s/\.o$//;
>- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
>+ $fullname =~ s/\.o$//;
>+ $source = $basename;
>+ $source =~ s/\.o$//;
With your patch applied, $source will be the basename of
an obj path with .o stripped.
>+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
> $source = "$objtree$source";
> } else {
> $source = "$srctree$source";
>
So here we will get a non-exist path stored in $source.
Are you serious? What problem did you meet? I see no problem
with the original code here.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] namespace.pl : update file exclusion list
2010-09-28 8:44 ` [PATCH 2/2] namespace.pl : update file exclusion list Stephen Hemminger
@ 2010-09-29 4:43 ` Américo Wang
2010-09-29 5:03 ` Stephen Hemminger
2010-10-03 3:29 ` Ævar Arnfjörð Bjarmason
1 sibling, 1 reply; 15+ messages in thread
From: Américo Wang @ 2010-09-29 4:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Andrew Morton, Michal Marek, linux-kernel
On Tue, Sep 28, 2010 at 05:44:03PM +0900, Stephen Hemminger wrote:
>The list of exceptions in kernel tree was out of date. Convert
>the long list of if clauses to a hashes which is more efficient
>and more common in perl.
>
>Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
>--- a/scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900
>+++ b/scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900
>@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear in
> my %ref = (); # $ref{$name} exists if there is a true external reference to $name
> my %export = (); # $export{$name} exists if there is an EXPORT_... of $name
>
>+my %nmexception = (
>+ 'fs/ext3/bitmap' => 1,
>+ 'fs/ext4/bitmap' => 1,
>+ 'arch/x86/lib/thunk_32' => 1,
>+ 'arch/x86/lib/cmpxchg' => 1,
>+ 'arch/x86/vdso/vdso32/note' => 1,
>+ 'lib/irq_regs' => 1,
>+ 'usr/initramfs_data' => 1,
>+ 'drivers/scsi/aic94xx/aic94xx_dump' => 1,
>+ 'drivers/scsi/libsas/sas_dump' => 1,
>+ 'lib/dec_and_lock' => 1,
>+ 'drivers/ide/ide-probe-mini' => 1,
>+ 'usr/initramfs_data' => 1,
>+ 'drivers/acpi/acpia/exdump' => 1,
>+ 'drivers/acpi/acpia/rsdump' => 1,
>+ 'drivers/acpi/acpia/nsdumpdv' => 1,
>+ 'drivers/acpi/acpia/nsdump' => 1,
>+ 'arch/ia64/sn/kernel/sn2/io' => 1,
>+ 'arch/ia64/kernel/gate-data' => 1,
>+ 'security/capability' => 1,
>+ 'fs/ntfs/sysctl' => 1,
>+ 'fs/jfs/jfs_debug' => 1,
>+);
>+
>+my %nameexception = (
>+ 'mod_use_count_' => 1,
>+ '__initramfs_end' => 1,
>+ '__initramfs_start' => 1,
>+ '_einittext' => 1,
>+ '_sinittext' => 1,
>+ 'kallsyms_names' => 1,
>+ 'kallsyms_num_syms' => 1,
>+ 'kallsyms_addresses'=> 1,
>+ '__this_module' => 1,
>+ '_etext' => 1,
>+ '_edata' => 1,
>+ '_end' => 1,
>+ '__bss_start' => 1,
>+ '_text' => 1,
>+ '_stext' => 1,
>+ '__gp' => 1,
>+ 'ia64_unw_start' => 1,
>+ 'ia64_unw_end' => 1,
>+ '__init_begin' => 1,
>+ '__init_end' => 1,
>+ '__bss_stop' => 1,
>+ '__nosave_begin' => 1,
>+ '__nosave_end' => 1,
>+ 'pg0' => 1,
>+);
>+
>+
> &find(\&linux_objects, '.'); # find the objects and do_nm on them
> &list_multiply_defined();
> &resolve_external_references();
>@@ -272,27 +324,9 @@ sub do_nm
> close($nmdata);
>
> if ($#nmdata < 0) {
>- if (
>- $fullname ne "lib/brlock.o"
>- && $fullname ne "lib/dec_and_lock.o"
>- && $fullname ne "fs/xfs/xfs_macros.o"
>- && $fullname ne "drivers/ide/ide-probe-mini.o"
>- && $fullname ne "usr/initramfs_data.o"
>- && $fullname ne "drivers/acpi/executer/exdump.o"
>- && $fullname ne "drivers/acpi/resources/rsdump.o"
>- && $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
>- && $fullname ne "drivers/acpi/namespace/nsdump.o"
>- && $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
>- && $fullname ne "arch/ia64/kernel/gate-data.o"
>- && $fullname ne "drivers/ieee1394/oui.o"
>- && $fullname ne "security/capability.o"
>- && $fullname ne "sound/core/wrappers.o"
>- && $fullname ne "fs/ntfs/sysctl.o"
>- && $fullname ne "fs/jfs/jfs_debug.o"
>- ) {
>- printf "No nm data for $fullname\n";
>- }
>- return;
>+ printf "No nm data for $fullname\n"
>+ unless $nmexception{$fullname};
>+ return;
> }
> $nmdata{$fullname} = \@nmdata;
> }
>@@ -374,31 +408,7 @@ sub resolve_external_references
> $ref{$name} = ""
> }
> }
>- elsif ( $name ne "mod_use_count_"
>- && $name ne "__initramfs_end"
>- && $name ne "__initramfs_start"
>- && $name ne "_einittext"
>- && $name ne "_sinittext"
>- && $name ne "kallsyms_names"
>- && $name ne "kallsyms_num_syms"
>- && $name ne "kallsyms_addresses"
>- && $name ne "__this_module"
>- && $name ne "_etext"
>- && $name ne "_edata"
>- && $name ne "_end"
>- && $name ne "__bss_start"
>- && $name ne "_text"
>- && $name ne "_stext"
>- && $name ne "__gp"
>- && $name ne "ia64_unw_start"
>- && $name ne "ia64_unw_end"
>- && $name ne "__init_begin"
>- && $name ne "__init_end"
>- && $name ne "__bss_stop"
>- && $name ne "__nosave_begin"
>- && $name ne "__nosave_end"
>- && $name ne "pg0"
>- && $name ne "__module_text_address"
>+ elsif ( ! $nameexception{$name}
> && $name !~ /^__sched_text_/
> && $name !~ /^__start_/
> && $name !~ /^__end_/
>@@ -409,7 +419,6 @@ sub resolve_external_references
> && $name !~ /^__.*per_cpu_end/
> && $name !~ /^__alt_instructions/
> && $name !~ /^__setup_/
>- && $name !~ /^jiffies/
I don't check all the symbols you updated, but why did you remove 'jiffies'?
It is defined externally by the linker too.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] namespace.pl : update file exclusion list
2010-09-29 4:43 ` Américo Wang
@ 2010-09-29 5:03 ` Stephen Hemminger
0 siblings, 0 replies; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-29 5:03 UTC (permalink / raw)
To: Américo Wang; +Cc: Andrew Morton, Michal Marek, linux-kernel
On Wed, 29 Sep 2010 12:43:22 +0800
Américo Wang <xiyou.wangcong@gmail.com> wrote:
> On Tue, Sep 28, 2010 at 05:44:03PM +0900, Stephen Hemminger wrote:
> >The list of exceptions in kernel tree was out of date. Convert
> >the long list of if clauses to a hashes which is more efficient
> >and more common in perl.
> >
> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> >--- a/scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900
> >+++ b/scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900
> >@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear in
> > my %ref = (); # $ref{$name} exists if there is a true external reference to $name
> > my %export = (); # $export{$name} exists if there is an EXPORT_... of $name
> >
> >+my %nmexception = (
> >+ 'fs/ext3/bitmap' => 1,
> >+ 'fs/ext4/bitmap' => 1,
> >+ 'arch/x86/lib/thunk_32' => 1,
> >+ 'arch/x86/lib/cmpxchg' => 1,
> >+ 'arch/x86/vdso/vdso32/note' => 1,
> >+ 'lib/irq_regs' => 1,
> >+ 'usr/initramfs_data' => 1,
> >+ 'drivers/scsi/aic94xx/aic94xx_dump' => 1,
> >+ 'drivers/scsi/libsas/sas_dump' => 1,
> >+ 'lib/dec_and_lock' => 1,
> >+ 'drivers/ide/ide-probe-mini' => 1,
> >+ 'usr/initramfs_data' => 1,
> >+ 'drivers/acpi/acpia/exdump' => 1,
> >+ 'drivers/acpi/acpia/rsdump' => 1,
> >+ 'drivers/acpi/acpia/nsdumpdv' => 1,
> >+ 'drivers/acpi/acpia/nsdump' => 1,
> >+ 'arch/ia64/sn/kernel/sn2/io' => 1,
> >+ 'arch/ia64/kernel/gate-data' => 1,
> >+ 'security/capability' => 1,
> >+ 'fs/ntfs/sysctl' => 1,
> >+ 'fs/jfs/jfs_debug' => 1,
> >+);
> >+
> >+my %nameexception = (
> >+ 'mod_use_count_' => 1,
> >+ '__initramfs_end' => 1,
> >+ '__initramfs_start' => 1,
> >+ '_einittext' => 1,
> >+ '_sinittext' => 1,
> >+ 'kallsyms_names' => 1,
> >+ 'kallsyms_num_syms' => 1,
> >+ 'kallsyms_addresses'=> 1,
> >+ '__this_module' => 1,
> >+ '_etext' => 1,
> >+ '_edata' => 1,
> >+ '_end' => 1,
> >+ '__bss_start' => 1,
> >+ '_text' => 1,
> >+ '_stext' => 1,
> >+ '__gp' => 1,
> >+ 'ia64_unw_start' => 1,
> >+ 'ia64_unw_end' => 1,
> >+ '__init_begin' => 1,
> >+ '__init_end' => 1,
> >+ '__bss_stop' => 1,
> >+ '__nosave_begin' => 1,
> >+ '__nosave_end' => 1,
> >+ 'pg0' => 1,
> >+);
> >+
> >+
> > &find(\&linux_objects, '.'); # find the objects and do_nm on them
> > &list_multiply_defined();
> > &resolve_external_references();
> >@@ -272,27 +324,9 @@ sub do_nm
> > close($nmdata);
> >
> > if ($#nmdata < 0) {
> >- if (
> >- $fullname ne "lib/brlock.o"
> >- && $fullname ne "lib/dec_and_lock.o"
> >- && $fullname ne "fs/xfs/xfs_macros.o"
> >- && $fullname ne "drivers/ide/ide-probe-mini.o"
> >- && $fullname ne "usr/initramfs_data.o"
> >- && $fullname ne "drivers/acpi/executer/exdump.o"
> >- && $fullname ne "drivers/acpi/resources/rsdump.o"
> >- && $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
> >- && $fullname ne "drivers/acpi/namespace/nsdump.o"
> >- && $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
> >- && $fullname ne "arch/ia64/kernel/gate-data.o"
> >- && $fullname ne "drivers/ieee1394/oui.o"
> >- && $fullname ne "security/capability.o"
> >- && $fullname ne "sound/core/wrappers.o"
> >- && $fullname ne "fs/ntfs/sysctl.o"
> >- && $fullname ne "fs/jfs/jfs_debug.o"
> >- ) {
> >- printf "No nm data for $fullname\n";
> >- }
> >- return;
> >+ printf "No nm data for $fullname\n"
> >+ unless $nmexception{$fullname};
> >+ return;
> > }
> > $nmdata{$fullname} = \@nmdata;
> > }
> >@@ -374,31 +408,7 @@ sub resolve_external_references
> > $ref{$name} = ""
> > }
> > }
> >- elsif ( $name ne "mod_use_count_"
> >- && $name ne "__initramfs_end"
> >- && $name ne "__initramfs_start"
> >- && $name ne "_einittext"
> >- && $name ne "_sinittext"
> >- && $name ne "kallsyms_names"
> >- && $name ne "kallsyms_num_syms"
> >- && $name ne "kallsyms_addresses"
> >- && $name ne "__this_module"
> >- && $name ne "_etext"
> >- && $name ne "_edata"
> >- && $name ne "_end"
> >- && $name ne "__bss_start"
> >- && $name ne "_text"
> >- && $name ne "_stext"
> >- && $name ne "__gp"
> >- && $name ne "ia64_unw_start"
> >- && $name ne "ia64_unw_end"
> >- && $name ne "__init_begin"
> >- && $name ne "__init_end"
> >- && $name ne "__bss_stop"
> >- && $name ne "__nosave_begin"
> >- && $name ne "__nosave_end"
> >- && $name ne "pg0"
> >- && $name ne "__module_text_address"
> >+ elsif ( ! $nameexception{$name}
> > && $name !~ /^__sched_text_/
> > && $name !~ /^__start_/
> > && $name !~ /^__end_/
> >@@ -409,7 +419,6 @@ sub resolve_external_references
> > && $name !~ /^__.*per_cpu_end/
> > && $name !~ /^__alt_instructions/
> > && $name !~ /^__setup_/
> >- && $name !~ /^jiffies/
>
>
> I don't check all the symbols you updated, but why did you remove 'jiffies'?
> It is defined externally by the linker too.
When I tested "jiffies" symbols not reported as an error, so I removed it.
If it shows up then it would be better to add the symbol to the has instead of the regular
expression which is too broad.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 4:31 ` Américo Wang
@ 2010-09-29 5:11 ` Stephen Hemminger
2010-09-29 6:04 ` Américo Wang
0 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-29 5:11 UTC (permalink / raw)
To: Américo Wang; +Cc: Andrew Morton, Michal Marek, linux-kernel
On Wed, 29 Sep 2010 12:31:12 +0800
Américo Wang <xiyou.wangcong@gmail.com> wrote:
> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
> >The current namespace.pl script does not find source files correctly.
> >The problem is that the current directory is not the base of the kernel
> >tree at the point where it calls objdump.
> >
> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
> >@@ -167,8 +167,10 @@ sub do_nm
> > printf STDERR "$fullname is not an object file\n";
> > return;
> > }
> >- ($source = $fullname) =~ s/\.o$//;
> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
> >+ $fullname =~ s/\.o$//;
> >+ $source = $basename;
> >+ $source =~ s/\.o$//;
>
> With your patch applied, $source will be the basename of
> an obj path with .o stripped.
>
> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
> > $source = "$objtree$source";
> > } else {
> > $source = "$srctree$source";
> >
>
> So here we will get a non-exist path stored in $source.
>
> Are you serious? What problem did you meet? I see no problem
> with the original code here.
The original script is broken, if you run it on a compiled
kernel tree.
No source file found for arch/x86/boot/a20.o
No source file found for arch/x86/boot/bioscall.o
No source file found for arch/x86/boot/cmdline.o
No source file found for arch/x86/boot/copy.o
No source file found for arch/x86/boot/cpucheck.o
No source file found for arch/x86/boot/early_serial_console.o
No source file found for arch/x86/boot/edd.o
No source file found for arch/x86/boot/main.o
No source file found for arch/x86/boot/mca.o
No source file found for arch/x86/boot/memory.o
No source file found for arch/x86/boot/pm.o
No source file found for arch/x86/boot/pmjump.o
No source file found for arch/x86/boot/printf.o
...
Running under perl debugger shows that the script has
done chdir prior to the failing test:
if (! -e "$source.c" && ! -e "$source.S") {
# No obvious source, exclude the object if it is conglomerate
>> open(my $objdumpdata, "$objdump $basename|")
or die "$objdump $fullname failed $!\n";
For the first error:
DB<3> x $source
0 'arch/x86/boot/a20'
DB<4> !!pwd
/home/shemminger/kernel/net-next-2.6/arch/x86/boot
DB<5> x $fullname
0 'arch/x86/boot/a20.o'
DB<6> x $basename
0 'a20.o'
Therefore the problem was that $source was full path not the base
of the file name 'a20'
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 5:11 ` Stephen Hemminger
@ 2010-09-29 6:04 ` Américo Wang
2010-09-29 6:06 ` Stephen Hemminger
0 siblings, 1 reply; 15+ messages in thread
From: Américo Wang @ 2010-09-29 6:04 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Américo Wang, Andrew Morton, Michal Marek, linux-kernel
On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
>On Wed, 29 Sep 2010 12:31:12 +0800
>Américo Wang <xiyou.wangcong@gmail.com> wrote:
>
>> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
>> >The current namespace.pl script does not find source files correctly.
>> >The problem is that the current directory is not the base of the kernel
>> >tree at the point where it calls objdump.
>> >
>> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> >
>> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
>> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
>> >@@ -167,8 +167,10 @@ sub do_nm
>> > printf STDERR "$fullname is not an object file\n";
>> > return;
>> > }
>> >- ($source = $fullname) =~ s/\.o$//;
>> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
>> >+ $fullname =~ s/\.o$//;
>> >+ $source = $basename;
>> >+ $source =~ s/\.o$//;
>>
>> With your patch applied, $source will be the basename of
>> an obj path with .o stripped.
>>
>> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
>> > $source = "$objtree$source";
>> > } else {
>> > $source = "$srctree$source";
>> >
>>
>> So here we will get a non-exist path stored in $source.
>>
>> Are you serious? What problem did you meet? I see no problem
>> with the original code here.
>
>The original script is broken, if you run it on a compiled
>kernel tree.
>
>No source file found for arch/x86/boot/a20.o
>No source file found for arch/x86/boot/bioscall.o
>No source file found for arch/x86/boot/cmdline.o
>No source file found for arch/x86/boot/copy.o
>No source file found for arch/x86/boot/cpucheck.o
>No source file found for arch/x86/boot/early_serial_console.o
>No source file found for arch/x86/boot/edd.o
>No source file found for arch/x86/boot/main.o
>No source file found for arch/x86/boot/mca.o
>No source file found for arch/x86/boot/memory.o
>No source file found for arch/x86/boot/pm.o
>No source file found for arch/x86/boot/pmjump.o
>No source file found for arch/x86/boot/printf.o
>
>...
>
>Running under perl debugger shows that the script has
>done chdir prior to the failing test:
>
I see, the docs of Find module said it will do chdir. :)
But I think your patch is still not right, how about the
one below?
------------------>
File::Find will do chdir, so using a relative patch is
not correct. Use an absolute patch instead.
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
diff --git a/scripts/namespace.pl b/scripts/namespace.pl
index 361d0f7..fb4e245 100755
--- a/scripts/namespace.pl
+++ b/scripts/namespace.pl
@@ -167,11 +167,11 @@ sub do_nm
printf STDERR "$fullname is not an object file\n";
return;
}
- ($source = $fullname) =~ s/\.o$//;
- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
- $source = "$objtree$source";
+ ($source = $basename) =~ s/\.o$//;
+ if (-e "$source.c" || -e "$source.S") {
+ $source = "$objtree$File::Find::dir/$source";
} else {
- $source = "$srctree$source";
+ $source = "$srctree$File::Find::dir/$source";
}
if (! -e "$source.c" && ! -e "$source.S") {
# No obvious source, exclude the object if it is conglomerate
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 6:04 ` Américo Wang
@ 2010-09-29 6:06 ` Stephen Hemminger
2010-09-29 7:06 ` Américo Wang
0 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-29 6:06 UTC (permalink / raw)
To: Américo Wang; +Cc: Andrew Morton, Michal Marek, linux-kernel
On Wed, 29 Sep 2010 14:04:27 +0800
Américo Wang <xiyou.wangcong@gmail.com> wrote:
> On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
> >On Wed, 29 Sep 2010 12:31:12 +0800
> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
> >
> >> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
> >> >The current namespace.pl script does not find source files correctly.
> >> >The problem is that the current directory is not the base of the kernel
> >> >tree at the point where it calls objdump.
> >> >
> >> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >> >
> >> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
> >> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
> >> >@@ -167,8 +167,10 @@ sub do_nm
> >> > printf STDERR "$fullname is not an object file\n";
> >> > return;
> >> > }
> >> >- ($source = $fullname) =~ s/\.o$//;
> >> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
> >> >+ $fullname =~ s/\.o$//;
> >> >+ $source = $basename;
> >> >+ $source =~ s/\.o$//;
> >>
> >> With your patch applied, $source will be the basename of
> >> an obj path with .o stripped.
> >>
> >> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
> >> > $source = "$objtree$source";
> >> > } else {
> >> > $source = "$srctree$source";
> >> >
> >>
> >> So here we will get a non-exist path stored in $source.
> >>
> >> Are you serious? What problem did you meet? I see no problem
> >> with the original code here.
> >
> >The original script is broken, if you run it on a compiled
> >kernel tree.
> >
> >No source file found for arch/x86/boot/a20.o
> >No source file found for arch/x86/boot/bioscall.o
> >No source file found for arch/x86/boot/cmdline.o
> >No source file found for arch/x86/boot/copy.o
> >No source file found for arch/x86/boot/cpucheck.o
> >No source file found for arch/x86/boot/early_serial_console.o
> >No source file found for arch/x86/boot/edd.o
> >No source file found for arch/x86/boot/main.o
> >No source file found for arch/x86/boot/mca.o
> >No source file found for arch/x86/boot/memory.o
> >No source file found for arch/x86/boot/pm.o
> >No source file found for arch/x86/boot/pmjump.o
> >No source file found for arch/x86/boot/printf.o
> >
> >...
> >
> >Running under perl debugger shows that the script has
> >done chdir prior to the failing test:
> >
>
> I see, the docs of Find module said it will do chdir. :)
> But I think your patch is still not right, how about the
> one below?
Please be more precise about "not right"? It makes the code
work.
Externally defined symbols with no external references
arch/x86/boot/copy
memcpy
arch/x86/boot/header
_start
bootsect_start
realmode_swtch
arch/x86/boot/pmjump
in_pm32
arch/x86/boot/string
atou
arch/x86/crypto/aes_glue
crypto_aes_decrypt_x86
crypto_aes_encrypt_x86
arch/x86/kernel/acpi/boot
mp_config_acpi_legacy_irqs
mp_override_legacy_irq
mp_register_gsi
arch/x86/kernel/acpi/realmode/copy
memcpy
arch/x86/kernel/acpi/realmode/wakeup
_start
arch/x86/kernel/acpi/wakeup_32
saved_eip
arch/x86/kernel/apic/apic
apic_disable
enable_IR
max_physical_apicid
setup_APIC_eilvt_mce
...
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 6:06 ` Stephen Hemminger
@ 2010-09-29 7:06 ` Américo Wang
2010-09-29 7:14 ` Stephen Hemminger
0 siblings, 1 reply; 15+ messages in thread
From: Américo Wang @ 2010-09-29 7:06 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Américo Wang, Andrew Morton, Michal Marek, linux-kernel
On Wed, Sep 29, 2010 at 03:06:45PM +0900, Stephen Hemminger wrote:
>On Wed, 29 Sep 2010 14:04:27 +0800
>Américo Wang <xiyou.wangcong@gmail.com> wrote:
>
>> On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
>> >On Wed, 29 Sep 2010 12:31:12 +0800
>> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
>> >
>> >> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger wrote:
>> >> >The current namespace.pl script does not find source files correctly.
>> >> >The problem is that the current directory is not the base of the kernel
>> >> >tree at the point where it calls objdump.
>> >> >
>> >> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> >> >
>> >> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
>> >> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
>> >> >@@ -167,8 +167,10 @@ sub do_nm
>> >> > printf STDERR "$fullname is not an object file\n";
>> >> > return;
>> >> > }
>> >> >- ($source = $fullname) =~ s/\.o$//;
>> >> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
>> >> >+ $fullname =~ s/\.o$//;
>> >> >+ $source = $basename;
>> >> >+ $source =~ s/\.o$//;
>> >>
>> >> With your patch applied, $source will be the basename of
>> >> an obj path with .o stripped.
>> >>
>> >> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
>> >> > $source = "$objtree$source";
>> >> > } else {
>> >> > $source = "$srctree$source";
>> >> >
>> >>
>> >> So here we will get a non-exist path stored in $source.
>> >>
...
>>
>> I see, the docs of Find module said it will do chdir. :)
>> But I think your patch is still not right, how about the
>> one below?
>
>Please be more precise about "not right"? It makes the code
>work.
>
Hmm? $srctree is the path of top source code, and $source
is the basename of an object, so dirname is missed, no?
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 7:06 ` Américo Wang
@ 2010-09-29 7:14 ` Stephen Hemminger
2010-09-29 9:34 ` Américo Wang
0 siblings, 1 reply; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-29 7:14 UTC (permalink / raw)
To: Américo Wang; +Cc: Andrew Morton, Michal Marek, linux-kernel
----- Original Message -----
> On Wed, Sep 29, 2010 at 03:06:45PM +0900, Stephen Hemminger wrote:
> >On Wed, 29 Sep 2010 14:04:27 +0800
> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
> >
> >> On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
> >> >On Wed, 29 Sep 2010 12:31:12 +0800
> >> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
> >> >
> >> >> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger
> >> >> wrote:
> >> >> >The current namespace.pl script does not find source files
> >> >> >correctly. The problem is that the current directory is not the
> >> >> >base of the kernel
> >> >> >tree at the point where it calls objdump.
> >> >> >
> >> >> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >> >> >
> >> >> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
> >> >> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
> >> >> >@@ -167,8 +167,10 @@ sub do_nm
> >> >> > printf STDERR "$fullname is not an object file\n";
> >> >> > return;
> >> >> > }
> >> >> >- ($source = $fullname) =~ s/\.o$//;
> >> >> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
> >> >> >+ $fullname =~ s/\.o$//;
> >> >> >+ $source = $basename;
> >> >> >+ $source =~ s/\.o$//;
> >> >>
> >> >> With your patch applied, $source will be the basename of
> >> >> an obj path with .o stripped.
> >> >>
> >> >> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
> >> >> > $source = "$objtree$source";
> >> >> > } else {
> >> >> > $source = "$srctree$source";
> >> >> >
> >> >>
> >> >> So here we will get a non-exist path stored in $source.
> >> >>
> ...
> >>
> >> I see, the docs of Find module said it will do chdir. :)
> >> But I think your patch is still not right, how about the
> >> one below?
> >
> >Please be more precise about "not right"? It makes the code
> >work.
> >
>
> Hmm? $srctree is the path of top source code, and $source
> is the basename of an object, so dirname is missed, no?
No. it works, please stop speculating and use a debugger or demonstrate
what you think the problem is.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 7:14 ` Stephen Hemminger
@ 2010-09-29 9:34 ` Américo Wang
2010-09-29 13:04 ` Stephen Hemminger
0 siblings, 1 reply; 15+ messages in thread
From: Américo Wang @ 2010-09-29 9:34 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Américo Wang, Andrew Morton, Michal Marek, linux-kernel
On Wed, Sep 29, 2010 at 12:14:58AM -0700, Stephen Hemminger wrote:
>
>
>----- Original Message -----
>> On Wed, Sep 29, 2010 at 03:06:45PM +0900, Stephen Hemminger wrote:
>> >On Wed, 29 Sep 2010 14:04:27 +0800
>> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
>> >
>> >> On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
>> >> >On Wed, 29 Sep 2010 12:31:12 +0800
>> >> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
>> >> >
>> >> >> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger
>> >> >> wrote:
>> >> >> >The current namespace.pl script does not find source files
>> >> >> >correctly. The problem is that the current directory is not the
>> >> >> >base of the kernel
>> >> >> >tree at the point where it calls objdump.
>> >> >> >
>> >> >> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>> >> >> >
>> >> >> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
>> >> >> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
>> >> >> >@@ -167,8 +167,10 @@ sub do_nm
>> >> >> > printf STDERR "$fullname is not an object file\n";
>> >> >> > return;
>> >> >> > }
>> >> >> >- ($source = $fullname) =~ s/\.o$//;
>> >> >> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
>> >> >> >+ $fullname =~ s/\.o$//;
>> >> >> >+ $source = $basename;
>> >> >> >+ $source =~ s/\.o$//;
>> >> >>
>> >> >> With your patch applied, $source will be the basename of
>> >> >> an obj path with .o stripped.
>> >> >>
>> >> >> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
>> >> >> > $source = "$objtree$source";
>> >> >> > } else {
>> >> >> > $source = "$srctree$source";
>> >> >> >
>> >> >>
>> >> >> So here we will get a non-exist path stored in $source.
>> >> >>
>> ...
>> >>
>> >> I see, the docs of Find module said it will do chdir. :)
>> >> But I think your patch is still not right, how about the
>> >> one below?
>> >
>> >Please be more precise about "not right"? It makes the code
>> >work.
>> >
>>
>> Hmm? $srctree is the path of top source code, and $source
>> is the basename of an object, so dirname is missed, no?
>
>No. it works, please stop speculating and use a debugger or demonstrate
>what you think the problem is.
>
Just add a print to see what $source is, after you patch applied,
I got something like:
===>/home/wangcong/linux-2.6/btusb
I can't see any reason that this is correct. Maybe it works, but
probably by accident.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
2010-09-29 9:34 ` Américo Wang
@ 2010-09-29 13:04 ` Stephen Hemminger
0 siblings, 0 replies; 15+ messages in thread
From: Stephen Hemminger @ 2010-09-29 13:04 UTC (permalink / raw)
To: Américo Wang
Cc: Stephen Hemminger, Andrew Morton, Michal Marek, linux-kernel
On Wed, 29 Sep 2010 17:34:11 +0800
Américo Wang <xiyou.wangcong@gmail.com> wrote:
> On Wed, Sep 29, 2010 at 12:14:58AM -0700, Stephen Hemminger wrote:
> >
> >
> >----- Original Message -----
> >> On Wed, Sep 29, 2010 at 03:06:45PM +0900, Stephen Hemminger wrote:
> >> >On Wed, 29 Sep 2010 14:04:27 +0800
> >> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
> >> >
> >> >> On Wed, Sep 29, 2010 at 02:11:53PM +0900, Stephen Hemminger wrote:
> >> >> >On Wed, 29 Sep 2010 12:31:12 +0800
> >> >> >Américo Wang <xiyou.wangcong@gmail.com> wrote:
> >> >> >
> >> >> >> On Tue, Sep 28, 2010 at 05:44:02PM +0900, Stephen Hemminger
> >> >> >> wrote:
> >> >> >> >The current namespace.pl script does not find source files
> >> >> >> >correctly. The problem is that the current directory is not the
> >> >> >> >base of the kernel
> >> >> >> >tree at the point where it calls objdump.
> >> >> >> >
> >> >> >> >Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >> >> >> >
> >> >> >> >--- a/scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900
> >> >> >> >+++ b/scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900
> >> >> >> >@@ -167,8 +167,10 @@ sub do_nm
> >> >> >> > printf STDERR "$fullname is not an object file\n";
> >> >> >> > return;
> >> >> >> > }
> >> >> >> >- ($source = $fullname) =~ s/\.o$//;
> >> >> >> >- if (-e "$objtree$source.c" || -e "$objtree$source.S") {
> >> >> >> >+ $fullname =~ s/\.o$//;
> >> >> >> >+ $source = $basename;
> >> >> >> >+ $source =~ s/\.o$//;
> >> >> >>
> >> >> >> With your patch applied, $source will be the basename of
> >> >> >> an obj path with .o stripped.
> >> >> >>
> >> >> >> >+ if (-e "$objtree$fullname.c" || -e "$objtree$fullname.S") {
> >> >> >> > $source = "$objtree$source";
> >> >> >> > } else {
> >> >> >> > $source = "$srctree$source";
> >> >> >> >
> >> >> >>
> >> >> >> So here we will get a non-exist path stored in $source.
> >> >> >>
> >> ...
> >> >>
> >> >> I see, the docs of Find module said it will do chdir. :)
> >> >> But I think your patch is still not right, how about the
> >> >> one below?
> >> >
> >> >Please be more precise about "not right"? It makes the code
> >> >work.
> >> >
> >>
> >> Hmm? $srctree is the path of top source code, and $source
> >> is the basename of an object, so dirname is missed, no?
> >
> >No. it works, please stop speculating and use a debugger or demonstrate
> >what you think the problem is.
> >
>
> Just add a print to see what $source is, after you patch applied,
> I got something like:
>
> ===>/home/wangcong/linux-2.6/btusb
>
> I can't see any reason that this is correct. Maybe it works, but
> probably by accident.
What matters is the output of the script, not the value of some internal
variable.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] namespace.pl : update file exclusion list
2010-09-28 8:44 ` [PATCH 2/2] namespace.pl : update file exclusion list Stephen Hemminger
2010-09-29 4:43 ` Américo Wang
@ 2010-10-03 3:29 ` Ævar Arnfjörð Bjarmason
2010-10-05 1:13 ` Stephen Hemminger
1 sibling, 1 reply; 15+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-10-03 3:29 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Andrew Morton, Michal Marek, linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=UTF-8, Size: 6496 bytes --]
On Tue, Sep 28, 2010 at 08:44, Stephen Hemminger <shemminger@vyatta.com> wrote:
> The list of exceptions in kernel tree was out of date. Convert
> the long list of if clauses to a hashes which is more efficient
> and more common in perl.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> --- a/scripts/namespace.pl    2010-09-28 09:28:52.251563058 +0900
> +++ b/scripts/namespace.pl    2010-09-28 15:13:38.092073114 +0900
> @@ -84,6 +84,58 @@ my %ksymtab = (); Â Â # names that appear in
> Â my %ref = (); Â Â Â Â Â # $ref{$name} exists if there is a true external reference to $name
> Â my %export = (); Â Â Â # $export{$name} exists if there is an EXPORT_... of $name
>
> +my %nmexception = (
> + Â Â 'fs/ext3/bitmap' Â Â Â Â Â Â Â Â Â => 1,
> + Â Â 'fs/ext4/bitmap' Â Â Â Â Â Â Â Â Â => 1,
> + Â Â 'arch/x86/lib/thunk_32' Â Â Â Â Â Â => 1,
> + Â Â 'arch/x86/lib/cmpxchg' Â Â Â Â Â Â => 1,
> + Â Â 'arch/x86/vdso/vdso32/note' Â Â Â Â Â Â Â Â => 1,
> + Â Â 'lib/irq_regs' Â Â Â Â Â Â Â Â Â Â => 1,
> + Â Â 'usr/initramfs_data' Â Â Â Â Â Â Â => 1,
> + Â Â 'drivers/scsi/aic94xx/aic94xx_dump' Â Â Â Â => 1,
> + Â Â 'drivers/scsi/libsas/sas_dump' Â Â => 1,
> + Â Â 'lib/dec_and_lock' Â Â Â Â Â Â Â Â => 1,
> + Â Â 'drivers/ide/ide-probe-mini' Â Â Â => 1,
> + Â Â 'usr/initramfs_data' Â Â Â Â Â Â Â => 1,
> + Â Â 'drivers/acpi/acpia/exdump' Â Â Â Â Â Â Â Â => 1,
> + Â Â 'drivers/acpi/acpia/rsdump' Â Â Â Â Â Â Â Â => 1,
> + Â Â 'drivers/acpi/acpia/nsdumpdv' Â Â Â => 1,
> + Â Â 'drivers/acpi/acpia/nsdump' Â Â Â Â Â Â Â Â => 1,
> + Â Â 'arch/ia64/sn/kernel/sn2/io' Â Â Â => 1,
> + Â Â 'arch/ia64/kernel/gate-data' Â Â Â => 1,
> + Â Â 'security/capability' Â Â Â Â Â Â Â => 1,
> + Â Â 'fs/ntfs/sysctl' Â Â Â Â Â Â Â Â Â => 1,
> + Â Â 'fs/jfs/jfs_debug' Â Â Â Â Â Â Â Â => 1,
> +);
> +
> +my %nameexception = (
> + Â Â 'mod_use_count_' Â Â => 1,
> + Â Â '__initramfs_end' Â => 1,
> + Â Â '__initramfs_start' Â Â Â Â => 1,
> + Â Â '_einittext' Â Â Â => 1,
> + Â Â '_sinittext' Â Â Â => 1,
> + Â Â 'kallsyms_names' Â => 1,
> + Â Â 'kallsyms_num_syms' Â Â Â Â => 1,
> + Â Â 'kallsyms_addresses'=> 1,
> + Â Â '__this_module' Â Â => 1,
> + Â Â '_etext' Â Â Â Â Â => 1,
> + Â Â '_edata' Â Â Â Â Â => 1,
> + Â Â '_end' Â Â Â Â Â Â => 1,
> + Â Â '__bss_start' Â Â Â => 1,
> + Â Â '_text' Â Â Â Â Â Â => 1,
> + Â Â '_stext' Â Â Â Â Â => 1,
> + Â Â '__gp' Â Â Â Â Â Â => 1,
> + Â Â 'ia64_unw_start' Â => 1,
> + Â Â 'ia64_unw_end' Â Â => 1,
> + Â Â '__init_begin' Â Â => 1,
> + Â Â '__init_end' Â Â Â => 1,
> + Â Â '__bss_stop' Â Â Â => 1,
> + Â Â '__nosave_begin' Â => 1,
> + Â Â '__nosave_end' Â Â => 1,
> + Â Â 'pg0' Â Â Â Â Â Â Â => 1,
> +);
> +
> +
> Â &find(\&linux_objects, '.'); Â # find the objects and do_nm on them
> Â &list_multiply_defined();
> Â &resolve_external_references();
> @@ -272,27 +324,9 @@ sub do_nm
> Â Â Â Â close($nmdata);
>
> Â Â Â Â if ($#nmdata < 0) {
> - Â Â Â Â Â Â Â if (
> - Â Â Â Â Â Â Â Â Â Â Â $fullname ne "lib/brlock.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "lib/dec_and_lock.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "fs/xfs/xfs_macros.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/ide/ide-probe-mini.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "usr/initramfs_data.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/acpi/executer/exdump.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/acpi/resources/rsdump.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/acpi/namespace/nsdump.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "arch/ia64/kernel/gate-data.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "drivers/ieee1394/oui.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "security/capability.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "sound/core/wrappers.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "fs/ntfs/sysctl.o"
> - Â Â Â Â Â Â Â Â Â Â Â && $fullname ne "fs/jfs/jfs_debug.o"
> - Â Â Â Â Â Â Â ) {
> - Â Â Â Â Â Â Â Â Â Â Â printf "No nm data for $fullname\n";
> - Â Â Â Â Â Â Â }
> - Â Â Â Â Â Â Â return;
> + Â Â Â Â Â printf "No nm data for $fullname\n"
> + Â Â Â Â Â Â Â unless $nmexception{$fullname};
> + Â Â Â Â Â return;
This would be more readable and easier to update:
my @nmexception = qw(
  fs/ext3/bitmap
  fs/ext4/bitmap
  arch/x86/lib/thunk_32
  arch/x86/lib/cmpxchg
  arch/x86/vdso/vdso32/note
  lib/irq_regs
  usr/initramfs_data
  drivers/scsi/aic94xx/aic94xx_dump
  drivers/scsi/libsas/sas_dump
  lib/dec_and_lock
  drivers/ide/ide-probe-mini
  usr/initramfs_data
  drivers/acpi/acpia/exdump
  drivers/acpi/acpia/rsdump
  drivers/acpi/acpia/nsdumpdv
  drivers/acpi/acpia/nsdump
  arch/ia64/sn/kernel/sn2/io
  arch/ia64/kernel/gate-data
  security/capability
  fs/ntfs/sysctl
  fs/jfs/jfs_debug
);
my @nameexception = qw(
  mod_use_count_
  __initramfs_end
  __initramfs_start
  _einittext
  _sinittext
  kallsyms_names
  kallsyms_num_syms
  kallsyms_addresses
  __this_module
  _etext
  _edata
  _end
  __bss_start
  _text
  _stext
  __gp
  ia64_unw_start
  ia64_unw_end
  __init_begin
  __init_end
  __bss_stop
  __nosave_begin
  __nosave_end
  pg0
);
my (%nmexception, %nameexception);
@nmexception{@nmexception} = ();
@nameexception{@nameexception} = ();
Then later:
print "No nm data for $fullname\n"
  unless exists $nmexception{$fullname};
I.e. use print (not printf) and exists().
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/2] namespace.pl : update file exclusion list
2010-10-03 3:29 ` Ævar Arnfjörð Bjarmason
@ 2010-10-05 1:13 ` Stephen Hemminger
0 siblings, 0 replies; 15+ messages in thread
From: Stephen Hemminger @ 2010-10-05 1:13 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason
Cc: Andrew Morton, Michal Marek, linux-kernel
On Sun, 3 Oct 2010 03:29:43 +0000
Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> On Tue, Sep 28, 2010 at 08:44, Stephen Hemminger <shemminger@vyatta.com> wrote:
> > The list of exceptions in kernel tree was out of date. Convert
> > the long list of if clauses to a hashes which is more efficient
> > and more common in perl.
> >
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> >
> > --- a/scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900
> > +++ b/scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900
> > @@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear in
> > my %ref = (); # $ref{$name} exists if there is a true external reference to $name
> > my %export = (); # $export{$name} exists if there is an EXPORT_... of $name
> >
> > +my %nmexception = (
> > + 'fs/ext3/bitmap' => 1,
> > + 'fs/ext4/bitmap' => 1,
> > + 'arch/x86/lib/thunk_32' => 1,
> > + 'arch/x86/lib/cmpxchg' => 1,
> > + 'arch/x86/vdso/vdso32/note' => 1,
> > + 'lib/irq_regs' => 1,
> > + 'usr/initramfs_data' => 1,
> > + 'drivers/scsi/aic94xx/aic94xx_dump' => 1,
> > + 'drivers/scsi/libsas/sas_dump' => 1,
> > + 'lib/dec_and_lock' => 1,
> > + 'drivers/ide/ide-probe-mini' => 1,
> > + 'usr/initramfs_data' => 1,
> > + 'drivers/acpi/acpia/exdump' => 1,
> > + 'drivers/acpi/acpia/rsdump' => 1,
> > + 'drivers/acpi/acpia/nsdumpdv' => 1,
> > + 'drivers/acpi/acpia/nsdump' => 1,
> > + 'arch/ia64/sn/kernel/sn2/io' => 1,
> > + 'arch/ia64/kernel/gate-data' => 1,
> > + 'security/capability' => 1,
> > + 'fs/ntfs/sysctl' => 1,
> > + 'fs/jfs/jfs_debug' => 1,
> > +);
> > +
> > +my %nameexception = (
> > + 'mod_use_count_' => 1,
> > + '__initramfs_end' => 1,
> > + '__initramfs_start' => 1,
> > + '_einittext' => 1,
> > + '_sinittext' => 1,
> > + 'kallsyms_names' => 1,
> > + 'kallsyms_num_syms' => 1,
> > + 'kallsyms_addresses'=> 1,
> > + '__this_module' => 1,
> > + '_etext' => 1,
> > + '_edata' => 1,
> > + '_end' => 1,
> > + '__bss_start' => 1,
> > + '_text' => 1,
> > + '_stext' => 1,
> > + '__gp' => 1,
> > + 'ia64_unw_start' => 1,
> > + 'ia64_unw_end' => 1,
> > + '__init_begin' => 1,
> > + '__init_end' => 1,
> > + '__bss_stop' => 1,
> > + '__nosave_begin' => 1,
> > + '__nosave_end' => 1,
> > + 'pg0' => 1,
> > +);
> > +
> > +
> > &find(\&linux_objects, '.'); # find the objects and do_nm on them
> > &list_multiply_defined();
> > &resolve_external_references();
> > @@ -272,27 +324,9 @@ sub do_nm
> > close($nmdata);
> >
> > if ($#nmdata < 0) {
> > - if (
> > - $fullname ne "lib/brlock.o"
> > - && $fullname ne "lib/dec_and_lock.o"
> > - && $fullname ne "fs/xfs/xfs_macros.o"
> > - && $fullname ne "drivers/ide/ide-probe-mini.o"
> > - && $fullname ne "usr/initramfs_data.o"
> > - && $fullname ne "drivers/acpi/executer/exdump.o"
> > - && $fullname ne "drivers/acpi/resources/rsdump.o"
> > - && $fullname ne "drivers/acpi/namespace/nsdumpdv.o"
> > - && $fullname ne "drivers/acpi/namespace/nsdump.o"
> > - && $fullname ne "arch/ia64/sn/kernel/sn2/io.o"
> > - && $fullname ne "arch/ia64/kernel/gate-data.o"
> > - && $fullname ne "drivers/ieee1394/oui.o"
> > - && $fullname ne "security/capability.o"
> > - && $fullname ne "sound/core/wrappers.o"
> > - && $fullname ne "fs/ntfs/sysctl.o"
> > - && $fullname ne "fs/jfs/jfs_debug.o"
> > - ) {
> > - printf "No nm data for $fullname\n";
> > - }
> > - return;
> > + printf "No nm data for $fullname\n"
> > + unless $nmexception{$fullname};
> > + return;
>
>
> This would be more readable and easier to update:
>
> my @nmexception = qw(
> fs/ext3/bitmap
> fs/ext4/bitmap
> arch/x86/lib/thunk_32
> arch/x86/lib/cmpxchg
> arch/x86/vdso/vdso32/note
> lib/irq_regs
> usr/initramfs_data
> drivers/scsi/aic94xx/aic94xx_dump
> drivers/scsi/libsas/sas_dump
> lib/dec_and_lock
> drivers/ide/ide-probe-mini
> usr/initramfs_data
> drivers/acpi/acpia/exdump
> drivers/acpi/acpia/rsdump
> drivers/acpi/acpia/nsdumpdv
> drivers/acpi/acpia/nsdump
> arch/ia64/sn/kernel/sn2/io
> arch/ia64/kernel/gate-data
> security/capability
> fs/ntfs/sysctl
> fs/jfs/jfs_debug
> );
>
> my @nameexception = qw(
> mod_use_count_
> __initramfs_end
> __initramfs_start
> _einittext
> _sinittext
> kallsyms_names
> kallsyms_num_syms
> kallsyms_addresses
> __this_module
> _etext
> _edata
> _end
> __bss_start
> _text
> _stext
> __gp
> ia64_unw_start
> ia64_unw_end
> __init_begin
> __init_end
> __bss_stop
> __nosave_begin
> __nosave_end
> pg0
> );
>
> my (%nmexception, %nameexception);
> @nmexception{@nmexception} = ();
> @nameexception{@nameexception} = ();
>
> Then later:
>
> print "No nm data for $fullname\n"
> unless exists $nmexception{$fullname};
>
> I.e. use print (not printf) and exists().
But the kernel developers are often not perl wizards
and like things written out.
Maybe use map to simplify?
my %nmexception = map { $_ => 1 } qw (
);
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-10-05 1:13 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-28 8:44 [PATCH 0/2] namespace.pl fixes Stephen Hemminger
2010-09-28 8:44 ` [PATCH 1/2] namespace.pl: fix source tree name mangling Stephen Hemminger
2010-09-29 4:31 ` Américo Wang
2010-09-29 5:11 ` Stephen Hemminger
2010-09-29 6:04 ` Américo Wang
2010-09-29 6:06 ` Stephen Hemminger
2010-09-29 7:06 ` Américo Wang
2010-09-29 7:14 ` Stephen Hemminger
2010-09-29 9:34 ` Américo Wang
2010-09-29 13:04 ` Stephen Hemminger
2010-09-28 8:44 ` [PATCH 2/2] namespace.pl : update file exclusion list Stephen Hemminger
2010-09-29 4:43 ` Américo Wang
2010-09-29 5:03 ` Stephen Hemminger
2010-10-03 3:29 ` Ævar Arnfjörð Bjarmason
2010-10-05 1:13 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox