btf_encoder: Move add_struct() from btf_elf to btf encode_struct()

As it is all that it needs, rename from the __add_ pattern to __encode
to avoid a clash with libbpf btf__add_array() API.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-02 17:28:01 -03:00
parent 1216aebd27
commit f82bd80a5c
3 changed files with 3 additions and 4 deletions

View File

@ -173,7 +173,7 @@ static int32_t structure_type__encode(struct btf_elf *btfe, struct cu *cu, struc
BTF_KIND_UNION : BTF_KIND_STRUCT;
name = dwarves__active_loader->strings__ptr(cu, type->namespace.name);
type_id = btf_elf__add_struct(btfe, kind, name, type->size);
type_id = btf__encode_struct(btfe->btf, kind, name, type->size);
if (type_id < 0)
return type_id;

View File

@ -494,9 +494,8 @@ int btf__encode_member(struct btf *btf, const char *name, uint32_t type, uint32_
return err;
}
int32_t btf_elf__add_struct(struct btf_elf *btfe, uint8_t kind, const char *name, uint32_t size)
int32_t btf__encode_struct(struct btf *btf, uint8_t kind, const char *name, uint32_t size)
{
struct btf *btf = btfe->btf;
const struct btf_type *t;
int32_t id;

View File

@ -43,7 +43,7 @@ void btf_elf__delete(struct btf_elf *btf);
int32_t btf__encode_base_type(struct btf *btf, const struct base_type *bt, const char *name);
int32_t btf__encode_ref_type(struct btf *btf, uint16_t kind, uint32_t type, const char *name, bool kind_flag);
int btf__encode_member(struct btf *btf, const char *name, uint32_t type, uint32_t bitfield_size, uint32_t bit_offset);
int32_t btf_elf__add_struct(struct btf_elf *btf, uint8_t kind, const char *name, uint32_t size);
int32_t btf__encode_struct(struct btf *btf, 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_elf__add_enum(struct btf_elf *btf, const char *name, uint32_t size);
int btf_elf__add_enum_val(struct btf_elf *btf, const char *name, int32_t value);