All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Marek <mmarek@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] namespace.pl : update file exclusion list
Date: Tue, 5 Oct 2010 10:13:04 +0900	[thread overview]
Message-ID: <20101005101304.1aedcec8@s6510> (raw)
In-Reply-To: <AANLkTimtuXbNpXezj8C46KcxRJMYAgRAd2UuqrF2Op_7@mail.gmail.com>

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 (
);


      reply	other threads:[~2010-10-05  1:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101005101304.1aedcec8@s6510 \
    --to=shemminger@vyatta.com \
    --cc=akpm@linux-foundation.org \
    --cc=avarab@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.