All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Vipin Sharma <vipinsh@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Cristian Ciocaltea <cristian.ciocaltea@collabora.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts/tags.sh: allow only selected directories to be indexed
Date: Sun, 11 Dec 2022 10:32:27 +1300	[thread overview]
Message-ID: <Y5T66yWNVAZNIaJ0@mail.google.com> (raw)
In-Reply-To: <CAHVum0ed2SSbxR_ayZw0D5x3KK7wzR8jr6DOqekBHv_noapcMw@mail.gmail.com>

On Sat, Dec 10, 2022 at 12:31:41PM -0800, Vipin Sharma wrote:
> On Fri, Dec 9, 2022 at 11:18 AM Paulo Miguel Almeida
> <paulo.miguel.almeida.rodenas@gmail.com> wrote:
> >
> > It's common for drivers that share same physical components to also
> > duplicate source code (or at least portions of it). A good example is
> > both drivers/gpu/drm/amdgpu/* and drivers/gpu/drm/radeon/* have a header
> > file called atombios.h.
> >
> > While their contents aren't the same, a lot of their structs have
> > the exact same names which makes navigating through the code base a bit
> > messy as cscope will show up 'references' across drivers which aren't
> > exactly correct.
> >
> > This patch makes it possible for the devs to specify which folders
> > they want to include as part of the find_other_sources function if a
> > makefile variable OTHERSRCDIRS is present, otherwise the original
> > behaviour is kept.
> >
> > Example:
> >         make ARCH=x86 OTHERSRCDIRS=drivers/gpu/drm/radeon,tools cscope
> >
> 
> It is better to make the opposite option i.e. ignore directories. By
> default, cscope is all inclusive and it is more beneficial to have
> more code indexed than less. Default indexed
> directories will be different with and without OTHERSRCDIRS.
> 
> For example,
> 
> make ARCH=x86 cscope
> 
> # This includes all of the kernel code except non-x86 arch code.
> 
> make ARCH=x86 OTHERSRCSDIRS=drivers/gpu/drm/radeon/tools,tools cscope
> 
> # This includes only arch/x86, include/, tools/ and
> driver/gpu/drm/radeon/tools. It removes kernel/, block/, lib/,
> crypto/, virt/, etc. These are important kernel source code
> directories.
> 
> My vote is to make something like:
> make ARCH=x86 IGNOREDIRS=drivers/gpu/drm/amdgpu cscope
> 
> Parse IGNOREDIRS in the scripts/tags.sh and append to $ignore variable.
> 
> Also you should write this option in /Documentation/kbuild/kbuild.rst
> similar to ALLSOURCE_ARCHS
> 
> Thanks

Hi Vipin,

Thanks for taking the time to review this patch. I agree with you that
keeping cscope in its all inclusive approach is a better move. I will
make the requested changes and send a new patch.

Thanks!

- Paulo A.

> 
> 
> > Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
> > ---
> >  scripts/tags.sh | 13 +++++++++----
> >  1 file changed, 9 insertions(+), 4 deletions(-)
> >
> > diff --git a/scripts/tags.sh b/scripts/tags.sh
> > index e137cf15aae9..958c07c4ac4a 100755
> > --- a/scripts/tags.sh
> > +++ b/scripts/tags.sh
> > @@ -59,12 +59,17 @@ find_include_sources()
> >  }
> >
> >  # find sources in rest of tree
> > -# we could benefit from a list of dirs to search in here
> >  find_other_sources()
> >  {
> > -       find ${tree}* $ignore \
> > -            \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) -prune -o \
> > -              -name "$1" -not -type l -print;
> > +       find_def_params="-name $1 -not -type l -print"
> > +       if [ -n "${OTHERSRCDIRS}" ]; then
> > +               exp_src_dirs=$(sed 's/,/ /g' <<< ${OTHERSRCDIRS})
> > +               find ${exp_src_dirs} ${ignore} ${find_def_params};
> > +       else
> > +               find ${tree}* ${ignore} \
> > +                    \( -path ${tree}include -o -path ${tree}arch -o -name '.tmp_*' \) \
> > +                    -prune -o ${find_def_params};
> > +       fi
> >  }
> >
> >  find_sources()
> > --
> > 2.38.1
> >

  reply	other threads:[~2022-12-10 21:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-09 19:18 [PATCH] scripts/tags.sh: allow only selected directories to be indexed Paulo Miguel Almeida
2022-12-10 20:31 ` Vipin Sharma
2022-12-10 21:32   ` Paulo Miguel Almeida [this message]
2022-12-10 23:02     ` [PATCH v2] scripts/tags.sh: choose which directories to exclude from being indexed Paulo Miguel Almeida
2022-12-11  4:21       ` Bagas Sanjaya
2022-12-11 20:27         ` Paulo Miguel Almeida
2022-12-12 21:27       ` Vipin Sharma
2022-12-12 21:59         ` Paulo Miguel Almeida
2022-12-12 22:32           ` Vipin Sharma
2022-12-13  2:03             ` Paulo Miguel Almeida
2022-12-13 20:26               ` [PATCH v3] " Paulo Miguel Almeida
2022-12-14 17:40                 ` Vipin Sharma

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=Y5T66yWNVAZNIaJ0@mail.google.com \
    --to=paulo.miguel.almeida.rodenas@gmail.com \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vipinsh@google.com \
    /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.