btf_encoder: Move add_array() from btf_elf to btf encode_array()

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 a96c91261e
commit 1216aebd27
3 changed files with 3 additions and 5 deletions

View File

@ -259,7 +259,7 @@ static int tag__encode_btf(struct cu *cu, struct tag *tag, uint32_t core_id, str
case DW_TAG_array_type:
/* TODO: Encode one dimension at a time. */
need_index_type = true;
return btf_elf__add_array(btfe, ref_type_id, array_index_id, array_type__nelems(tag));
return btf__encode_array(btfe->btf, ref_type_id, array_index_id, array_type__nelems(tag));
case DW_TAG_enumeration_type:
return enumeration_type__encode(btfe, cu, tag);
case DW_TAG_subroutine_type:

View File

@ -453,9 +453,8 @@ int32_t btf__encode_ref_type(struct btf *btf, uint16_t kind, uint32_t type,
return id;
}
int32_t btf_elf__add_array(struct btf_elf *btfe, uint32_t type, uint32_t index_type, uint32_t nelems)
int32_t btf__encode_array(struct btf *btf, uint32_t type, uint32_t index_type, uint32_t nelems)
{
struct btf *btf = btfe->btf;
const struct btf_type *t;
const struct btf_array *array;
int32_t id;

View File

@ -44,8 +44,7 @@ int32_t btf__encode_base_type(struct btf *btf, const struct base_type *bt, const
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_elf__add_array(struct btf_elf *btf, uint32_t type, uint32_t index_type,
uint32_t nelems);
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);
int32_t btf_elf__add_func_proto(struct btf_elf *btf, struct cu *cu, struct ftype *ftype,