namespace.pl fixes
cover namespace.pl fixes
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.
PATCH 1/2 namespace.pl: fix source tree name mangling
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.
scripts/namespace.pl +4 -2
@@ -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";
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 9 lines · Stephen Hemminger
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 <[email protected]>
scripts/namespace.pl sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl +3
-2@@ -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.
scripts/namespace.pl sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl +1
-0+ 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.
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 30 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 9 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl +3
-2@@ -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.
scripts/namespace.pl sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl +1
-0+ 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.
Quoted 2 lines
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 conglomerateQuoted 1 line
Quoted 1 line
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'
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 53 lines · Stephen Hemminger
Quoted 30 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 9 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl +3
-2@@ -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.
scripts/namespace.pl sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl +1
-0+ 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.
Quoted 2 lines
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 forarch/x86/boot/bioscall.oNo source file found forarch/x86/boot/cmdline.o
No source file found forarch/x86/boot/copy.o
No source file found forarch/x86/boot/cpucheck.oNo source file found forarch/x86/boot/early_serial_console.oNo source file found forarch/x86/boot/edd.o
No source file found forarch/x86/boot/main.o
No source file found forarch/x86/boot/mca.o
No source file found forarch/x86/boot/memory.o
No source file found forarch/x86/boot/pm.o
No source file found forarch/x86/boot/pmjump.o
No source file found forarch/x86/boot/printf.o
Quoted 5 lines
...
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.
scripts/namespace.pl +4 -4
@@ -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
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 56 lines · On Wed, 29 Sep 2010 14:04:27 +0800 Américo Wang <[email protected]>…
Quoted 55 lines · Stephen Hemminger
Quoted 30 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 9 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl +3
-2@@ -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.
scripts/namespace.pl sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl +1
-0+ 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.
Quoted 2 lines
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 forarch/x86/boot/bioscall.oNo source file found forarch/x86/boot/cmdline.o
No source file found forarch/x86/boot/copy.o
No source file found forarch/x86/boot/cpucheck.oNo source file found forarch/x86/boot/early_serial_console.oNo source file found forarch/x86/boot/edd.o
No source file found forarch/x86/boot/main.o
No source file found forarch/x86/boot/mca.o
No source file found forarch/x86/boot/memory.o
No source file found forarch/x86/boot/pm.o
No source file found forarch/x86/boot/pmjump.o
No source file found forarch/x86/boot/printf.o...
Quoted 7 lines
Quoted 3 lines
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
...
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 37 lines · Stephen Hemminger
Quoted 34 lines · On Wed, 29 Sep 2010 14:04:27 +0800 Américo Wang <[email protected]>…
Quoted 33 lines · Stephen Hemminger
Quoted 30 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 9 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl +3
-2@@ -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.
scripts/namespace.pl sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl +1
-0+ 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.
...
Quoted 8 lines
Quoted 4 lines
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.
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
----- Original Message -----
Quoted 46 lines · Stephen Hemminger
Quoted 39 lines
Quoted 36 lines · On Wed, 29 Sep 2010 14:04:27 +0800 Américo Wang <[email protected]>…
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 10 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +3
-2@@ -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.
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +1
-0+ 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.
...
Quoted 5 lines
Quoted 4 lines
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?
Quoted 6 lines
Quoted 3 lines
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.
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 53 lines · Stephen Hemminger
----- Original Message -----
Quoted 50 lines · Stephen Hemminger
Quoted 39 lines
Quoted 36 lines · On Wed, 29 Sep 2010 14:04:27 +0800 Américo Wang <[email protected]>…
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 10 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +3
-2@@ -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.
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +1
-0+ 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.
...
Quoted 8 lines
Quoted 4 lines
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.
Quoted 6 lines
Quoted 2 lines
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.
Re: [PATCH 1/2] namespace.pl: fix source tree name mangling
Quoted 61 lines · On Wed, 29 Sep 2010 17:34:11 +0800 Américo Wang <[email protected]>…
Quoted 53 lines · Stephen Hemminger
----- Original Message -----
Quoted 50 lines · Stephen Hemminger
Quoted 39 lines
Quoted 36 lines · On Wed, 29 Sep 2010 14:04:27 +0800 Américo Wang <[email protected]>…
Quoted 35 lines · Stephen Hemminger
Quoted 32 lines · On Wed, 29 Sep 2010 12:31:12 +0800 Américo Wang <[email protected]>…
Quoted 10 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 172
Quoted 8 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +3
-2@@ -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.
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 sub do_nm · line 176
Quoted 5 lines
scripts/namespace.pl 2010-09-28 09:24:36.891552993 +0900 renamed from scripts/namespace.pl 2010-09-27 17:53:29.919433444 +0900 +1
-0+ 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.
...
Quoted 8 lines
Quoted 4 lines
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.
Quoted 6 lines
Quoted 2 lines
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.
Quoted 7 lines
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.
PATCH 2/2 namespace.pl : update file exclusion list
In reply to Stephen HemmingerThe 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.
scripts/namespace.pl +56 -47
@@ -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/
Re: [PATCH 2/2] namespace.pl : update file exclusion list
Quoted 132 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl +0
-0@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear inmy %ref = (); # $ref{$name} exists if there is a true external reference to $name
my %export = (); # $export{$name} exists if there is anEXPORT_... of $namescripts/namespace.pl +52
-0+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_nmon them&list_multiply_defined();&resolve_external_references();scripts/namespace.pl +4
-46@@ -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_/
scripts/namespace.pl sub resolve_external_references · line 412
Quoted 4 lines
scripts/namespace.pl +0
-1@@ -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.
Re: [PATCH 2/2] namespace.pl : update file exclusion list
Quoted 133 lines · On Wed, 29 Sep 2010 12:43:22 +0800 Américo Wang <[email protected]>…
Quoted 132 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl +0
-0@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear inmy %ref = (); # $ref{$name} exists if there is a true external reference to $name
my %export = (); # $export{$name} exists if there is anEXPORT_... of $namescripts/namespace.pl +52
-0+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_nmon them&list_multiply_defined();&resolve_external_references();scripts/namespace.pl +4
-46@@ -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
Quoted 8 lines
scripts/namespace.pl sub resolve_external_references · line 412
Quoted 4 lines
scripts/namespace.pl +0
-1&& $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.
Re: [PATCH 2/2] namespace.pl : update file exclusion list
In reply to Stephen HemmingerQuoted 85 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +0
-0@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear inmy %ref = (); # $ref{$name} exists if there is a true external reference to $name my %export = (); # $export{$name} exists if there is an
EXPORT_... of $namescripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +52
-0+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_nmon them&list_multiply_defined();&resolve_external_references();scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +0
-14@@ -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"
scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 sub do_nm · line 329
Quoted 10 lines
scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +3
-7- && $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�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Re: [PATCH 2/2] namespace.pl : update file exclusion list
Quoted 155 lines · On Sun, 3 Oct 2010 03:29:43 +0000 Ævar Arnfjörð Bjarmason <[email protected]>…
Quoted 85 lines · Stephen Hemminger
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 <[email protected]>scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +0
-0@@ -84,6 +84,58 @@ my %ksymtab = (); # names that appear inmy %ref = (); # $ref{$name} exists if there is a true external reference to $name my %export = (); # $export{$name} exists if there is an
EXPORT_... of $namescripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +52
-0+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_nmon them&list_multiply_defined();&resolve_external_references();scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +0
-14@@ -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"scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 sub do_nm · line 329
Quoted 10 lines
scripts/namespace.pl 2010-09-28 15:13:38.092073114 +0900 renamed from scripts/namespace.pl 2010-09-28 09:28:52.251563058 +0900 +3
-7- && $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} = ();
Quoted 6 lines
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 (
);