samples/bpf: Use vmlinux.h instead of implicit headers in syscall tracing program
authorDaniel T. Lee <danieltimlee@gmail.com>
Sat, 24 Dec 2022 07:15:23 +0000 (16:15 +0900)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 29 Dec 2022 22:22:34 +0000 (14:22 -0800)
This commit applies vmlinux.h to syscall tracing program. This change
allows the bpf program to refer to the internal structure as a single
"vmlinux.h" instead of including each header referenced by the bpf
program.

Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20221224071527.2292-3-danieltimlee@gmail.com
samples/bpf/map_perf_test_kern.c
samples/bpf/test_current_task_under_cgroup_kern.c
samples/bpf/test_probe_write_user_kern.c
samples/bpf/trace_output_kern.c
samples/bpf/tracex2_kern.c

index 874e2f7e3d5d5aa26ab153bb719b03c029c3ad91..0c7885057ffeef009dc80cc8ce7f4e8a5fc0e869 100644 (file)
@@ -4,10 +4,9 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
+#include "vmlinux.h"
+#include <errno.h>
 #include <linux/version.h>
-#include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>
 #include <bpf/bpf_core_read.h>
index 541fc861b9845ea5301d65edacbef0c6659ce35b..0b059cee3cbaf563fc028bf662f91a75d1d43b96 100644 (file)
@@ -5,11 +5,9 @@
  * License as published by the Free Software Foundation.
  */
 
-#include <linux/ptrace.h>
-#include <uapi/linux/bpf.h>
+#include "vmlinux.h"
 #include <linux/version.h>
 #include <bpf/bpf_helpers.h>
-#include <uapi/linux/utsname.h>
 
 struct {
        __uint(type, BPF_MAP_TYPE_CGROUP_ARRAY);
index d60cabaaf7530883b9467ec7390964eb71133c43..a0f10c5ca273dadfb92b75cb431444b10f6234a7 100644 (file)
@@ -4,9 +4,8 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-#include <uapi/linux/bpf.h>
+#include "vmlinux.h"
+#include <string.h>
 #include <linux/version.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>
index a481abf8c4c5011b06590502a9a4f0f7c03613fb..565a73b51b04a0e05cdca9fe6787b686e75df85a 100644 (file)
@@ -1,6 +1,5 @@
-#include <linux/ptrace.h>
+#include "vmlinux.h"
 #include <linux/version.h>
-#include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 
 struct {
index 82091facb83cba38bfb031823f0f5181fbd0b7a9..a712eefc742eabaa0a70874117a10a4403dc2031 100644 (file)
@@ -4,10 +4,8 @@
  * modify it under the terms of version 2 of the GNU General Public
  * License as published by the Free Software Foundation.
  */
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
+#include "vmlinux.h"
 #include <linux/version.h>
-#include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 #include <bpf/bpf_tracing.h>