On 17/10/18 18:50, Martin Lau wrote: > On Wed, Oct 17, 2018 at 10:25:21AM -0700, Yonghong Song wrote: >> What you stated is true, BTF_KIND_FUNC_PROTO corresponds to >> dwarf subroutine tag which has no name while BTF_KIND_FUNC >> must have a valid name. The original design is to have both >> since they are corresponding to different dwarf constructs. >> >> Martin, what do you think? > I prefer to have separate kinds. We need a way to distinguish them. > For example, the BTF verifier is checking it. Having two kinds is > cleaner instead of resorting to other hints from 'struct btf_type'. > We don't lack of bits for kind. But my point is that (a) they can be distinguished by how they are used, and (b) the _only_ difference between them is how they are used. In this C code: int a = 5; int foo(int x) { return a; } int *b = &a; int (*bar)(int) = &foo; foo and *bar are _the same type_, just as a and *b are. It's just that C has a slightly odd way of writing int foo(int) = lambda x: a; and foo itself is implicitly sorta-const. What am I missing?
-Ed