btf_encoder: Set btf_encoder__verbose in just one place, its users

E.g.: pahole.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Arnaldo Carvalho de Melo 2021-06-08 15:32:55 -03:00
parent e1e787af44
commit 3be437c5e7
3 changed files with 6 additions and 5 deletions

View File

@ -671,7 +671,7 @@ void btf_encoder__delete(struct btf_encoder *encoder)
free(encoder);
}
int cu__encode_btf(struct cu *cu, int verbose, bool skip_encoding_vars)
int cu__encode_btf(struct cu *cu, bool skip_encoding_vars)
{
uint32_t type_id_off;
uint32_t core_id;
@ -680,8 +680,6 @@ int cu__encode_btf(struct cu *cu, int verbose, bool skip_encoding_vars)
struct tag *pos;
int err = 0;
btf_encoder__verbose = verbose;
type_id_off = btf__get_nr_types(encoder->btfe->btf);
if (!encoder->has_index_type) {

View File

@ -60,6 +60,6 @@ void btf_encoder__delete(struct btf_encoder *encoder);
int btf_encoder__encode(struct btf_encoder *encoder, const char *detached_filename);
int cu__encode_btf(struct cu *cu, int verbose, bool skip_encoding_vars);
int cu__encode_btf(struct cu *cu, bool skip_encoding_vars);
#endif /* _BTF_ENCODER_H_ */

View File

@ -2478,7 +2478,7 @@ static enum load_steal_kind pahole_stealer(struct cu *cu,
return LSK__STOP_LOADING;
}
if (cu__encode_btf(cu, global_verbose, skip_encoding_btf_vars)) {
if (cu__encode_btf(cu, skip_encoding_btf_vars)) {
fprintf(stderr, "Encountered error while encoding BTF.\n");
exit(1);
}
@ -2801,6 +2801,9 @@ int main(int argc, char *argv[])
}
}
if (btf_encode)
btf_encoder__verbose = global_verbose;
struct cus *cus = cus__new();
if (cus == NULL) {
fputs("pahole: insufficient memory\n", stderr);