libbpf: Add BPF_CORE_READ/BPF_CORE_READ_INTO helpers
authorAndrii Nakryiko <andriin@fb.com>
Tue, 8 Oct 2019 17:59:41 +0000 (10:59 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 8 Oct 2019 21:16:03 +0000 (23:16 +0200)
commit7db3822ab99157e16c41caa5e7d788834d5a3c7c
treeefa28d61256bd444894a495495ca22c0787dff0f
parente01a75c159691714607b8a22daa2ba7be275dd01
libbpf: Add BPF_CORE_READ/BPF_CORE_READ_INTO helpers

Add few macros simplifying BCC-like multi-level probe reads, while also
emitting CO-RE relocations for each read.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20191008175942.1769476-7-andriin@fb.com
12 files changed:
tools/lib/bpf/Makefile
tools/lib/bpf/bpf_core_read.h [new file with mode: 0644]
tools/lib/bpf/bpf_helpers.h
tools/testing/selftests/bpf/progs/test_core_reloc_arrays.c
tools/testing/selftests/bpf/progs/test_core_reloc_flavors.c
tools/testing/selftests/bpf/progs/test_core_reloc_ints.c
tools/testing/selftests/bpf/progs/test_core_reloc_kernel.c
tools/testing/selftests/bpf/progs/test_core_reloc_misc.c
tools/testing/selftests/bpf/progs/test_core_reloc_mods.c
tools/testing/selftests/bpf/progs/test_core_reloc_nesting.c
tools/testing/selftests/bpf/progs/test_core_reloc_primitives.c
tools/testing/selftests/bpf/progs/test_core_reloc_ptr_as_arr.c