OSDN Git Service

libbpf: Add BPF_EMBED_OBJ macro for embedding BPF .o files
authorAndrii Nakryiko <andriin@fb.com>
Sat, 14 Dec 2019 01:43:28 +0000 (17:43 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 15 Dec 2019 23:58:04 +0000 (15:58 -0800)
commit917f6b7b07a46e53fa73e112d23c97d1b201a877
tree75e7c2bb4a79b1849b9cb2fe1d4f93bbb9ca9562
parent612d05be250aa8804d3baba7a12445a267a580d3
libbpf: Add BPF_EMBED_OBJ macro for embedding BPF .o files

Add a convenience macro BPF_EMBED_OBJ, which allows to embed other files
(typically used to embed BPF .o files) into a hosting userspace programs. To
C program it is exposed as struct bpf_embed_data, containing a pointer to
raw data and its size in bytes.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20191214014341.3442258-5-andriin@fb.com
tools/lib/bpf/libbpf.h
tools/testing/selftests/bpf/prog_tests/attach_probe.c