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

Reply via email to