Re: [PATCH v5 bpf-next 5/9] libbpf: make btf_parse_elf process .BTF.base transparently

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2024-05-31 at 11:57 -0700, Andrii Nakryiko wrote:

[...]

> > @@ -1084,53 +1089,38 @@ struct btf *btf__new_split(const void *data, __u32 size, struct btf *base_btf)
> >         return libbpf_ptr(btf_new(data, size, base_btf));
> >  }
> > 
> > -static struct btf *btf_parse_elf(const char *path, struct btf *base_btf,
> > -                                struct btf_ext **btf_ext)
> > +struct elf_sections_info {
> > +       Elf_Data *btf_data;
> > +       Elf_Data *btf_ext_data;
> > +       Elf_Data *btf_base_data;
> 
> bikeshedding time: elf_sections_info -> btf_elf_data (or
> btf_elf_secs), btf_data -> btf, btf_ext_data -> btf_ext, btf_base_data
> -> btf_base ?

As you and Alan see fit.

[...]

> > -       btf = btf_new(btf_data->d_buf, btf_data->d_size, base_btf);
> > +
> > +       if (info.btf_base_data) {
> > +               distilled_base_btf = btf_new(info.btf_base_data->d_buf, info.btf_base_data->d_size,
> > +                                            NULL);
> 
> with the above bikeshedding suggestion, and distilled_base_btf ->
> dist_base_btf, let's get it to be a less verbose single-line statement
> 
> > +               err = libbpf_get_error(distilled_base_btf);
> 
> boo to using libbpf_get_error() in new code. btf_new() is internal, so
> IS_ERR()/PTR_ERR(), please

Noted.

[...]

> > +       if (distilled_base_btf)
> > +               btf->owns_base = true;
> 
> should we reset this to false when changing base in btf__relocate()?

It should, good catch!

[...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux