Re: Anonymous struct types in parameter lists in BPF selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux