* libbpf - why find_program_by_title ?
@ 2021-10-28 12:02 Jesper Dangaard Brouer
2021-10-28 16:56 ` Andrii Nakryiko
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Dangaard Brouer @ 2021-10-28 12:02 UTC (permalink / raw)
To: Andrii Nakryiko; +Cc: brouer, bpf, Toke Hoiland Jorgensen
Hi Andrii,
The libbpf API bpf_program__title() is getting depricated (which is
great BTW). (p.s. Instead use bpf_program__section_name()).
Why do we still have bpf_object__find_program_by_title() ?
Shouldn't we also deprecate that?
And introduce bpf_object__find_program_by_section_name().
--Jesper
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: libbpf - why find_program_by_title ?
2021-10-28 12:02 libbpf - why find_program_by_title ? Jesper Dangaard Brouer
@ 2021-10-28 16:56 ` Andrii Nakryiko
0 siblings, 0 replies; 2+ messages in thread
From: Andrii Nakryiko @ 2021-10-28 16:56 UTC (permalink / raw)
To: Jesper Dangaard Brouer
Cc: Andrii Nakryiko, Jesper Dangaard Brouer, bpf, Toke Hoiland Jorgensen
On Thu, Oct 28, 2021 at 5:02 AM Jesper Dangaard Brouer
<jbrouer@redhat.com> wrote:
>
> Hi Andrii,
>
> The libbpf API bpf_program__title() is getting depricated (which is
> great BTW). (p.s. Instead use bpf_program__section_name()).
>
> Why do we still have bpf_object__find_program_by_title() ?
>
> Shouldn't we also deprecate that?
Yes, we should and we plan, see [0]. The only reason why it's not yet
marked as deprecated is because there are still a lot of uses of
find_program_by_title in selftests and we need to clean that up first.
It would be great to get help with that, of course.
[0] https://github.com/libbpf/libbpf/issues/292
> And introduce bpf_object__find_program_by_section_name().
I didn't plan to because there is (in general) more than one program
for the same section name (section names are not unique identifiers
for a while now), so which program this API would return: first, last,
random? It's just wrong API with wrong assumptions.
The right way to go about this is to do a loop over all programs with
bpf_object__for_each_program(prog, obj) and compare
bpf_program__section_name() explicitly. And then do whatever your
application needs to do with every instance of the program with
matching section name.
>
> --Jesper
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-28 16:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 12:02 libbpf - why find_program_by_title ? Jesper Dangaard Brouer
2021-10-28 16:56 ` Andrii Nakryiko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).