Thread (20 messages) 20 messages, 5 authors, 2020-09-25

Re: [PATCH bpf-next 7/9] libbpf: add BTF writing APIs

From: Alexei Starovoitov <hidden>
Date: 2020-09-25 03:55:46
Also in: bpf

On Wed, Sep 23, 2020 at 08:54:34AM -0700, Andrii Nakryiko wrote:
Add APIs for appending new BTF types at the end of BTF object.

Each BTF kind has either one API of the form btf__append_<kind>(). For types
that have variable amount of additional items (struct/union, enum, func_proto,
datasec), additional API is provided to emit each such item. E.g., for
emitting a struct, one would use the following sequence of API calls:

btf__append_struct(...);
btf__append_field(...);
...
btf__append_field(...);
I've just started looking through the diffs. The first thing that struck me
is the name :) Why 'append' instead of 'add' ? The latter is shorter.

Also how would you add anon struct that is within another struct ?
The anon one would have to be added first and then added as a field?
Feels a bit odd that struct/union building doesn't have 'finish' method,
but I guess it can work.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help