BPF List
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>, bpf@vger.kernel.org
Cc: Yonghong Song <yhs@meta.com>,
	david.faust@oracle.com,  cupertino.miranda@oracle.com,
	Andrii Nakryiko <andriin@fb.com>
Subject: Re: Anonymous struct types in parameter lists in BPF selftests
Date: Thu, 25 Jan 2024 16:08:34 +0200	[thread overview]
Message-ID: <c01d6d3faf499716eeee049a32b2eca4afdc23b3.camel@gmail.com> (raw)
In-Reply-To: <875xzhzm2o.fsf@oracle.com>

On Thu, 2024-01-25 at 12:31 +0100, Jose E. Marchesi wrote:
[...]
> However, btf_dump_test_case_syntax.c explicitly tests the dumping of a C
> function like the above:
> 
>  * - `fn_ptr2_t`: function, taking anonymous struct as a first arg and pointer
>  *   to a function, that takes int and returns int, as a second arg; returning
>  *   a pointer to a const pointer to a char. Equivalent to:
>  *	typedef struct { int a; } s_t;
>  *	typedef int (*fn_t)(int);
>  *	typedef char * const * (*fn_ptr2_t)(s_t, fn_t);
> 
> the function being:
> 
>   typedef char * const * (*fn_ptr2_t)(struct {
>   	int a;
>   }, int (*)(int));
> 
> which is not really equivalent to the above because one is an anonymous
> struct type, the other is named, and also the scope issue described
> above.
> 
> That makes me wonder, since this is testing the C generation from BTF,
> what motivated this particular test?  Is there some particular code in
> the kernel (or anywhere else) that uses anonymous struct types defined
> in parameter lists?  If so, how are these functions used?

fwiw, I can't find any FUNC_PROTO in test kernel BTF that have
anonymous struct or pointer to anonymous struct as their parameter.

  reply	other threads:[~2024-01-25 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 11:31 Anonymous struct types in parameter lists in BPF selftests Jose E. Marchesi
2024-01-25 14:08 ` Eduard Zingerman [this message]
2024-01-25 21:56 ` Andrii Nakryiko
2024-01-26  9:56   ` Jose E. Marchesi

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=c01d6d3faf499716eeee049a32b2eca4afdc23b3.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andriin@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=david.faust@oracle.com \
    --cc=jose.marchesi@oracle.com \
    --cc=yhs@meta.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