]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
bpf: Include linux/types.h for u32
authorDmitrii Bundin <dmitrii.bundin.a@gmail.com>
Sat, 20 Apr 2024 04:24:57 +0000 (07:24 +0300)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 29 Apr 2024 23:28:07 +0000 (16:28 -0700)
Inclusion of the header linux/btf_ids.h relies on indirect inclusion of
the header linux/types.h. Including it directly on the top level helps
to avoid potential problems if linux/types.h hasn't been included
before.

The main motivation to introduce this it is to avoid similar problems that
have shown up in the bpftool where GNU libc indirectly pulls
linux/types.h causing compile error of the form:

   error: unknown type name 'u32'
                             u32 cnt;
                             ^~~

The bpftool compile error was fixed in
62248b22d01e ("tools/resolve_btfids: fix build with musl libc").

Signed-off-by: Dmitrii Bundin <dmitrii.bundin.a@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240420042457.3198883-1-dmitrii.bundin.a@gmail.com
include/linux/btf_ids.h

index e24aabfe8ecc91fae3a814eccade54b366016bc1..c0e3e1426a82f5c4846b5df0ffb6522c1f823ee5 100644 (file)
@@ -3,6 +3,8 @@
 #ifndef _LINUX_BTF_IDS_H
 #define _LINUX_BTF_IDS_H
 
+#include <linux/types.h> /* for u32 */
+
 struct btf_id_set {
        u32 cnt;
        u32 ids[];