linux/Documentation/bpf
Dave Marchevsky 391145ba2a bpf: Add __bpf_kfunc_{start,end}_defs macros
BPF kfuncs are meant to be called from BPF programs. Accordingly, most
kfuncs are not called from anywhere in the kernel, which the
-Wmissing-prototypes warning is unhappy about. We've peppered
__diag_ignore_all("-Wmissing-prototypes", ... everywhere kfuncs are
defined in the codebase to suppress this warning.

This patch adds two macros meant to bound one or many kfunc definitions.
All existing kfunc definitions which use these __diag calls to suppress
-Wmissing-prototypes are migrated to use the newly-introduced macros.
A new __diag_ignore_all - for "-Wmissing-declarations" - is added to the
__bpf_kfunc_start_defs macro based on feedback from Andrii on an earlier
version of this patch [0] and another recent mailing list thread [1].

In the future we might need to ignore different warnings or do other
kfunc-specific things. This change will make it easier to make such
modifications for all kfunc defs.

  [0]: https://lore.kernel.org/bpf/CAEf4BzaE5dRWtK6RPLnjTW-MW9sx9K3Fn6uwqCTChK2Dcb1Xig@mail.gmail.com/
  [1]: https://lore.kernel.org/bpf/ZT+2qCc%2FaXep0%2FLf@krava/

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Suggested-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Cc: Jiri Olsa <olsajiri@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Acked-by: David Vernet <void@manifault.com>
Acked-by: Yafang Shao <laoar.shao@gmail.com>
Link: https://lore.kernel.org/r/20231031215625.2343848-1-davemarchevsky@fb.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-11-01 22:33:53 -07:00
..
libbpf
standardization
bpf_design_QA.rst
bpf_devel_QA.rst
bpf_iterators.rst
bpf_licensing.rst
bpf_prog_run.rst
btf.rst
clang-notes.rst
classic_vs_extended.rst
cpumasks.rst
drgn.rst
faq.rst
graph_ds_impl.rst
helpers.rst
index.rst
kfuncs.rst bpf: Add __bpf_kfunc_{start,end}_defs macros 2023-11-01 22:33:53 -07:00
linux-notes.rst
llvm_reloc.rst
map_array.rst
map_bloom_filter.rst
map_cgroup_storage.rst
map_cgrp_storage.rst
map_cpumap.rst
map_devmap.rst
map_hash.rst
map_lpm_trie.rst
map_lru_hash_update.dot
map_of_maps.rst
map_queue_stack.rst
map_sk_storage.rst
map_sockmap.rst
map_xskmap.rst
maps.rst
other.rst
prog_cgroup_sockopt.rst
prog_cgroup_sysctl.rst
prog_flow_dissector.rst
prog_lsm.rst
prog_sk_lookup.rst
programs.rst
redirect.rst
ringbuf.rst
s390.rst
syscall_api.rst
test_debug.rst
verifier.rst