btf_encoder: Adopt btf__encode_enum() as btf_encoder__add_enum()
As it is just prep work to call libbpf's btf__add_enum for an enumeration 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
b536947512
commit
4371b3cd5b
|
@ -210,7 +210,7 @@ static int32_t btf_encoder__add_enum_type(struct btf_encoder *encoder, struct cu
|
|||
int32_t type_id;
|
||||
|
||||
name = dwarves__active_loader->strings__ptr(cu, etype->namespace.name);
|
||||
type_id = btf__encode_enum(encoder->btf, name, etype->size);
|
||||
type_id = btf_encoder__add_enum(encoder, name, etype->size);
|
||||
if (type_id < 0)
|
||||
return type_id;
|
||||
|
||||
|
|
3
libbtf.c
3
libbtf.c
|
@ -419,8 +419,9 @@ int32_t btf_encoder__add_struct(struct btf_encoder *encoder, uint8_t kind, const
|
|||
return id;
|
||||
}
|
||||
|
||||
int32_t btf__encode_enum(struct btf *btf, const char *name, uint32_t bit_size)
|
||||
int32_t btf_encoder__add_enum(struct btf_encoder *encoder, const char *name, uint32_t bit_size)
|
||||
{
|
||||
struct btf *btf = encoder->btf;
|
||||
const struct btf_type *t;
|
||||
int32_t id, size;
|
||||
|
||||
|
|
2
libbtf.h
2
libbtf.h
|
@ -27,7 +27,7 @@ int32_t btf_encoder__add_ref_type(struct btf_encoder *encoder, uint16_t kind, ui
|
|||
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_encoder__add_struct(struct btf_encoder *encoder, uint8_t kind, const char *name, uint32_t size);
|
||||
int32_t btf_encoder__add_array(struct btf_encoder *encoder, uint32_t type, uint32_t index_type, uint32_t nelems);
|
||||
int32_t btf__encode_enum(struct btf *btf, const char *name, uint32_t size);
|
||||
int32_t btf_encoder__add_enum(struct btf_encoder *encoder, const char *name, uint32_t size);
|
||||
int btf__encode_enum_val(struct btf *btf, const char *name, int32_t value);
|
||||
int32_t btf_encoder__add_func_proto(struct btf_encoder *encoder, struct cu *cu, struct ftype *ftype, uint32_t type_id_off);
|
||||
int32_t btf__encode_var_type(struct btf *btf, uint32_t type, const char *name, uint32_t linkage);
|
||||
|
|
Loading…
Reference in New Issue