From: Kris Van Hees <kris.van.hees@oracle.com>
To: Eugene Loh <eugene.loh@oracle.com>
Cc: dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH] bpf: be less picky about the content of bpf_helper_defs.h
Date: Mon, 6 May 2024 16:33:33 -0400 [thread overview]
Message-ID: <Zjk+ncHKBG7FyPU8@oracle.com> (raw)
In-Reply-To: <9a7c6e07-fbb3-158e-4fa4-e6ce695b316c@oracle.com>
On Mon, May 06, 2024 at 03:43:19PM -0400, Eugene Loh wrote:
> Reviewed-by: Eugene Loh <eugene.loh@oracle.com>
>
> One possibility, however, is to regularize the input line with regards to
> spaces and tabs. E.g., start with
>
> { gsub("[ \t]+", " ") }
>
> Then, subsequent string processing can forget about that \t stuff and will
> presumably be that much more simple and readable.
Yes, but means we modify every line, which we do not really need to do. I
guess it's one trade-off vs another. The gsub you mention only really helps
drop \t becauxe you still need to account for places where whitespace is
optional.
> On 5/6/24 15:05, Kris Van Hees wrote:
> > There are small differences in the format of the BPF helper definitions
> > in bpf_helper_defs.h in libbpf headers. This patch allows mkHelpers to
> > be more accepting of these differences.
> >
> > Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
> > ---
> > include/mkHelpers | 15 ++++++++-------
> > 1 file changed, 8 insertions(+), 7 deletions(-)
> >
> > diff --git a/include/mkHelpers b/include/mkHelpers
> > index 1a7537ca..dc5e62c8 100755
> > --- a/include/mkHelpers
> > +++ b/include/mkHelpers
> > @@ -8,14 +8,15 @@ BEGIN {
> > }
> > $1 == "static" && /=/ && /[ \t]+[1-9][0-9]*[ \t]*;/ {
> > - match($0, /[ \t]+[1-9][0-9]*[ \t]*;/);
> > - id = substr($0, RSTART, RLENGTH - 1);
> > - gsub(/[ \t]+/,"", id);
> > - match($0, /\([ \t]*\*[ \t]*bpf_[_A-Za-z0-9]+/);
> > - fn = substr($0, RSTART + 1, RLENGTH - 1);
> > - sub(/[ \t]*\*[ \t]*bpf_/, "", fn);
> > + if (match($0, /[ \t\*]bpf_[_A-Za-z0-9]+/) > 0) {
> > + fn = substr($0, RSTART + 5, RLENGTH - 5);
> > - print "#define BPF_FUNC_"fn " " id;
> > + match($0, /[ \t]+[1-9][0-9]*[ \t]*;/);
> > + id = substr($0, RSTART, RLENGTH - 1);
> > + gsub(/[ \t]+/,"", id);
> > +
> > + print "#define BPF_FUNC_"fn " " id;
> > + }
> > }
> > END {
prev parent reply other threads:[~2024-05-06 20:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-06 19:05 [PATCH] bpf: be less picky about the content of bpf_helper_defs.h Kris Van Hees
2024-05-06 19:10 ` Nick Alcock
2024-05-06 19:43 ` Eugene Loh
2024-05-06 20:33 ` Kris Van Hees [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=Zjk+ncHKBG7FyPU8@oracle.com \
--to=kris.van.hees@oracle.com \
--cc=dtrace-devel@oss.oracle.com \
--cc=dtrace@lists.linux.dev \
--cc=eugene.loh@oracle.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.