Re: [PATCH bpf-next] samples: bpf: avoid name collision with kernel enum values

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

 



Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> writes:

> On Mon, Sep 27, 2021 at 06:07:30PM IST, Toke Høiland-Jørgensen wrote:
>> Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx> writes:
>>
>> > In xdp_redirect_map_multi.bpf.c, on newer kernels samples compilation
>> > fails when vmlinux.h is generated from a kernel supporting broadcast for
>> > devmap. Hence, avoid naming collisions to prevent build failure.
>>
>> Hmm, shouldn't the sample just be getting the value from the kernel in
>> the first place instead of re-defining it?
>>
>
> True, but in general my assumption was that it could be built with a older
> kernel's vmlinux.h, but be ran on a newer one. If that's not strictly needed, I
> can just drop it.

But the code is still making assumptions about the contents of
vmlinux.h, isn't it? Like the size (and existence) of struct
bpf_devmap_val.

> This can also be the case if you haven't built the kernel in the tree
> (just did a make headers_install), it then falls back to generating
> the vmlinux.h from the running kernel.

This seems a bit brittle. Given that the samples are distributed with
the kernel sources, I would expect them to always correspond to the
kernel version in the source tree they're in and not randomly break if
the running kernel is different...

-Toke





[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