On 08/23, Toke H�iland-J�rgensen wrote:
YiFei Zhu <zhuyifei@xxxxxxxxxx> writes:
> On Fri, Aug 21, 2020 at 3:58 AM Toke H�iland-J�rgensen
<toke@xxxxxxxxxx> wrote:
>> Yonghong Song <yhs@xxxxxx> writes:
>> > Not sure whether we need formal libbpf API to access metadata or not.
>> > This may help other applications too. But we can delay until it is
>> > necessary.
>>
>> Yeah, please put in a libbpf accessor as well; I would like to use this
>> from libxdp - without a skeleton :)
>>
>> -Toke
>
> I don't think I have an idea on a good API in libbpf that could be
> used to get the metadata of an existing program in kernel, that could
> be reused by bpftool without duplicating all the code. Maybe we can
> discuss this in a follow up series?
I think the most important part is getting a reference to the metadata
map. So a function that basically does what the top half of what your
show_prog_metadata() function does: given a prog fd, walk the map ids,
check if any of them looks like a metadata map, and if so return the map
fd.
Should be pretty straight-forward to reuse between bpftool/libbpf, no?
Sounds good, I'll be taking over this patch series as YiFei's internship
has ended. I'll try to address that.