The recent commit 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are
taken from selftests dir") broke compilation against libbpf if it is installed
on the system, and $INCLUDEDIR/bpf is not in the include path.
Since having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
requirement for building against libbpf before, this needs to be fixed. One
option is to just revert the offending commit and figure out a different way to
achieve what it aims for. However, this series takes a different approach:
Changing all in-tree users of libbpf to consistently use a bpf/ prefix in
#include directives for header files from libbpf.
This turns out to be a somewhat invasive change in the number of files touched;
however, the actual changes to files are fairly trivial (most of them are simply
made with 'sed'). Also, this approach has the advantage that it makes external
and internal users consistent with each other, and ensures no future changes
breaks things in the same way as the commit referenced above.
The series is split to make the change for one tool subdir at a time, while
trying not to break the build along the way. It is structured like this:
- Patch 1-2: Trivial fixes to Makefiles for issues I discovered while changing
the include paths.
- Patch 3-7: Change the include directives to use the bpf/ prefix, and updates
Makefiles to make sure tools/lib/ is part of the include path, but without
removing tools/lib/bpf
- Patch 8: Change the bpf_helpers file in libbpf itself to use the bpf/ prefix
when including (the original source of breakage).
- Patch 9-10: Remove tools/lib/bpf from include paths to make sure we don't
inadvertently re-introduce includes without the bpf/ prefix.
---
Toke Høiland-Jørgensen (10):
samples/bpf: Don't try to remove user's homedir on clean
tools/bpf/runqslower: Fix override option for VMLINUX_BTF
tools/runqslower: Use consistent include paths for libbpf
selftests: Use consistent include paths for libbpf
bpftool: Use consistent include paths for libbpf
perf: Use consistent include paths for libbpf
samples/bpf: Use consistent include paths for libbpf
libbpf: Fix include of bpf_helpers.h when libbpf is installed on system
selftests: Remove tools/lib/bpf from include path
tools/runqslower: Remove tools/lib/bpf from include path
samples/bpf/Makefile | 5 ++---
samples/bpf/cpustat_kern.c | 2 +-
samples/bpf/fds_example.c | 2 +-
samples/bpf/hbm.c | 4 ++--
samples/bpf/hbm_kern.h | 4 ++--
samples/bpf/ibumad_kern.c | 2 +-
samples/bpf/ibumad_user.c | 2 +-
samples/bpf/lathist_kern.c | 2 +-
samples/bpf/lwt_len_hist_kern.c | 2 +-
samples/bpf/map_perf_test_kern.c | 4 ++--
samples/bpf/offwaketime_kern.c | 4 ++--
samples/bpf/offwaketime_user.c | 2 +-
samples/bpf/parse_ldabs.c | 2 +-
samples/bpf/parse_simple.c | 2 +-
samples/bpf/parse_varlen.c | 2 +-
samples/bpf/sampleip_kern.c | 4 ++--
samples/bpf/sampleip_user.c | 2 +-
samples/bpf/sock_flags_kern.c | 2 +-
samples/bpf/sockex1_kern.c | 2 +-
samples/bpf/sockex1_user.c | 2 +-
samples/bpf/sockex2_kern.c | 2 +-
samples/bpf/sockex2_user.c | 2 +-
samples/bpf/sockex3_kern.c | 2 +-
samples/bpf/spintest_kern.c | 4 ++--
samples/bpf/spintest_user.c | 2 +-
samples/bpf/syscall_tp_kern.c | 2 +-
samples/bpf/task_fd_query_kern.c | 2 +-
samples/bpf/task_fd_query_user.c | 2 +-
samples/bpf/tc_l2_redirect_kern.c | 2 +-
samples/bpf/tcbpf1_kern.c | 2 +-
samples/bpf/tcp_basertt_kern.c | 4 ++--
samples/bpf/tcp_bufs_kern.c | 4 ++--
samples/bpf/tcp_clamp_kern.c | 4 ++--
samples/bpf/tcp_cong_kern.c | 4 ++--
samples/bpf/tcp_dumpstats_kern.c | 4 ++--
samples/bpf/tcp_iw_kern.c | 4 ++--
samples/bpf/tcp_rwnd_kern.c | 4 ++--
samples/bpf/tcp_synrto_kern.c | 4 ++--
samples/bpf/tcp_tos_reflect_kern.c | 4 ++--
samples/bpf/test_cgrp2_tc_kern.c | 2 +-
samples/bpf/test_current_task_under_cgroup_kern.c | 2 +-
samples/bpf/test_lwt_bpf.c | 2 +-
samples/bpf/test_map_in_map_kern.c | 4 ++--
samples/bpf/test_overhead_kprobe_kern.c | 4 ++--
samples/bpf/test_overhead_raw_tp_kern.c | 2 +-
samples/bpf/test_overhead_tp_kern.c | 2 +-
samples/bpf/test_probe_write_user_kern.c | 4 ++--
samples/bpf/trace_event_kern.c | 4 ++--
samples/bpf/trace_event_user.c | 2 +-
samples/bpf/trace_output_kern.c | 2 +-
samples/bpf/trace_output_user.c | 2 +-
samples/bpf/tracex1_kern.c | 4 ++--
samples/bpf/tracex2_kern.c | 4 ++--
samples/bpf/tracex3_kern.c | 4 ++--
samples/bpf/tracex4_kern.c | 4 ++--
samples/bpf/tracex5_kern.c | 4 ++--
samples/bpf/tracex6_kern.c | 2 +-
samples/bpf/tracex7_kern.c | 2 +-
samples/bpf/xdp1_kern.c | 2 +-
samples/bpf/xdp1_user.c | 4 ++--
samples/bpf/xdp2_kern.c | 2 +-
samples/bpf/xdp2skb_meta_kern.c | 2 +-
samples/bpf/xdp_adjust_tail_kern.c | 2 +-
samples/bpf/xdp_adjust_tail_user.c | 4 ++--
samples/bpf/xdp_fwd_kern.c | 2 +-
samples/bpf/xdp_fwd_user.c | 2 +-
samples/bpf/xdp_monitor_kern.c | 2 +-
samples/bpf/xdp_redirect_cpu_kern.c | 2 +-
samples/bpf/xdp_redirect_cpu_user.c | 2 +-
samples/bpf/xdp_redirect_kern.c | 2 +-
samples/bpf/xdp_redirect_map_kern.c | 2 +-
samples/bpf/xdp_redirect_map_user.c | 2 +-
samples/bpf/xdp_redirect_user.c | 2 +-
samples/bpf/xdp_router_ipv4_kern.c | 2 +-
samples/bpf/xdp_router_ipv4_user.c | 2 +-
samples/bpf/xdp_rxq_info_kern.c | 2 +-
samples/bpf/xdp_rxq_info_user.c | 4 ++--
samples/bpf/xdp_sample_pkts_kern.c | 2 +-
samples/bpf/xdp_sample_pkts_user.c | 2 +-
samples/bpf/xdp_tx_iptunnel_kern.c | 2 +-
samples/bpf/xdp_tx_iptunnel_user.c | 2 +-
samples/bpf/xdpsock_kern.c | 2 +-
samples/bpf/xdpsock_user.c | 6 +++---
tools/bpf/bpftool/Documentation/bpftool-gen.rst | 2 +-
tools/bpf/bpftool/Makefile | 2 +-
tools/bpf/bpftool/btf.c | 8 ++++----
tools/bpf/bpftool/btf_dumper.c | 2 +-
tools/bpf/bpftool/cgroup.c | 2 +-
tools/bpf/bpftool/common.c | 4 ++--
tools/bpf/bpftool/feature.c | 4 ++--
tools/bpf/bpftool/gen.c | 10 +++++-----
tools/bpf/bpftool/jit_disasm.c | 2 +-
tools/bpf/bpftool/main.c | 4 ++--
tools/bpf/bpftool/map.c | 4 ++--
tools/bpf/bpftool/map_perf_ring.c | 4 ++--
tools/bpf/bpftool/net.c | 8 ++++----
tools/bpf/bpftool/netlink_dumper.c | 4 ++--
tools/bpf/bpftool/perf.c | 2 +-
tools/bpf/bpftool/prog.c | 6 +++---
tools/bpf/bpftool/xlated_dumper.c | 2 +-
tools/bpf/runqslower/Makefile | 21 ++++++++++++--------
tools/bpf/runqslower/runqslower.bpf.c | 2 +-
tools/bpf/runqslower/runqslower.c | 4 ++--
tools/lib/bpf/bpf_helpers.h | 2 +-
tools/perf/examples/bpf/5sec.c | 2 +-
tools/perf/examples/bpf/empty.c | 2 +-
tools/perf/examples/bpf/sys_enter_openat.c | 2 +-
tools/perf/include/bpf/pid_filter.h | 2 +-
tools/perf/include/bpf/stdio.h | 2 +-
tools/perf/include/bpf/unistd.h | 2 +-
tools/testing/selftests/bpf/.gitignore | 3 ++-
tools/testing/selftests/bpf/Makefile | 16 ++++++++-------
tools/testing/selftests/bpf/bpf_tcp_helpers.h | 4 ++--
tools/testing/selftests/bpf/bpf_trace_helpers.h | 2 +-
tools/testing/selftests/bpf/bpf_util.h | 2 +-
tools/testing/selftests/bpf/prog_tests/cpu_mask.c | 2 +-
.../testing/selftests/bpf/prog_tests/perf_buffer.c | 2 +-
tools/testing/selftests/bpf/progs/bpf_dctcp.c | 2 +-
tools/testing/selftests/bpf/progs/bpf_flow.c | 4 ++--
tools/testing/selftests/bpf/progs/connect4_prog.c | 4 ++--
tools/testing/selftests/bpf/progs/connect6_prog.c | 4 ++--
tools/testing/selftests/bpf/progs/dev_cgroup.c | 2 +-
tools/testing/selftests/bpf/progs/fentry_test.c | 2 +-
tools/testing/selftests/bpf/progs/fexit_bpf2bpf.c | 2 +-
.../selftests/bpf/progs/fexit_bpf2bpf_simple.c | 2 +-
tools/testing/selftests/bpf/progs/fexit_test.c | 2 +-
.../selftests/bpf/progs/get_cgroup_id_kern.c | 2 +-
tools/testing/selftests/bpf/progs/kfree_skb.c | 4 ++--
tools/testing/selftests/bpf/progs/loop1.c | 4 ++--
tools/testing/selftests/bpf/progs/loop2.c | 4 ++--
tools/testing/selftests/bpf/progs/loop3.c | 4 ++--
tools/testing/selftests/bpf/progs/loop4.c | 2 +-
tools/testing/selftests/bpf/progs/loop5.c | 2 +-
tools/testing/selftests/bpf/progs/netcnt_prog.c | 2 +-
tools/testing/selftests/bpf/progs/pyperf.h | 2 +-
.../testing/selftests/bpf/progs/sample_map_ret0.c | 2 +-
tools/testing/selftests/bpf/progs/sendmsg4_prog.c | 4 ++--
tools/testing/selftests/bpf/progs/sendmsg6_prog.c | 4 ++--
.../selftests/bpf/progs/socket_cookie_prog.c | 4 ++--
.../selftests/bpf/progs/sockmap_parse_prog.c | 4 ++--
.../selftests/bpf/progs/sockmap_tcp_msg_prog.c | 4 ++--
.../selftests/bpf/progs/sockmap_verdict_prog.c | 4 ++--
.../testing/selftests/bpf/progs/sockopt_inherit.c | 2 +-
tools/testing/selftests/bpf/progs/sockopt_multi.c | 2 +-
tools/testing/selftests/bpf/progs/sockopt_sk.c | 2 +-
tools/testing/selftests/bpf/progs/strobemeta.h | 2 +-
tools/testing/selftests/bpf/progs/tailcall1.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall2.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall3.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall4.c | 2 +-
tools/testing/selftests/bpf/progs/tailcall5.c | 2 +-
tools/testing/selftests/bpf/progs/tcp_rtt.c | 2 +-
.../testing/selftests/bpf/progs/test_adjust_tail.c | 2 +-
.../selftests/bpf/progs/test_attach_probe.c | 2 +-
tools/testing/selftests/bpf/progs/test_btf_haskv.c | 2 +-
tools/testing/selftests/bpf/progs/test_btf_newkv.c | 2 +-
tools/testing/selftests/bpf/progs/test_btf_nokv.c | 2 +-
.../testing/selftests/bpf/progs/test_core_extern.c | 2 +-
.../selftests/bpf/progs/test_core_reloc_arrays.c | 4 ++--
.../bpf/progs/test_core_reloc_bitfields_direct.c | 4 ++--
.../bpf/progs/test_core_reloc_bitfields_probed.c | 4 ++--
.../bpf/progs/test_core_reloc_existence.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_flavors.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_ints.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_kernel.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_misc.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_mods.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_nesting.c | 4 ++--
.../bpf/progs/test_core_reloc_primitives.c | 4 ++--
.../bpf/progs/test_core_reloc_ptr_as_arr.c | 4 ++--
.../selftests/bpf/progs/test_core_reloc_size.c | 4 ++--
.../selftests/bpf/progs/test_get_stack_rawtp.c | 2 +-
.../testing/selftests/bpf/progs/test_global_data.c | 2 +-
.../selftests/bpf/progs/test_global_func1.c | 2 +-
.../selftests/bpf/progs/test_global_func3.c | 2 +-
.../selftests/bpf/progs/test_global_func5.c | 2 +-
.../selftests/bpf/progs/test_global_func6.c | 2 +-
.../selftests/bpf/progs/test_global_func7.c | 2 +-
tools/testing/selftests/bpf/progs/test_l4lb.c | 4 ++--
.../selftests/bpf/progs/test_l4lb_noinline.c | 4 ++--
.../selftests/bpf/progs/test_lirc_mode2_kern.c | 2 +-
.../selftests/bpf/progs/test_lwt_ip_encap.c | 4 ++--
.../selftests/bpf/progs/test_lwt_seg6local.c | 4 ++--
.../testing/selftests/bpf/progs/test_map_in_map.c | 2 +-
tools/testing/selftests/bpf/progs/test_map_lock.c | 2 +-
tools/testing/selftests/bpf/progs/test_mmap.c | 2 +-
tools/testing/selftests/bpf/progs/test_obj_id.c | 2 +-
tools/testing/selftests/bpf/progs/test_overhead.c | 4 ++--
.../testing/selftests/bpf/progs/test_perf_buffer.c | 2 +-
tools/testing/selftests/bpf/progs/test_pinning.c | 2 +-
.../selftests/bpf/progs/test_pinning_invalid.c | 2 +-
.../testing/selftests/bpf/progs/test_pkt_access.c | 4 ++--
.../selftests/bpf/progs/test_pkt_md_access.c | 2 +-
.../testing/selftests/bpf/progs/test_probe_user.c | 4 ++--
.../selftests/bpf/progs/test_queue_stack_map.h | 2 +-
.../testing/selftests/bpf/progs/test_rdonly_maps.c | 2 +-
tools/testing/selftests/bpf/progs/test_seg6_loop.c | 4 ++--
.../bpf/progs/test_select_reuseport_kern.c | 4 ++--
.../selftests/bpf/progs/test_send_signal_kern.c | 2 +-
.../selftests/bpf/progs/test_sk_lookup_kern.c | 4 ++--
.../selftests/bpf/progs/test_skb_cgroup_id_kern.c | 2 +-
tools/testing/selftests/bpf/progs/test_skb_ctx.c | 2 +-
tools/testing/selftests/bpf/progs/test_skeleton.c | 2 +-
.../selftests/bpf/progs/test_sock_fields_kern.c | 4 ++--
tools/testing/selftests/bpf/progs/test_spin_lock.c | 2 +-
.../selftests/bpf/progs/test_stacktrace_build_id.c | 2 +-
.../selftests/bpf/progs/test_stacktrace_map.c | 2 +-
.../selftests/bpf/progs/test_sysctl_loop1.c | 2 +-
.../selftests/bpf/progs/test_sysctl_loop2.c | 2 +-
.../testing/selftests/bpf/progs/test_sysctl_prog.c | 2 +-
tools/testing/selftests/bpf/progs/test_tc_edt.c | 4 ++--
tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 4 ++--
.../bpf/progs/test_tcp_check_syncookie_kern.c | 4 ++--
.../testing/selftests/bpf/progs/test_tcp_estats.c | 2 +-
.../testing/selftests/bpf/progs/test_tcpbpf_kern.c | 4 ++--
.../selftests/bpf/progs/test_tcpnotify_kern.c | 4 ++--
.../testing/selftests/bpf/progs/test_tracepoint.c | 2 +-
.../testing/selftests/bpf/progs/test_tunnel_kern.c | 4 ++--
.../selftests/bpf/progs/test_verif_scale1.c | 2 +-
.../selftests/bpf/progs/test_verif_scale2.c | 2 +-
.../selftests/bpf/progs/test_verif_scale3.c | 2 +-
tools/testing/selftests/bpf/progs/test_xdp.c | 4 ++--
tools/testing/selftests/bpf/progs/test_xdp_loop.c | 4 ++--
tools/testing/selftests/bpf/progs/test_xdp_meta.c | 2 +-
.../selftests/bpf/progs/test_xdp_noinline.c | 4 ++--
.../selftests/bpf/progs/test_xdp_redirect.c | 2 +-
tools/testing/selftests/bpf/progs/test_xdp_vlan.c | 4 ++--
tools/testing/selftests/bpf/progs/xdp_dummy.c | 2 +-
.../testing/selftests/bpf/progs/xdp_redirect_map.c | 2 +-
tools/testing/selftests/bpf/progs/xdp_tx.c | 2 +-
tools/testing/selftests/bpf/progs/xdping_kern.c | 4 ++--
tools/testing/selftests/bpf/test_cpp.cpp | 6 +++---
tools/testing/selftests/bpf/test_hashmap.c | 2 +-
tools/testing/selftests/bpf/test_progs.h | 2 +-
tools/testing/selftests/bpf/test_sock.c | 2 +-
tools/testing/selftests/bpf/test_sockmap_kern.h | 4 ++--
tools/testing/selftests/bpf/test_sysctl.c | 2 +-
tools/testing/selftests/bpf/trace_helpers.h | 2 +-
238 files changed, 359 insertions(+), 354 deletions(-)
From: Toke Høiland-Jørgensen <[email protected]>
The 'clean' rule in the samples/bpf Makefile tries to remove backup
files (ending in ~). However, if no such files exist, it will instead try
to remove the user's home directory. While the attempt is mostly harmless,
it does lead to a somewhat scary warning like this:
rm: cannot remove '~': Is a directory
Fix this by using find instead of shell expansion to locate any actual
backup files that need to be removed.
Fixes: b62a796c109c ("samples/bpf: allow make to be run from samples/bpf/ directory")
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
---
samples/bpf/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 5b89c0370f33..f86d713a17a5 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -254,7 +254,7 @@ all:
clean:
$(MAKE) -C ../../ M=$(CURDIR) clean
- @rm -f *~
+ @find $(CURDIR) -type f -name '*~' -delete
$(LIBBPF): FORCE
# Fix up variables inherited from Kbuild that tools/ build system won't like
From: Toke Høiland-Jørgensen <[email protected]>
Fix all files in samples/bpf to include libbpf header files with the bpf/
prefix, to be consistent with external users of the library. Also ensure
that all includes of exported libbpf header files (those that are exported
on 'make install' of the library) use bracketed includes instead of quoted.
To make sure no new files are introduced that doesn't include the bpf/
prefix in its include, remove tools/lib/bpf from the include path entirely,
and use tools/lib instead.
Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
---
samples/bpf/Makefile | 3 +--
samples/bpf/cpustat_kern.c | 2 +-
samples/bpf/fds_example.c | 2 +-
samples/bpf/hbm.c | 4 ++--
samples/bpf/hbm_kern.h | 4 ++--
samples/bpf/ibumad_kern.c | 2 +-
samples/bpf/ibumad_user.c | 2 +-
samples/bpf/lathist_kern.c | 2 +-
samples/bpf/lwt_len_hist_kern.c | 2 +-
samples/bpf/map_perf_test_kern.c | 4 ++--
samples/bpf/offwaketime_kern.c | 4 ++--
samples/bpf/offwaketime_user.c | 2 +-
samples/bpf/parse_ldabs.c | 2 +-
samples/bpf/parse_simple.c | 2 +-
samples/bpf/parse_varlen.c | 2 +-
samples/bpf/sampleip_kern.c | 4 ++--
samples/bpf/sampleip_user.c | 2 +-
samples/bpf/sock_flags_kern.c | 2 +-
samples/bpf/sockex1_kern.c | 2 +-
samples/bpf/sockex1_user.c | 2 +-
samples/bpf/sockex2_kern.c | 2 +-
samples/bpf/sockex2_user.c | 2 +-
samples/bpf/sockex3_kern.c | 2 +-
samples/bpf/spintest_kern.c | 4 ++--
samples/bpf/spintest_user.c | 2 +-
samples/bpf/syscall_tp_kern.c | 2 +-
samples/bpf/task_fd_query_kern.c | 2 +-
samples/bpf/task_fd_query_user.c | 2 +-
samples/bpf/tc_l2_redirect_kern.c | 2 +-
samples/bpf/tcbpf1_kern.c | 2 +-
samples/bpf/tcp_basertt_kern.c | 4 ++--
samples/bpf/tcp_bufs_kern.c | 4 ++--
samples/bpf/tcp_clamp_kern.c | 4 ++--
samples/bpf/tcp_cong_kern.c | 4 ++--
samples/bpf/tcp_dumpstats_kern.c | 4 ++--
samples/bpf/tcp_iw_kern.c | 4 ++--
samples/bpf/tcp_rwnd_kern.c | 4 ++--
samples/bpf/tcp_synrto_kern.c | 4 ++--
samples/bpf/tcp_tos_reflect_kern.c | 4 ++--
samples/bpf/test_cgrp2_tc_kern.c | 2 +-
samples/bpf/test_current_task_under_cgroup_kern.c | 2 +-
samples/bpf/test_lwt_bpf.c | 2 +-
samples/bpf/test_map_in_map_kern.c | 4 ++--
samples/bpf/test_overhead_kprobe_kern.c | 4 ++--
samples/bpf/test_overhead_raw_tp_kern.c | 2 +-
samples/bpf/test_overhead_tp_kern.c | 2 +-
samples/bpf/test_probe_write_user_kern.c | 4 ++--
samples/bpf/trace_event_kern.c | 4 ++--
samples/bpf/trace_event_user.c | 2 +-
samples/bpf/trace_output_kern.c | 2 +-
samples/bpf/trace_output_user.c | 2 +-
samples/bpf/tracex1_kern.c | 4 ++--
samples/bpf/tracex2_kern.c | 4 ++--
samples/bpf/tracex3_kern.c | 4 ++--
samples/bpf/tracex4_kern.c | 4 ++--
samples/bpf/tracex5_kern.c | 4 ++--
samples/bpf/tracex6_kern.c | 2 +-
samples/bpf/tracex7_kern.c | 2 +-
samples/bpf/xdp1_kern.c | 2 +-
samples/bpf/xdp1_user.c | 4 ++--
samples/bpf/xdp2_kern.c | 2 +-
samples/bpf/xdp2skb_meta_kern.c | 2 +-
samples/bpf/xdp_adjust_tail_kern.c | 2 +-
samples/bpf/xdp_adjust_tail_user.c | 4 ++--
samples/bpf/xdp_fwd_kern.c | 2 +-
samples/bpf/xdp_fwd_user.c | 2 +-
samples/bpf/xdp_monitor_kern.c | 2 +-
samples/bpf/xdp_redirect_cpu_kern.c | 2 +-
samples/bpf/xdp_redirect_cpu_user.c | 2 +-
samples/bpf/xdp_redirect_kern.c | 2 +-
samples/bpf/xdp_redirect_map_kern.c | 2 +-
samples/bpf/xdp_redirect_map_user.c | 2 +-
samples/bpf/xdp_redirect_user.c | 2 +-
samples/bpf/xdp_router_ipv4_kern.c | 2 +-
samples/bpf/xdp_router_ipv4_user.c | 2 +-
samples/bpf/xdp_rxq_info_kern.c | 2 +-
samples/bpf/xdp_rxq_info_user.c | 4 ++--
samples/bpf/xdp_sample_pkts_kern.c | 2 +-
samples/bpf/xdp_sample_pkts_user.c | 2 +-
samples/bpf/xdp_tx_iptunnel_kern.c | 2 +-
samples/bpf/xdp_tx_iptunnel_user.c | 2 +-
samples/bpf/xdpsock_kern.c | 2 +-
samples/bpf/xdpsock_user.c | 6 +++---
83 files changed, 112 insertions(+), 113 deletions(-)
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index f86d713a17a5..b0e8adf7eb01 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -184,7 +184,6 @@ TPROGS_CFLAGS += -Wmissing-prototypes
TPROGS_CFLAGS += -Wstrict-prototypes
TPROGS_CFLAGS += -I$(objtree)/usr/include
-TPROGS_CFLAGS += -I$(srctree)/tools/lib/bpf/
TPROGS_CFLAGS += -I$(srctree)/tools/testing/selftests/bpf/
TPROGS_CFLAGS += -I$(srctree)/tools/lib/
TPROGS_CFLAGS += -I$(srctree)/tools/include
@@ -305,7 +304,7 @@ $(obj)/%.o: $(src)/%.c
@echo " CLANG-bpf " $@
$(Q)$(CLANG) $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(BPF_EXTRA_CFLAGS) \
-I$(obj) -I$(srctree)/tools/testing/selftests/bpf/ \
- -I$(srctree)/tools/lib/bpf/ \
+ -I$(srctree)/tools/lib/ \
-D__KERNEL__ -D__BPF_TRACING__ -Wno-unused-value -Wno-pointer-sign \
-D__TARGET_ARCH_$(SRCARCH) -Wno-compare-distinct-pointer-types \
-Wno-gnu-variable-sized-type-not-at-end \
diff --git a/samples/bpf/cpustat_kern.c b/samples/bpf/cpustat_kern.c
index 68c84da065b1..a86a19d5f033 100644
--- a/samples/bpf/cpustat_kern.c
+++ b/samples/bpf/cpustat_kern.c
@@ -3,7 +3,7 @@
#include <linux/version.h>
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
/*
* The CPU number, cstate number and pstate number are based
diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c
index 2d4b717726b6..d5992f787232 100644
--- a/samples/bpf/fds_example.c
+++ b/samples/bpf/fds_example.c
@@ -14,7 +14,7 @@
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_insn.h"
#include "sock_example.h"
diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c
index 829b68d87687..7d7153777678 100644
--- a/samples/bpf/hbm.c
+++ b/samples/bpf/hbm.c
@@ -50,8 +50,8 @@
#include "cgroup_helpers.h"
#include "hbm.h"
#include "bpf_util.h"
-#include "bpf.h"
-#include "libbpf.h"
+#include <bpf/bpf.h>
+#include <bpf/libbpf.h>
bool outFlag = true;
int minRate = 1000; /* cgroup rate limit in Mbps */
diff --git a/samples/bpf/hbm_kern.h b/samples/bpf/hbm_kern.h
index 4edaf47876ca..e00f26f6afba 100644
--- a/samples/bpf/hbm_kern.h
+++ b/samples/bpf/hbm_kern.h
@@ -22,8 +22,8 @@
#include <uapi/linux/pkt_cls.h>
#include <net/ipv6.h>
#include <net/inet_ecn.h>
-#include "bpf_endian.h"
-#include "bpf_helpers.h"
+#include <bpf/bpf_endian.h>
+#include <bpf/bpf_helpers.h>
#include "hbm.h"
#define DROP_PKT 0
diff --git a/samples/bpf/ibumad_kern.c b/samples/bpf/ibumad_kern.c
index f281df7e0089..3a91b4c1989a 100644
--- a/samples/bpf/ibumad_kern.c
+++ b/samples/bpf/ibumad_kern.c
@@ -13,7 +13,7 @@
#define KBUILD_MODNAME "ibumad_count_pkts_by_class"
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct bpf_map_def SEC("maps") read_count = {
diff --git a/samples/bpf/ibumad_user.c b/samples/bpf/ibumad_user.c
index cb5a8f994849..fa06eef31a84 100644
--- a/samples/bpf/ibumad_user.c
+++ b/samples/bpf/ibumad_user.c
@@ -25,7 +25,7 @@
#include "bpf_load.h"
#include "bpf_util.h"
-#include "libbpf.h"
+#include <bpf/libbpf.h>
static void dump_counts(int fd)
{
diff --git a/samples/bpf/lathist_kern.c b/samples/bpf/lathist_kern.c
index 18fa088473cd..ca9c2e4e69aa 100644
--- a/samples/bpf/lathist_kern.c
+++ b/samples/bpf/lathist_kern.c
@@ -8,7 +8,7 @@
#include <linux/version.h>
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define MAX_ENTRIES 20
#define MAX_CPU 4
diff --git a/samples/bpf/lwt_len_hist_kern.c b/samples/bpf/lwt_len_hist_kern.c
index df75383280f9..9ed63e10e170 100644
--- a/samples/bpf/lwt_len_hist_kern.c
+++ b/samples/bpf/lwt_len_hist_kern.c
@@ -14,7 +14,7 @@
#include <uapi/linux/if_ether.h>
#include <uapi/linux/ip.h>
#include <uapi/linux/in.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
# define printk(fmt, ...) \
({ \
diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c
index 281bcdaee58e..12e91ae64d4d 100644
--- a/samples/bpf/map_perf_test_kern.c
+++ b/samples/bpf/map_perf_test_kern.c
@@ -8,9 +8,9 @@
#include <linux/netdevice.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_tracing.h>
#define MAX_ENTRIES 1000
#define MAX_NR_CPUS 1024
diff --git a/samples/bpf/offwaketime_kern.c b/samples/bpf/offwaketime_kern.c
index 9cb5207a692f..c4ec10dbfc3b 100644
--- a/samples/bpf/offwaketime_kern.c
+++ b/samples/bpf/offwaketime_kern.c
@@ -5,8 +5,8 @@
* License as published by the Free Software Foundation.
*/
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
#include <uapi/linux/ptrace.h>
#include <uapi/linux/perf_event.h>
#include <linux/version.h>
diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c
index fc8767d001f6..51c7da5341cc 100644
--- a/samples/bpf/offwaketime_user.c
+++ b/samples/bpf/offwaketime_user.c
@@ -12,7 +12,7 @@
#include <assert.h>
#include <stdbool.h>
#include <sys/resource.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "trace_helpers.h"
diff --git a/samples/bpf/parse_ldabs.c b/samples/bpf/parse_ldabs.c
index ef5892377beb..c6f65f90a097 100644
--- a/samples/bpf/parse_ldabs.c
+++ b/samples/bpf/parse_ldabs.c
@@ -11,7 +11,7 @@
#include <linux/tcp.h>
#include <linux/udp.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
#define DEFAULT_PKTGEN_UDP_PORT 9
diff --git a/samples/bpf/parse_simple.c b/samples/bpf/parse_simple.c
index 10af53d33cc2..4a486cb1e0df 100644
--- a/samples/bpf/parse_simple.c
+++ b/samples/bpf/parse_simple.c
@@ -12,7 +12,7 @@
#include <linux/udp.h>
#include <uapi/linux/bpf.h>
#include <net/ip.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define DEFAULT_PKTGEN_UDP_PORT 9
diff --git a/samples/bpf/parse_varlen.c b/samples/bpf/parse_varlen.c
index 0b6f22feb2c9..d8623846e810 100644
--- a/samples/bpf/parse_varlen.c
+++ b/samples/bpf/parse_varlen.c
@@ -14,7 +14,7 @@
#include <linux/udp.h>
#include <uapi/linux/bpf.h>
#include <net/ip.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define DEFAULT_PKTGEN_UDP_PORT 9
#define DEBUG 0
diff --git a/samples/bpf/sampleip_kern.c b/samples/bpf/sampleip_kern.c
index 4a190893894f..e504dc308371 100644
--- a/samples/bpf/sampleip_kern.c
+++ b/samples/bpf/sampleip_kern.c
@@ -8,8 +8,8 @@
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
#include <uapi/linux/bpf_perf_event.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
#define MAX_IPS 8192
diff --git a/samples/bpf/sampleip_user.c b/samples/bpf/sampleip_user.c
index 6b5dc26d9701..b0f115f938bc 100644
--- a/samples/bpf/sampleip_user.c
+++ b/samples/bpf/sampleip_user.c
@@ -15,7 +15,7 @@
#include <linux/ptrace.h>
#include <linux/bpf.h>
#include <sys/ioctl.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "perf-sys.h"
#include "trace_helpers.h"
diff --git a/samples/bpf/sock_flags_kern.c b/samples/bpf/sock_flags_kern.c
index 05dcdf8a4baa..6d0ac7569d6f 100644
--- a/samples/bpf/sock_flags_kern.c
+++ b/samples/bpf/sock_flags_kern.c
@@ -3,7 +3,7 @@
#include <linux/net.h>
#include <uapi/linux/in.h>
#include <uapi/linux/in6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
SEC("cgroup/sock1")
int bpf_prog1(struct bpf_sock *sk)
diff --git a/samples/bpf/sockex1_kern.c b/samples/bpf/sockex1_kern.c
index 2408dbfb7a21..431c956460ad 100644
--- a/samples/bpf/sockex1_kern.c
+++ b/samples/bpf/sockex1_kern.c
@@ -2,7 +2,7 @@
#include <uapi/linux/if_ether.h>
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
struct {
diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c
index a219442afbee..3c83722877dc 100644
--- a/samples/bpf/sockex1_user.c
+++ b/samples/bpf/sockex1_user.c
@@ -3,7 +3,7 @@
#include <assert.h>
#include <linux/bpf.h>
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "sock_example.h"
#include <unistd.h>
#include <arpa/inet.h>
diff --git a/samples/bpf/sockex2_kern.c b/samples/bpf/sockex2_kern.c
index a7bcd03bf529..a41dd520bc53 100644
--- a/samples/bpf/sockex2_kern.c
+++ b/samples/bpf/sockex2_kern.c
@@ -1,5 +1,5 @@
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
#include <uapi/linux/in.h>
#include <uapi/linux/if.h>
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c
index 6de383ddd08b..af925a5afd1d 100644
--- a/samples/bpf/sockex2_user.c
+++ b/samples/bpf/sockex2_user.c
@@ -3,7 +3,7 @@
#include <assert.h>
#include <linux/bpf.h>
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "sock_example.h"
#include <unistd.h>
#include <arpa/inet.h>
diff --git a/samples/bpf/sockex3_kern.c b/samples/bpf/sockex3_kern.c
index 151dd842ecc0..36d4dac23549 100644
--- a/samples/bpf/sockex3_kern.c
+++ b/samples/bpf/sockex3_kern.c
@@ -5,7 +5,7 @@
* License as published by the Free Software Foundation.
*/
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
#include <uapi/linux/in.h>
#include <uapi/linux/if.h>
diff --git a/samples/bpf/spintest_kern.c b/samples/bpf/spintest_kern.c
index 6e9478aa2938..f508af357251 100644
--- a/samples/bpf/spintest_kern.c
+++ b/samples/bpf/spintest_kern.c
@@ -9,8 +9,8 @@
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <uapi/linux/perf_event.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_HASH,
diff --git a/samples/bpf/spintest_user.c b/samples/bpf/spintest_user.c
index 2556af2d9b3e..fb430ea2ef51 100644
--- a/samples/bpf/spintest_user.c
+++ b/samples/bpf/spintest_user.c
@@ -5,7 +5,7 @@
#include <string.h>
#include <assert.h>
#include <sys/resource.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "trace_helpers.h"
diff --git a/samples/bpf/syscall_tp_kern.c b/samples/bpf/syscall_tp_kern.c
index 630ce8c4d5a2..5a62b03b1f88 100644
--- a/samples/bpf/syscall_tp_kern.c
+++ b/samples/bpf/syscall_tp_kern.c
@@ -2,7 +2,7 @@
/* Copyright (c) 2017 Facebook
*/
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct syscalls_enter_open_args {
unsigned long long unused;
diff --git a/samples/bpf/task_fd_query_kern.c b/samples/bpf/task_fd_query_kern.c
index fb56fc2a3e5d..278ade5427c8 100644
--- a/samples/bpf/task_fd_query_kern.c
+++ b/samples/bpf/task_fd_query_kern.c
@@ -2,7 +2,7 @@
#include <linux/version.h>
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
SEC("kprobe/blk_mq_start_request")
int bpf_prog1(struct pt_regs *ctx)
diff --git a/samples/bpf/task_fd_query_user.c b/samples/bpf/task_fd_query_user.c
index 4c31b305e6ef..ff2e9c1c7266 100644
--- a/samples/bpf/task_fd_query_user.c
+++ b/samples/bpf/task_fd_query_user.c
@@ -15,7 +15,7 @@
#include <sys/stat.h>
#include <linux/perf_event.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "bpf_util.h"
#include "perf-sys.h"
diff --git a/samples/bpf/tc_l2_redirect_kern.c b/samples/bpf/tc_l2_redirect_kern.c
index 7ef2a12b25b2..fd2fa0004330 100644
--- a/samples/bpf/tc_l2_redirect_kern.c
+++ b/samples/bpf/tc_l2_redirect_kern.c
@@ -15,7 +15,7 @@
#include <uapi/linux/filter.h>
#include <uapi/linux/pkt_cls.h>
#include <net/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define _htonl __builtin_bswap32
diff --git a/samples/bpf/tcbpf1_kern.c b/samples/bpf/tcbpf1_kern.c
index ff43341bdfce..e9356130f84e 100644
--- a/samples/bpf/tcbpf1_kern.c
+++ b/samples/bpf/tcbpf1_kern.c
@@ -7,7 +7,7 @@
#include <uapi/linux/tcp.h>
#include <uapi/linux/filter.h>
#include <uapi/linux/pkt_cls.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
/* compiler workaround */
diff --git a/samples/bpf/tcp_basertt_kern.c b/samples/bpf/tcp_basertt_kern.c
index 9dba48c2b920..8dfe09a92fec 100644
--- a/samples/bpf/tcp_basertt_kern.c
+++ b/samples/bpf/tcp_basertt_kern.c
@@ -16,8 +16,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_bufs_kern.c b/samples/bpf/tcp_bufs_kern.c
index af8486f33771..6a80d08952ad 100644
--- a/samples/bpf/tcp_bufs_kern.c
+++ b/samples/bpf/tcp_bufs_kern.c
@@ -17,8 +17,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_clamp_kern.c b/samples/bpf/tcp_clamp_kern.c
index 26c0fd091f3c..e88bd9ab0695 100644
--- a/samples/bpf/tcp_clamp_kern.c
+++ b/samples/bpf/tcp_clamp_kern.c
@@ -17,8 +17,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_cong_kern.c b/samples/bpf/tcp_cong_kern.c
index 6d4dc4c7dd1e..2311fc9dde85 100644
--- a/samples/bpf/tcp_cong_kern.c
+++ b/samples/bpf/tcp_cong_kern.c
@@ -16,8 +16,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_dumpstats_kern.c b/samples/bpf/tcp_dumpstats_kern.c
index 8557913106a0..e80d3afd24bd 100644
--- a/samples/bpf/tcp_dumpstats_kern.c
+++ b/samples/bpf/tcp_dumpstats_kern.c
@@ -4,8 +4,8 @@
*/
#include <linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define INTERVAL 1000000000ULL
diff --git a/samples/bpf/tcp_iw_kern.c b/samples/bpf/tcp_iw_kern.c
index da61d53378b3..d1444557358e 100644
--- a/samples/bpf/tcp_iw_kern.c
+++ b/samples/bpf/tcp_iw_kern.c
@@ -17,8 +17,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_rwnd_kern.c b/samples/bpf/tcp_rwnd_kern.c
index d011e38b80d2..223d9c23b10c 100644
--- a/samples/bpf/tcp_rwnd_kern.c
+++ b/samples/bpf/tcp_rwnd_kern.c
@@ -16,8 +16,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_synrto_kern.c b/samples/bpf/tcp_synrto_kern.c
index 720d1950322d..d58004eef124 100644
--- a/samples/bpf/tcp_synrto_kern.c
+++ b/samples/bpf/tcp_synrto_kern.c
@@ -16,8 +16,8 @@
#include <uapi/linux/if_packet.h>
#include <uapi/linux/ip.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/tcp_tos_reflect_kern.c b/samples/bpf/tcp_tos_reflect_kern.c
index 369faca70a15..953fedc79ce1 100644
--- a/samples/bpf/tcp_tos_reflect_kern.c
+++ b/samples/bpf/tcp_tos_reflect_kern.c
@@ -15,8 +15,8 @@
#include <uapi/linux/ipv6.h>
#include <uapi/linux/in.h>
#include <linux/socket.h>
-#include "bpf_helpers.h"
-#include "bpf_endian.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_endian.h>
#define DEBUG 1
diff --git a/samples/bpf/test_cgrp2_tc_kern.c b/samples/bpf/test_cgrp2_tc_kern.c
index 1547b36a7b7b..4dd532a312b9 100644
--- a/samples/bpf/test_cgrp2_tc_kern.c
+++ b/samples/bpf/test_cgrp2_tc_kern.c
@@ -10,7 +10,7 @@
#include <uapi/linux/ipv6.h>
#include <uapi/linux/pkt_cls.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
/* copy of 'struct ethhdr' without __packed */
struct eth_hdr {
diff --git a/samples/bpf/test_current_task_under_cgroup_kern.c b/samples/bpf/test_current_task_under_cgroup_kern.c
index 86b28d7d6c99..6dc4f41bb6cb 100644
--- a/samples/bpf/test_current_task_under_cgroup_kern.c
+++ b/samples/bpf/test_current_task_under_cgroup_kern.c
@@ -8,7 +8,7 @@
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
#include <linux/version.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include <uapi/linux/utsname.h>
struct bpf_map_def SEC("maps") cgroup_map = {
diff --git a/samples/bpf/test_lwt_bpf.c b/samples/bpf/test_lwt_bpf.c
index bacc8013436b..1b568575ad11 100644
--- a/samples/bpf/test_lwt_bpf.c
+++ b/samples/bpf/test_lwt_bpf.c
@@ -20,7 +20,7 @@
#include <linux/udp.h>
#include <linux/icmpv6.h>
#include <linux/if_ether.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include <string.h>
# define printk(fmt, ...) \
diff --git a/samples/bpf/test_map_in_map_kern.c b/samples/bpf/test_map_in_map_kern.c
index 32ee752f19df..6cee61e8ce9b 100644
--- a/samples/bpf/test_map_in_map_kern.c
+++ b/samples/bpf/test_map_in_map_kern.c
@@ -10,9 +10,9 @@
#include <linux/version.h>
#include <uapi/linux/bpf.h>
#include <uapi/linux/in6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "bpf_legacy.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_tracing.h>
#define MAX_NR_PORTS 65536
diff --git a/samples/bpf/test_overhead_kprobe_kern.c b/samples/bpf/test_overhead_kprobe_kern.c
index 8d2518e68db9..8b811c29dc79 100644
--- a/samples/bpf/test_overhead_kprobe_kern.c
+++ b/samples/bpf/test_overhead_kprobe_kern.c
@@ -7,8 +7,8 @@
#include <linux/version.h>
#include <linux/ptrace.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
#define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
diff --git a/samples/bpf/test_overhead_raw_tp_kern.c b/samples/bpf/test_overhead_raw_tp_kern.c
index d2af8bc1c805..8763181a32f3 100644
--- a/samples/bpf/test_overhead_raw_tp_kern.c
+++ b/samples/bpf/test_overhead_raw_tp_kern.c
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/* Copyright (c) 2018 Facebook */
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
SEC("raw_tracepoint/task_rename")
int prog(struct bpf_raw_tracepoint_args *ctx)
diff --git a/samples/bpf/test_overhead_tp_kern.c b/samples/bpf/test_overhead_tp_kern.c
index 38f5c0b9da9f..eaa32693f8fc 100644
--- a/samples/bpf/test_overhead_tp_kern.c
+++ b/samples/bpf/test_overhead_tp_kern.c
@@ -5,7 +5,7 @@
* License as published by the Free Software Foundation.
*/
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
struct task_rename {
diff --git a/samples/bpf/test_probe_write_user_kern.c b/samples/bpf/test_probe_write_user_kern.c
index b7c48f37132c..f033f36a13a3 100644
--- a/samples/bpf/test_probe_write_user_kern.c
+++ b/samples/bpf/test_probe_write_user_kern.c
@@ -8,8 +8,8 @@
#include <linux/netdevice.h>
#include <uapi/linux/bpf.h>
#include <linux/version.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct bpf_map_def SEC("maps") dnat_map = {
.type = BPF_MAP_TYPE_HASH,
diff --git a/samples/bpf/trace_event_kern.c b/samples/bpf/trace_event_kern.c
index 8dc18d233a27..da1d69e20645 100644
--- a/samples/bpf/trace_event_kern.c
+++ b/samples/bpf/trace_event_kern.c
@@ -9,8 +9,8 @@
#include <uapi/linux/bpf.h>
#include <uapi/linux/bpf_perf_event.h>
#include <uapi/linux/perf_event.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct key_t {
char comm[TASK_COMM_LEN];
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 749a50f2f9f3..356171bc392b 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -15,7 +15,7 @@
#include <assert.h>
#include <errno.h>
#include <sys/resource.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "perf-sys.h"
#include "trace_helpers.h"
diff --git a/samples/bpf/trace_output_kern.c b/samples/bpf/trace_output_kern.c
index 9b96f4fb8cea..1d7d422cae6f 100644
--- a/samples/bpf/trace_output_kern.c
+++ b/samples/bpf/trace_output_kern.c
@@ -1,7 +1,7 @@
#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
diff --git a/samples/bpf/trace_output_user.c b/samples/bpf/trace_output_user.c
index 8ee47699a870..60a17dd05345 100644
--- a/samples/bpf/trace_output_user.c
+++ b/samples/bpf/trace_output_user.c
@@ -15,7 +15,7 @@
#include <sys/mman.h>
#include <time.h>
#include <signal.h>
-#include <libbpf.h>
+#include <bpf/libbpf.h>
#include "bpf_load.h"
#include "perf-sys.h"
diff --git a/samples/bpf/tracex1_kern.c b/samples/bpf/tracex1_kern.c
index 1a15f6605129..8e2610e14475 100644
--- a/samples/bpf/tracex1_kern.c
+++ b/samples/bpf/tracex1_kern.c
@@ -8,8 +8,8 @@
#include <linux/netdevice.h>
#include <uapi/linux/bpf.h>
#include <linux/version.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
#define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
diff --git a/samples/bpf/tracex2_kern.c b/samples/bpf/tracex2_kern.c
index d70b3ea79ea7..d865bb309bcb 100644
--- a/samples/bpf/tracex2_kern.c
+++ b/samples/bpf/tracex2_kern.c
@@ -8,8 +8,8 @@
#include <linux/netdevice.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_HASH,
diff --git a/samples/bpf/tracex3_kern.c b/samples/bpf/tracex3_kern.c
index 9af546bebfa9..fe21c14feb8d 100644
--- a/samples/bpf/tracex3_kern.c
+++ b/samples/bpf/tracex3_kern.c
@@ -8,8 +8,8 @@
#include <linux/netdevice.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct bpf_map_def SEC("maps") my_map = {
.type = BPF_MAP_TYPE_HASH,
diff --git a/samples/bpf/tracex4_kern.c b/samples/bpf/tracex4_kern.c
index 2a02cbe9d9a1..b1bb9df88f8e 100644
--- a/samples/bpf/tracex4_kern.c
+++ b/samples/bpf/tracex4_kern.c
@@ -7,8 +7,8 @@
#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
struct pair {
u64 val;
diff --git a/samples/bpf/tracex5_kern.c b/samples/bpf/tracex5_kern.c
index b3557b21a8fe..481790fde864 100644
--- a/samples/bpf/tracex5_kern.c
+++ b/samples/bpf/tracex5_kern.c
@@ -10,8 +10,8 @@
#include <uapi/linux/seccomp.h>
#include <uapi/linux/unistd.h>
#include "syscall_nrs.h"
-#include "bpf_helpers.h"
-#include "bpf_tracing.h"
+#include <bpf/bpf_helpers.h>
+#include <bpf/bpf_tracing.h>
#define PROG(F) SEC("kprobe/"__stringify(F)) int bpf_func_##F
diff --git a/samples/bpf/tracex6_kern.c b/samples/bpf/tracex6_kern.c
index 46c557afac73..96c234efa852 100644
--- a/samples/bpf/tracex6_kern.c
+++ b/samples/bpf/tracex6_kern.c
@@ -1,7 +1,7 @@
#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct bpf_map_def SEC("maps") counters = {
.type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
diff --git a/samples/bpf/tracex7_kern.c b/samples/bpf/tracex7_kern.c
index 1ab308a43e0f..c5a92df8ac31 100644
--- a/samples/bpf/tracex7_kern.c
+++ b/samples/bpf/tracex7_kern.c
@@ -1,7 +1,7 @@
#include <uapi/linux/ptrace.h>
#include <uapi/linux/bpf.h>
#include <linux/version.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
SEC("kprobe/open_ctree")
int bpf_prog1(struct pt_regs *ctx)
diff --git a/samples/bpf/xdp1_kern.c b/samples/bpf/xdp1_kern.c
index db6870aee42c..34b64394ed9c 100644
--- a/samples/bpf/xdp1_kern.c
+++ b/samples/bpf/xdp1_kern.c
@@ -12,7 +12,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index 38a8852cb57f..c447ad9e3a1d 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -15,8 +15,8 @@
#include <net/if.h>
#include "bpf_util.h"
-#include "bpf.h"
-#include "libbpf.h"
+#include <bpf/bpf.h>
+#include <bpf/libbpf.h>
static int ifindex;
static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
diff --git a/samples/bpf/xdp2_kern.c b/samples/bpf/xdp2_kern.c
index c74b52c6d945..c787f4b49646 100644
--- a/samples/bpf/xdp2_kern.c
+++ b/samples/bpf/xdp2_kern.c
@@ -12,7 +12,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct {
__uint(type, BPF_MAP_TYPE_PERCPU_ARRAY);
diff --git a/samples/bpf/xdp2skb_meta_kern.c b/samples/bpf/xdp2skb_meta_kern.c
index 0c12048ac79f..9b783316e860 100644
--- a/samples/bpf/xdp2skb_meta_kern.c
+++ b/samples/bpf/xdp2skb_meta_kern.c
@@ -12,7 +12,7 @@
#include <uapi/linux/bpf.h>
#include <uapi/linux/pkt_cls.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
/*
* This struct is stored in the XDP 'data_meta' area, which is located
diff --git a/samples/bpf/xdp_adjust_tail_kern.c b/samples/bpf/xdp_adjust_tail_kern.c
index 0f707e0fb375..ffdd548627f0 100644
--- a/samples/bpf/xdp_adjust_tail_kern.c
+++ b/samples/bpf/xdp_adjust_tail_kern.c
@@ -18,7 +18,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/icmp.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define DEFAULT_TTL 64
#define MAX_PCKT_SIZE 600
diff --git a/samples/bpf/xdp_adjust_tail_user.c b/samples/bpf/xdp_adjust_tail_user.c
index 008789eb6ada..ba482dc3da33 100644
--- a/samples/bpf/xdp_adjust_tail_user.c
+++ b/samples/bpf/xdp_adjust_tail_user.c
@@ -19,8 +19,8 @@
#include <netinet/ether.h>
#include <unistd.h>
#include <time.h>
-#include "bpf.h"
-#include "libbpf.h"
+#include <bpf/bpf.h>
+#include <bpf/libbpf.h>
#define STATS_INTERVAL_S 2U
#define MAX_PCKT_SIZE 600
diff --git a/samples/bpf/xdp_fwd_kern.c b/samples/bpf/xdp_fwd_kern.c
index d013029aeaa2..54c099cbd639 100644
--- a/samples/bpf/xdp_fwd_kern.c
+++ b/samples/bpf/xdp_fwd_kern.c
@@ -19,7 +19,7 @@
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
diff --git a/samples/bpf/xdp_fwd_user.c b/samples/bpf/xdp_fwd_user.c
index c30f9acfdb84..74a4583d0d86 100644
--- a/samples/bpf/xdp_fwd_user.c
+++ b/samples/bpf/xdp_fwd_user.c
@@ -24,7 +24,7 @@
#include <fcntl.h>
#include <libgen.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include <bpf/bpf.h>
static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST;
diff --git a/samples/bpf/xdp_monitor_kern.c b/samples/bpf/xdp_monitor_kern.c
index ad10fe700d7d..59926c59ff4a 100644
--- a/samples/bpf/xdp_monitor_kern.c
+++ b/samples/bpf/xdp_monitor_kern.c
@@ -4,7 +4,7 @@
* XDP monitor tool, based on tracepoints
*/
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct bpf_map_def SEC("maps") redirect_err_cnt = {
.type = BPF_MAP_TYPE_PERCPU_ARRAY,
diff --git a/samples/bpf/xdp_redirect_cpu_kern.c b/samples/bpf/xdp_redirect_cpu_kern.c
index cfcc31e51197..313a8fe6d125 100644
--- a/samples/bpf/xdp_redirect_cpu_kern.c
+++ b/samples/bpf/xdp_redirect_cpu_kern.c
@@ -12,7 +12,7 @@
#include <uapi/linux/udp.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "hash_func01.h"
#define MAX_CPUS 64 /* WARNING - sync with _user.c */
diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c
index 79a2fb7d16cb..15bdf047a222 100644
--- a/samples/bpf/xdp_redirect_cpu_user.c
+++ b/samples/bpf/xdp_redirect_cpu_user.c
@@ -30,7 +30,7 @@ static const char *__doc__ =
#define MAX_PROG 6
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include "bpf_util.h"
diff --git a/samples/bpf/xdp_redirect_kern.c b/samples/bpf/xdp_redirect_kern.c
index 1f0b7d05abb2..d26ec3aa215e 100644
--- a/samples/bpf/xdp_redirect_kern.c
+++ b/samples/bpf/xdp_redirect_kern.c
@@ -17,7 +17,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
diff --git a/samples/bpf/xdp_redirect_map_kern.c b/samples/bpf/xdp_redirect_map_kern.c
index 4631b484c432..6489352ab7a4 100644
--- a/samples/bpf/xdp_redirect_map_kern.c
+++ b/samples/bpf/xdp_redirect_map_kern.c
@@ -17,7 +17,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
struct {
__uint(type, BPF_MAP_TYPE_DEVMAP);
diff --git a/samples/bpf/xdp_redirect_map_user.c b/samples/bpf/xdp_redirect_map_user.c
index cc840661faab..35e16dee613e 100644
--- a/samples/bpf/xdp_redirect_map_user.c
+++ b/samples/bpf/xdp_redirect_map_user.c
@@ -17,7 +17,7 @@
#include "bpf_util.h"
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
static int ifindex_in;
static int ifindex_out;
diff --git a/samples/bpf/xdp_redirect_user.c b/samples/bpf/xdp_redirect_user.c
index 71dff8e3382a..9ca2bf457cda 100644
--- a/samples/bpf/xdp_redirect_user.c
+++ b/samples/bpf/xdp_redirect_user.c
@@ -17,7 +17,7 @@
#include "bpf_util.h"
#include <bpf/bpf.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
static int ifindex_in;
static int ifindex_out;
diff --git a/samples/bpf/xdp_router_ipv4_kern.c b/samples/bpf/xdp_router_ipv4_kern.c
index bf11efc8e949..b37ca2b13063 100644
--- a/samples/bpf/xdp_router_ipv4_kern.c
+++ b/samples/bpf/xdp_router_ipv4_kern.c
@@ -12,7 +12,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include <linux/slab.h>
#include <net/ip_fib.h>
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c
index fef286c5add2..c2da1b51ff95 100644
--- a/samples/bpf/xdp_router_ipv4_user.c
+++ b/samples/bpf/xdp_router_ipv4_user.c
@@ -21,7 +21,7 @@
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include "bpf_util.h"
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include <sys/resource.h>
#include <libgen.h>
diff --git a/samples/bpf/xdp_rxq_info_kern.c b/samples/bpf/xdp_rxq_info_kern.c
index 272d0f82a6b5..5e7459f9bf3e 100644
--- a/samples/bpf/xdp_rxq_info_kern.c
+++ b/samples/bpf/xdp_rxq_info_kern.c
@@ -6,7 +6,7 @@
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_ether.h>
#include <uapi/linux/in.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
/* Config setup from with userspace
*
diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
index fc4983fd6959..4fe47502ebed 100644
--- a/samples/bpf/xdp_rxq_info_user.c
+++ b/samples/bpf/xdp_rxq_info_user.c
@@ -22,8 +22,8 @@ static const char *__doc__ = " XDP RX-queue info extract example\n\n"
#include <arpa/inet.h>
#include <linux/if_link.h>
-#include "bpf.h"
-#include "libbpf.h"
+#include <bpf/bpf.h>
+#include <bpf/libbpf.h>
#include "bpf_util.h"
static int ifindex = -1;
diff --git a/samples/bpf/xdp_sample_pkts_kern.c b/samples/bpf/xdp_sample_pkts_kern.c
index 6c7c7e0aaeda..33377289e2a8 100644
--- a/samples/bpf/xdp_sample_pkts_kern.c
+++ b/samples/bpf/xdp_sample_pkts_kern.c
@@ -2,7 +2,7 @@
#include <linux/ptrace.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#define SAMPLE_SIZE 64ul
#define MAX_CPUS 128
diff --git a/samples/bpf/xdp_sample_pkts_user.c b/samples/bpf/xdp_sample_pkts_user.c
index 8c1af1b7372d..991ef6f0880b 100644
--- a/samples/bpf/xdp_sample_pkts_user.c
+++ b/samples/bpf/xdp_sample_pkts_user.c
@@ -10,7 +10,7 @@
#include <sys/sysinfo.h>
#include <sys/ioctl.h>
#include <signal.h>
-#include <libbpf.h>
+#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include <sys/resource.h>
#include <libgen.h>
diff --git a/samples/bpf/xdp_tx_iptunnel_kern.c b/samples/bpf/xdp_tx_iptunnel_kern.c
index 6db450a5c1ca..575d57e4b8d6 100644
--- a/samples/bpf/xdp_tx_iptunnel_kern.c
+++ b/samples/bpf/xdp_tx_iptunnel_kern.c
@@ -16,7 +16,7 @@
#include <linux/if_vlan.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "xdp_tx_iptunnel_common.h"
struct {
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
index 5f33b5530032..a419bee151a8 100644
--- a/samples/bpf/xdp_tx_iptunnel_user.c
+++ b/samples/bpf/xdp_tx_iptunnel_user.c
@@ -15,7 +15,7 @@
#include <netinet/ether.h>
#include <unistd.h>
#include <time.h>
-#include "libbpf.h"
+#include <bpf/libbpf.h>
#include <bpf/bpf.h>
#include "bpf_util.h"
#include "xdp_tx_iptunnel_common.h"
diff --git a/samples/bpf/xdpsock_kern.c b/samples/bpf/xdpsock_kern.c
index a06177c262cd..05430484375c 100644
--- a/samples/bpf/xdpsock_kern.c
+++ b/samples/bpf/xdpsock_kern.c
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bpf.h>
-#include "bpf_helpers.h"
+#include <bpf/bpf_helpers.h>
#include "xdpsock.h"
/* This XDP program is only needed for the XDP_SHARED_UMEM mode.
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index d74c4c83fc93..0b5acd722306 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -30,10 +30,10 @@
#include <time.h>
#include <unistd.h>
-#include "libbpf.h"
-#include "xsk.h"
-#include "xdpsock.h"
+#include <bpf/libbpf.h>
+#include <bpf/xsk.h>
#include <bpf/bpf.h>
+#include "xdpsock.h"
#ifndef SOL_XDP
#define SOL_XDP 283
On Wed, 15 Jan 2020 15:12:56 +0100
Toke Høiland-Jørgensen <[email protected]> wrote:
> From: Toke Høiland-Jørgensen <[email protected]>
>
> Fix all files in samples/bpf to include libbpf header files with the bpf/
> prefix, to be consistent with external users of the library. Also ensure
> that all includes of exported libbpf header files (those that are exported
> on 'make install' of the library) use bracketed includes instead of quoted.
>
> To make sure no new files are introduced that doesn't include the bpf/
> prefix in its include, remove tools/lib/bpf from the include path entirely,
> and use tools/lib instead.
>
> Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
> Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
I like this change. Maybe the reason so many samples/bpf/ files
still included "libbpf.h" was that once-upon-a-time we had a "eBPF mini
library" in the file samples/bpf/libbpf.h that were included.
The file was removed/renamed in:
https://git.kernel.org/torvalds/c/8d93045077ae
Acked-by: Jesper Dangaard Brouer <[email protected]>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
On Wed, 15 Jan 2020 15:12:49 +0100
Toke Høiland-Jørgensen <[email protected]> wrote:
> From: Toke Høiland-Jørgensen <[email protected]>
>
> The 'clean' rule in the samples/bpf Makefile tries to remove backup
> files (ending in ~). However, if no such files exist, it will instead try
> to remove the user's home directory. While the attempt is mostly harmless,
> it does lead to a somewhat scary warning like this:
>
> rm: cannot remove '~': Is a directory
>
> Fix this by using find instead of shell expansion to locate any actual
> backup files that need to be removed.
>
> Fixes: b62a796c109c ("samples/bpf: allow make to be run from samples/bpf/ directory")
> Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
Kind of scary make clean command!
Acked-by: Jesper Dangaard Brouer <[email protected]>
> ---
> samples/bpf/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
> index 5b89c0370f33..f86d713a17a5 100644
> --- a/samples/bpf/Makefile
> +++ b/samples/bpf/Makefile
> @@ -254,7 +254,7 @@ all:
>
> clean:
> $(MAKE) -C ../../ M=$(CURDIR) clean
> - @rm -f *~
> + @find $(CURDIR) -type f -name '*~' -delete
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
Jesper Dangaard Brouer <[email protected]> writes:
> On Wed, 15 Jan 2020 15:12:56 +0100
> Toke Høiland-Jørgensen <[email protected]> wrote:
>
>> From: Toke Høiland-Jørgensen <[email protected]>
>>
>> Fix all files in samples/bpf to include libbpf header files with the bpf/
>> prefix, to be consistent with external users of the library. Also ensure
>> that all includes of exported libbpf header files (those that are exported
>> on 'make install' of the library) use bracketed includes instead of quoted.
>>
>> To make sure no new files are introduced that doesn't include the bpf/
>> prefix in its include, remove tools/lib/bpf from the include path entirely,
>> and use tools/lib instead.
>>
>> Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
>> Signed-off-by: Toke Høiland-Jørgensen <[email protected]>
>
> I like this change. Maybe the reason so many samples/bpf/ files
> still included "libbpf.h" was that once-upon-a-time we had a "eBPF mini
> library" in the file samples/bpf/libbpf.h that were included.
Yes, I think something similar is the case with bpf_helpers.h - that
used to be outside libbpf, and I guess no one bothered to do a cleanup
such as this one when it was moved...
-Toke
On Wed, Jan 15, 2020 at 6:13 AM Toke Høiland-Jørgensen <[email protected]> wrote:
>
> The recent commit 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are
> taken from selftests dir") broke compilation against libbpf if it is installed
> on the system, and $INCLUDEDIR/bpf is not in the include path.
>
> Since having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
> requirement for building against libbpf before, this needs to be fixed. One
> option is to just revert the offending commit and figure out a different way to
> achieve what it aims for. However, this series takes a different approach:
> Changing all in-tree users of libbpf to consistently use a bpf/ prefix in
> #include directives for header files from libbpf.
>
> This turns out to be a somewhat invasive change in the number of files touched;
> however, the actual changes to files are fairly trivial (most of them are simply
> made with 'sed'). Also, this approach has the advantage that it makes external
> and internal users consistent with each other, and ensures no future changes
> breaks things in the same way as the commit referenced above.
>
> The series is split to make the change for one tool subdir at a time, while
> trying not to break the build along the way. It is structured like this:
>
> - Patch 1-2: Trivial fixes to Makefiles for issues I discovered while changing
> the include paths.
>
> - Patch 3-7: Change the include directives to use the bpf/ prefix, and updates
> Makefiles to make sure tools/lib/ is part of the include path, but without
> removing tools/lib/bpf
>
> - Patch 8: Change the bpf_helpers file in libbpf itself to use the bpf/ prefix
> when including (the original source of breakage).
>
> - Patch 9-10: Remove tools/lib/bpf from include paths to make sure we don't
> inadvertently re-introduce includes without the bpf/ prefix.
>
> ---
Thanks, Toke, for this clean up! I tested it locally for my set up:
runqslower, bpftool, libbpf, and selftests all build fine, so it looks
good. My only concern is with selftests/bpf Makefile, we shouldn't
build anything outside of selftests/bpf. Let's fix that. Thanks!
>
> Toke Høiland-Jørgensen (10):
> samples/bpf: Don't try to remove user's homedir on clean
> tools/bpf/runqslower: Fix override option for VMLINUX_BTF
> tools/runqslower: Use consistent include paths for libbpf
> selftests: Use consistent include paths for libbpf
> bpftool: Use consistent include paths for libbpf
> perf: Use consistent include paths for libbpf
> samples/bpf: Use consistent include paths for libbpf
> libbpf: Fix include of bpf_helpers.h when libbpf is installed on system
> selftests: Remove tools/lib/bpf from include path
> tools/runqslower: Remove tools/lib/bpf from include path
>
>
[...]
On Wed, Jan 15, 2020 at 03:12:48PM +0100, Toke H?iland-J?rgensen wrote:
> The recent commit 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are
> taken from selftests dir") broke compilation against libbpf if it is installed
> on the system, and $INCLUDEDIR/bpf is not in the include path.
>
> Since having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
> requirement for building against libbpf before, this needs to be fixed. One
> option is to just revert the offending commit and figure out a different way to
> achieve what it aims for. However, this series takes a different approach:
> Changing all in-tree users of libbpf to consistently use a bpf/ prefix in
> #include directives for header files from libbpf.
I don't think such approach will work in all cases.
Consider the user installing libbpf headers into /home/somebody/include/bpf/,
passing that path to -I and trying to build bpf progs
that do #include "bpf_helpers.h"...
In the current shape of libbpf everything will compile fine,
but after patch 8 of this series the compiler will not find bpf/bpf_helper_defs.h.
So I think we have no choice, but to revert that part of Andrii's patch.
Note that doing #include "" for additional library headers is a common practice.
There was nothing wrong about #include "bpf_helper_defs.h" in bpf_helpers.h.
Alexei Starovoitov <[email protected]> writes:
> On Wed, Jan 15, 2020 at 03:12:48PM +0100, Toke Høiland-Jørgensen wrote:
>> The recent commit 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are
>> taken from selftests dir") broke compilation against libbpf if it is installed
>> on the system, and $INCLUDEDIR/bpf is not in the include path.
>>
>> Since having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
>> requirement for building against libbpf before, this needs to be fixed. One
>> option is to just revert the offending commit and figure out a different way to
>> achieve what it aims for. However, this series takes a different approach:
>> Changing all in-tree users of libbpf to consistently use a bpf/ prefix in
>> #include directives for header files from libbpf.
>
> I don't think such approach will work in all cases.
> Consider the user installing libbpf headers into /home/somebody/include/bpf/,
> passing that path to -I and trying to build bpf progs
> that do #include "bpf_helpers.h"...
> In the current shape of libbpf everything will compile fine,
> but after patch 8 of this series the compiler will not find bpf/bpf_helper_defs.h.
> So I think we have no choice, but to revert that part of Andrii's patch.
> Note that doing #include "" for additional library headers is a common practice.
> There was nothing wrong about #include "bpf_helper_defs.h" in bpf_helpers.h.
OK, I'll take another look at that bit and see if I can get it to work
with #include "bpf_helper_defs.h" and still function with the read-only
tree (and avoid stale headers).
-Toke
Andrii Nakryiko <[email protected]> writes:
> On Wed, Jan 15, 2020 at 6:13 AM Toke Høiland-Jørgensen <[email protected]> wrote:
>>
>> The recent commit 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are
>> taken from selftests dir") broke compilation against libbpf if it is installed
>> on the system, and $INCLUDEDIR/bpf is not in the include path.
>>
>> Since having the bpf/ subdir of $INCLUDEDIR in the include path has never been a
>> requirement for building against libbpf before, this needs to be fixed. One
>> option is to just revert the offending commit and figure out a different way to
>> achieve what it aims for. However, this series takes a different approach:
>> Changing all in-tree users of libbpf to consistently use a bpf/ prefix in
>> #include directives for header files from libbpf.
>>
>> This turns out to be a somewhat invasive change in the number of files touched;
>> however, the actual changes to files are fairly trivial (most of them are simply
>> made with 'sed'). Also, this approach has the advantage that it makes external
>> and internal users consistent with each other, and ensures no future changes
>> breaks things in the same way as the commit referenced above.
>>
>> The series is split to make the change for one tool subdir at a time, while
>> trying not to break the build along the way. It is structured like this:
>>
>> - Patch 1-2: Trivial fixes to Makefiles for issues I discovered while changing
>> the include paths.
>>
>> - Patch 3-7: Change the include directives to use the bpf/ prefix, and updates
>> Makefiles to make sure tools/lib/ is part of the include path, but without
>> removing tools/lib/bpf
>>
>> - Patch 8: Change the bpf_helpers file in libbpf itself to use the bpf/ prefix
>> when including (the original source of breakage).
>>
>> - Patch 9-10: Remove tools/lib/bpf from include paths to make sure we don't
>> inadvertently re-introduce includes without the bpf/ prefix.
>>
>> ---
>
> Thanks, Toke, for this clean up! I tested it locally for my set up:
> runqslower, bpftool, libbpf, and selftests all build fine, so it looks
> good. My only concern is with selftests/bpf Makefile, we shouldn't
> build anything outside of selftests/bpf. Let's fix that. Thanks!
Great, thanks for testing! I'll fix up your comments (and Alexei's) and
submit another version tomorrow.
-Toke