mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: David Laight <David.Laight@ACULAB.COM>,
	Matthew Maurer <mmaurer@google.com>,
	Miguel Ojeda <ojeda@kernel.org>,
	Alex Gaynor <alex.gaynor@gmail.com>,
	Wedson Almeida Filho <wedsonaf@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"rust-for-linux@vger.kernel.org" <rust-for-linux@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rust: Use awk instead of recent xargs
Date: Fri, 29 Sep 2023 16:29:17 -0700	[thread overview]
Message-ID: <02ce99b98cd21c67f30d5be1e5fd4fd130e0413d.camel@perches.com> (raw)
In-Reply-To: <be10d55a785d4d9b983b2dae6ed65942@AcuMS.aculab.com>

On Fri, 2023-09-29 at 21:36 +0000, David Laight wrote:
> From: Joe Perches
> > Sent: 28 September 2023 21:33
> > 
> > On Thu, 2023-09-28 at 20:21 +0000, Matthew Maurer wrote:
> > > `awk` is already required by the kernel build, and the `xargs` feature
> > > used in current Rust detection is not present in all `xargs` (notably,
> > > toybox based xargs, used in the Android kernel build).
> > []
> > > diff --git a/rust/Makefile b/rust/Makefile
> > []
> > > @@ -365,8 +365,7 @@ quiet_cmd_exports = EXPORTS $@
> > >        cmd_exports = \
> > >  	$(NM) -p --defined-only $< \
> > >  		| grep -E ' (T|R|D) ' | cut -d ' ' -f 3 \
> > > -		| xargs -Isymbol \
> > > -		echo 'EXPORT_SYMBOL_RUST_GPL(symbol);' > $@
> > > +		| awk 'NF {printf "EXPORT_SYMBOL_RUST_GPL(%s);\n",$$0}' > $@
> > 
> > Perhaps remove the cut as well and use $$3 instead of $$0 ?
> > Maybe integrate the grep as well.
> 
> Or keep the grep and use a shell loop?
> 	grep -E ' (T|R|D) ' | while read val flag symbol; do \
> 		echo "EXPORT_SYMBOL_RUST_GPL($symbol);"; done
> 
> (The grep is typically much faster than a shell conditional.)
> 

Bikeshed:

no grep just a single awk with whatever the appropriate syntax is like

awk '{ if ($$2 ~ /^[TRD]$/) { printf "EXPORT_SYMBOL_RUST(%s);\n", $$3 } }'


      reply	other threads:[~2023-09-29 23:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-28 20:21 Matthew Maurer
2023-09-28 20:32 ` Joe Perches
2023-09-29 21:36   ` David Laight
2023-09-29 23:29     ` Joe Perches [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=02ce99b98cd21c67f30d5be1e5fd4fd130e0413d.camel@perches.com \
    --to=joe@perches.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmaurer@google.com \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®