btf_encoder: Adopt btf__encode_struct() as btf_encoder__add_struct()
As it is just prep work to call libbpf's btf__add_struct() for a struct/union/class using pahole's data structures populated from another format, normally DWARF. So that we can eventually ditch the btf_encoder__verbose and btf_gen_float globals, making them members of 'struct btf_encoder'. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
0b29d5a65c
commit
06cd9f00c6
|
@ -172,7 +172,7 @@ static int32_t btf_encoder__add_struct_type(struct btf_encoder *encoder, struct
|
|||
BTF_KIND_UNION : BTF_KIND_STRUCT;
|
||||
|
||||
name = dwarves__active_loader->strings__ptr(cu, type->namespace.name);
|
||||
type_id = btf__encode_struct(encoder->btf, kind, name, type->size);
|
||||
type_id = btf_encoder__add_struct(encoder, kind, name, type->size);
|
||||
if (type_id < 0)
|
||||
return type_id;
|
||||
|
||||
|
|
3
libbtf.c
3
libbtf.c
|
@ -390,8 +390,9 @@ int btf_encoder__add_field(struct btf_encoder *encoder, const char *name, uint32
|
|||
return err;
|
||||
}
|
||||
|
||||
int32_t btf__encode_struct(struct btf *btf, uint8_t kind, const char *name, uint32_t size)
|
||||
int32_t btf_encoder__add_struct(struct btf_encoder *encoder, uint8_t kind, const char *name, uint32_t size)
|
||||
{
|
||||
struct btf *btf = encoder->btf;
|
||||
const struct btf_type *t;
|
||||
int32_t id;
|
||||
|
||||
|
|
2
libbtf.h
2
libbtf.h
|
@ -25,7 +25,7 @@ struct ftype;
|
|||
int32_t btf_encoder__add_base_type(struct btf_encoder *encoder, const struct base_type *bt, const char *name);
|
||||
int32_t btf_encoder__add_ref_type(struct btf_encoder *encoder, uint16_t kind, uint32_t type, const char *name, bool kind_flag);
|
||||
int btf_encoder__add_field(struct btf_encoder *encoder, const char *name, uint32_t type, uint32_t bitfield_size, uint32_t bit_offset);
|
||||
int32_t btf__encode_struct(struct btf *btf, uint8_t kind, const char *name, uint32_t size);
|
||||
int32_t btf_encoder__add_struct(struct btf_encoder *encoder, uint8_t kind, const char *name, uint32_t size);
|
||||
int32_t btf__encode_array(struct btf *btf, uint32_t type, uint32_t index_type, uint32_t nelems);
|
||||
int32_t btf__encode_enum(struct btf *btf, const char *name, uint32_t size);
|
||||
int btf__encode_enum_val(struct btf *btf, const char *name, int32_t value);
|
||||
|
|
Loading…
Reference in New Issue