Re: [PATCH v2 bpf-next 2/3] bpf: Move a few bpf_func_proto declarations.

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

 



On Tue, Jul 2, 2024 at 7:25 AM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
>
> sparse complains about missing declarations and a few of them are in
> another .c file. One has no other declaration because it is used localy
> and marked weak because it might be defined in another .c file.
>
> Move the declarations from bpf_trace.c to a common place and add one for
> bpf_sk_storage_get_cg_sock_proto.
>
> After this change there are only a few missing declartions within the
> __bpf_kfunc_start_defs() block which explictlty disables this kind of
> warning for the compiler. I am not aware of something similar for sparse
> so I guess are stuck with them unless we add them.
>
> Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxxxx>
> Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  include/linux/bpf.h      | 5 +++++
>  kernel/trace/bpf_trace.c | 4 ----
>  2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/linux/bpf.h b/include/linux/bpf.h
> index f5c6bc9093a6b..d411bf52910cc 100644
> --- a/include/linux/bpf.h
> +++ b/include/linux/bpf.h
> @@ -840,6 +840,11 @@ struct bpf_func_proto {
>         bool (*allowed)(const struct bpf_prog *prog);
>  };
>
> +extern const struct bpf_func_proto bpf_xdp_get_buff_len_trace_proto;
> +extern const struct bpf_func_proto bpf_skb_output_proto;
> +extern const struct bpf_func_proto bpf_xdp_output_proto;
> +extern const struct bpf_func_proto bpf_sk_storage_get_cg_sock_proto;
> +

There is a whole block of extern const declarations for bpf_*_proto
functions, let's keep them together?

pw-bot: cr


>  /* bpf_context is intentionally undefined structure. Pointer to bpf_context is
>   * the first argument to eBPF programs.
>   * For socket filters: 'struct bpf_context *' == 'struct sk_buff *'
> diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c
> index d1daeab1bbc14..d8d7ee6b06a6f 100644
> --- a/kernel/trace/bpf_trace.c
> +++ b/kernel/trace/bpf_trace.c
> @@ -1951,10 +1951,6 @@ static const struct bpf_func_proto bpf_perf_event_output_proto_raw_tp = {
>         .arg5_type      = ARG_CONST_SIZE_OR_ZERO,
>  };
>
> -extern const struct bpf_func_proto bpf_skb_output_proto;
> -extern const struct bpf_func_proto bpf_xdp_output_proto;
> -extern const struct bpf_func_proto bpf_xdp_get_buff_len_trace_proto;
> -
>  BPF_CALL_3(bpf_get_stackid_raw_tp, struct bpf_raw_tracepoint_args *, args,
>            struct bpf_map *, map, u64, flags)
>  {
> --
> 2.45.2
>





[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