All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
	linux-doc@vger.kernel.org, Bagas Sanjaya <bagasdotme@gmail.com>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH] scripts/kernel-doc: support EXPORT_SYMBOL_NS_GPL() with -export
Date: Tue, 8 Nov 2022 13:24:57 -0400	[thread overview]
Message-ID: <Y2qQ6Wxyk6v9j2lT@nvidia.com> (raw)
In-Reply-To: <Y2qOOLDudCnXmz5S@casper.infradead.org>

On Tue, Nov 08, 2022 at 05:13:28PM +0000, Matthew Wilcox wrote:
> On Tue, Nov 08, 2022 at 12:21:17PM -0400, Jason Gunthorpe wrote:
> > On Tue, Nov 08, 2022 at 03:25:10PM +0000, Matthew Wilcox wrote:
> > > On Tue, Nov 08, 2022 at 11:02:35AM -0400, Jason Gunthorpe wrote:
> > > > (I don't know perl at all so happy to replace this with something more elegant)
> > > >  my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
> > > > +my $export_symbol_ns = '^\s*EXPORT_SYMBOL_NS(_GPL)?\s*\(\s*(\w+)\s*,\s*\w+\)\s*;';
> > > 
> > > How about:
> > > 
> > > -my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
> > > +my $export_symbol = '^\s*EXPORT_SYMBOL(_NS)?(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';
> > > 
> > > Not them i'm a perlite either, but this is just a regexp.
> > 
> > I started like that, but the target text looks like this:
> > 
> > EXPORT_SYMBOL_NS_GPL(iommufd_access_destroy, IOMMUFD);
> > 
> > And the (\w+) capture should only pick "iommufd_access_destroy", so
> > the ideal regex does the ",\s*\w+)" part only if _NS was matched
> > earlier.
> 
> Oh, right, I missed that part of the regex difference.  How about
> terminating the match with [,)]?  ie:
> 
> +my $export_symbol = '^\s*EXPORT_SYMBOL(_NS)?(_GPL)?\s*\(\s*(\w+[,)]\s*\)\s*;';

Ah, I came up with this ugly thing:

^\s*EXPORT_SYMBOL(_NS)?(_GPL)?\s*\(\s*(\w+?)(\s*,\s*\w+)?\s*\)\s*;

As there is still some trailing \w that the \s won't match.

Jason

  reply	other threads:[~2022-11-08 17:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 15:02 [PATCH] scripts/kernel-doc: support EXPORT_SYMBOL_NS_GPL() with -export Jason Gunthorpe
2022-11-08 15:25 ` Matthew Wilcox
2022-11-08 16:21   ` Jason Gunthorpe
2022-11-08 17:13     ` Matthew Wilcox
2022-11-08 17:24       ` Jason Gunthorpe [this message]
2022-11-09  8:24 ` Bagas Sanjaya
2022-11-09 14:28   ` Jonathan Corbet

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=Y2qQ6Wxyk6v9j2lT@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=bagasdotme@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=willy@infradead.org \
    /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.