[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e7900b65-0d2d-48ef-b8fd-cea42ea99810@linux.dev>
Date: Sun, 4 Feb 2024 16:32:42 -0800
From: Yonghong Song <yonghong.song@...ux.dev>
To: Daniel Xu <dxu@...uu.xyz>, andrii@...nel.org, daniel@...earbox.net,
ast@...nel.org, olsajiri@...il.com, quentin@...valent.com,
alan.maguire@...cle.com
Cc: martin.lau@...ux.dev, eddyz87@...il.com, song@...nel.org,
john.fastabend@...il.com, kpsingh@...nel.org, sdf@...gle.com,
haoluo@...gle.com, jolsa@...nel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH bpf-next v2 1/2] bpf: Have bpf_rdonly_cast() take a const
pointer
On 2/4/24 1:06 PM, Daniel Xu wrote:
> Since 20d59ee55172 ("libbpf: add bpf_core_cast() macro"), libbpf is now
> exporting a const arg version of bpf_rdonly_cast(). This causes the
> following conflicting type error when generating kfunc prototypes from
> BTF:
>
> In file included from skeleton/pid_iter.bpf.c:5:
> /home/dxu/dev/linux/tools/bpf/bpftool/bootstrap/libbpf/include/bpf/bpf_core_read.h:297:14: error: conflicting types for 'bpf_rdonly_cast'
> extern void *bpf_rdonly_cast(const void *obj__ign, __u32 btf_id__k) __ksym __weak;
> ^
> ./vmlinux.h:135625:14: note: previous declaration is here
> extern void *bpf_rdonly_cast(void *obj__ign, u32 btf_id__k) __weak __ksym;
>
> This is b/c the kernel defines bpf_rdonly_cast() with non-const arg.
> Since const arg is more permissive and thus backwards compatible, we
> change the kernel definition as well to avoid conflicting type errors.
>
> Signed-off-by: Daniel Xu <dxu@...uu.xyz>
Acked-by: Yonghong Song <yonghong.song@...ux.dev>
Powered by blists - more mailing lists