Re: [PATCH bpf-next v2 3/3] bpf: Use BPF_KFUNC macro at all kfunc definitions

Alexei Starovoitov
2023-01-23T18:33:13Z

On Mon, Jan 23, 2023 at 11:15:06AM -0600, David Vernet wrote:
> -void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> +BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
> {
> struct btf_struct_meta *meta = meta__ign;
> u64 size = local_type_id__k;
> @@ -1790,7 +1786,7 @@ void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
> return p;
> }
>
> -void bpf_obj_drop_impl(void *p__alloc, void *meta__ign)
> +BPF_KFUNC(void bpf_obj_drop_impl(void *p__alloc, void *meta__ign))
> {

The following also works:
-BPF_KFUNC(void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign))
+BPF_KFUNC(
+void *bpf_obj_new_impl(u64 local_type_id__k, void *meta__ign)
+)

and it looks little bit cleaner to me.

git grep -A1 BPF_KFUNC
can still find all instances of kfuncs.

wdyt?