[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8a025d6e-64af-1d37-6cc2-692e9ce3f760@solarflare.com>
Date: Thu, 8 Nov 2018 20:52:45 +0000
From: Edward Cree <ecree@...arflare.com>
To: Yonghong Song <yhs@...com>, <ast@...com>, <daniel@...earbox.net>,
<netdev@...r.kernel.org>
CC: <kernel-team@...com>, Martin KaFai Lau <kafai@...com>
Subject: Re: [PATCH bpf-next v4 02/13] bpf: btf: Add BTF_KIND_FUNC
On 08/11/18 20:36, Yonghong Song wrote:
> This patch adds BTF_KIND_FUNC support to the type section.
> BTF_KIND_FUNC is used to specify the signature of a
> defined subprogram or the pointee of a function pointer.
>
> In BTF, the function type related data structures are
> struct bpf_param {
> __u32 name_off; /* parameter name */
> __u32 type; /* parameter type */
> };
> struct bpf_type {
> __u32 name_off; /* function name */
> __u32 info; /* BTF_KIND_FUNC and num of parameters (#vlen) */
> __u32 type; /* return type */
> }
> The data layout of the function type:
> struct bpf_type
> #vlen number of bpf_param's
>
> For a defined subprogram with valid function body,
> . function name and all parameter names except the vararg
> must be valid C identifier.
Given that there's an intention to support other frontends besides
C, what's the reason for this restriction?
> For the pointee of a function pointer,
> . function name and all parameter names will
> have name_off = 0 to indicate a non-existing name.
Why can't function pointer parameters have names?
E.g. imagine something like struct net_device_ops. All those
function pointers have named parameters and that's relevant info
when debugging.
-Ed
Powered by blists - more mailing lists