btf_encoder: Adopt btf__encode_var_secinfo() as btf_encoder__add_var_secinfo()

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:
Arnaldo Carvalho de Melo 2021-06-09 09:31:26 -03:00
parent cc646d93d1
commit f0e8cd68f5
3 changed files with 4 additions and 5 deletions

View File

@ -855,7 +855,7 @@ int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu, bool skip
* add a BTF_VAR_SECINFO in encoder->percpu_secinfo, which will be added into
* encoder->types later when we add BTF_VAR_DATASEC.
*/
id = btf__encode_var_secinfo(&encoder->percpu_secinfo, id, addr, size);
id = btf_encoder__add_var_secinfo(&encoder->percpu_secinfo, id, addr, size);
if (id < 0) {
err = -1;
fprintf(stderr, "error: failed to encode section info for variable '%s' at addr 0x%" PRIx64 "\n",

View File

@ -529,8 +529,8 @@ int32_t btf_encoder__add_var(struct btf_encoder *encoder, uint32_t type, const c
return id;
}
int32_t btf__encode_var_secinfo(struct gobuffer *buf, uint32_t type,
uint32_t offset, uint32_t size)
int32_t btf_encoder__add_var_secinfo(struct gobuffer *buf, uint32_t type,
uint32_t offset, uint32_t size)
{
struct btf_var_secinfo si = {
.type = type,

View File

@ -7,7 +7,6 @@
#ifndef _LIBBTF_H
#define _LIBBTF_H
struct btf;
struct gobuffer;
#include <stdbool.h>
@ -31,7 +30,7 @@ int32_t btf_encoder__add_enum(struct btf_encoder *encoder, const char *name, uin
int btf_encoder__add_enum_val(struct btf_encoder *encoder, 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_encoder__add_var(struct btf_encoder *encoder, uint32_t type, const char *name, uint32_t linkage);
int32_t btf__encode_var_secinfo(struct gobuffer *buf, uint32_t type, uint32_t offset, uint32_t size);
int32_t btf_encoder__add_var_secinfo(struct gobuffer *buf, uint32_t type, uint32_t offset, uint32_t size);
int32_t btf_encoder__add_datasec(struct btf_encoder *encoder, const char *section_name, struct gobuffer *var_secinfo_buf);
#endif /* _LIBBTF_H */