public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [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