netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libbpf: Make bpf/bpf_helpers.h self-contained
@ 2020-04-07  6:28 Yoshiki Komachi
  2020-04-07  6:52 ` Andrii Nakryiko
  2020-04-17  3:35 ` [libbpf] 41862faccd: kernel-selftests.bpf.make_fail kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Yoshiki Komachi @ 2020-04-07  6:28 UTC (permalink / raw)
  To: David S. Miller, Alexei Starovoitov, Daniel Borkmann,
	Martin KaFai Lau, Song Liu, Yonghong Song, Andrii Nakryiko
  Cc: Yoshiki Komachi, netdev, bpf

I tried to compile a bpf program including bpf_helpers.h, however it
resulted in failure as below:

  # clang -I./linux/tools/lib/ -I/lib/modules/$(uname -r)/build/include/ \
    -O2 -Wall -target bpf -emit-llvm -c bpf_prog.c -o bpf_prog.bc
  ...
  In file included from linux/tools/lib/bpf/bpf_helpers.h:5:
  linux/tools/lib/bpf/bpf_helper_defs.h:56:82: error: unknown type name '__u64'
  ...

This is because bpf_helpers.h depends on linux/types.h and it is not
self-contained. This has been like this long time, but since bpf_helpers.h
was moved from selftests private file to libbpf header file, IMO it 
should include linux/types.h by itself.

Fixes: e01a75c15969 ("libbpf: Move bpf_{helpers, helper_defs, endian, tracing}.h into libbpf")
Signed-off-by: Yoshiki Komachi <komachi.yoshiki@gmail.com>
---
 tools/lib/bpf/bpf_helpers.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/bpf_helpers.h b/tools/lib/bpf/bpf_helpers.h
index f69cc208778a..d9288e695eb1 100644
--- a/tools/lib/bpf/bpf_helpers.h
+++ b/tools/lib/bpf/bpf_helpers.h
@@ -2,6 +2,7 @@
 #ifndef __BPF_HELPERS__
 #define __BPF_HELPERS__
 
+#include <linux/types.h>
 #include "bpf_helper_defs.h"
 
 #define __uint(name, val) int (*name)[val]
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-17  3:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-07  6:28 [PATCH] libbpf: Make bpf/bpf_helpers.h self-contained Yoshiki Komachi
2020-04-07  6:52 ` Andrii Nakryiko
2020-04-09  5:31   ` Yoshiki Komachi
2020-04-09 18:12     ` Andrii Nakryiko
2020-04-17  3:35 ` [libbpf] 41862faccd: kernel-selftests.bpf.make_fail kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).