public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: Nick Alcock <nick.alcock@oracle.com>
Cc: Kris Van Hees <kris.van.hees@oracle.com>,
	dtrace@lists.linux.dev, dtrace-devel@oss.oracle.com
Subject: Re: [PATCH 2/4] btf: use dt_btf_real_type_by_id() to resolve types
Date: Fri, 17 Apr 2026 15:00:27 -0400	[thread overview]
Message-ID: <aeKDS7IXIz963A4R@oracle.com> (raw)
In-Reply-To: <87ik9pzfe8.fsf@esperi.org.uk>

On Fri, Apr 17, 2026 at 06:05:19PM +0100, Nick Alcock wrote:
> On 14 Apr 2026, Kris Van Hees said:
> 
> > Functions that need to check type data operate on the real type rather
> > than a typedef or a type with modifiers.  Similarly, when a type of a
> > function is needed, the prototype (BTF type BTF_KIND_PROTO) is what is
> > really needed.
> >
> > Introducing dt_btf_real_type_by_id() removed duplication of code in other
> > functions.
> 
> Perhaps dt_btf_resolve_type(), for consistency with the libctf function
> naming?

Hm, no, I don't think that would be what we want here because I think they
do have slightly different semantics.

> Other than that...
> 
> > ---
> >  libdtrace/dt_btf.c | 43 +++++++++++++++++++++++++++++--------------
> >  1 file changed, 29 insertions(+), 14 deletions(-)
> >
> > diff --git a/libdtrace/dt_btf.c b/libdtrace/dt_btf.c
> > index d08599192..56eb96a4e 100644
> > --- a/libdtrace/dt_btf.c
> > +++ b/libdtrace/dt_btf.c
> > @@ -848,6 +848,26 @@ dt_btf_type_by_id(dtrace_hdl_t *dtp, const dt_btf_t *btf, int32_t id)
> >  	return btf->types[id - (dtp->dt_shared_btf->type_cnt - 1)];
> >  }
> >  
> > +static btf_type_t *
> > +dt_btf_real_type_by_id(dtrace_hdl_t *dtp, const dt_btf_t *btf, int32_t id)
> > +{
> > +	btf_type_t	*type = dt_btf_type_by_id(dtp, btf, id);
> > +
> > +	do {
> > +		switch (BTF_INFO_KIND(type->info)) {
> > +		case BTF_KIND_CONST:
> > +		case BTF_KIND_FUNC:
> > +		case BTF_KIND_TYPEDEF:
> > +		case BTF_KIND_VOLATILE:
> 
> Probably this should traverse BTF_KIND_RESTRICT as well. (The kernel
> *does* use restrict qualifiers in some places. I was surprised too.)

Ah yes, thanks.

      reply	other threads:[~2026-04-17 19:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-14  6:27 [PATCH 2/4] btf: use dt_btf_real_type_by_id() to resolve types Kris Van Hees
2026-04-17 17:05 ` Nick Alcock
2026-04-17 19:00   ` 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=aeKDS7IXIz963A4R@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=dtrace-devel@oss.oracle.com \
    --cc=dtrace@lists.linux.dev \
    --cc=nick.alcock@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox