Skip to content

Commit 3ac4dbe

Browse files
anakryikoborkmann
authored andcommitted
selftests/bpf: Split off tracing-only helpers into bpf_tracing.h
Split-off PT_REGS-related helpers into bpf_tracing.h header. Adjust selftests and samples to include it where necessary. 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-5-andriin@fb.com
1 parent 694731e commit 3ac4dbe

18 files changed

Lines changed: 211 additions & 190 deletions

‎samples/bpf/map_perf_test_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <uapi/linux/bpf.h>
1111
#include "bpf_helpers.h"
1212
#include "bpf_legacy.h"
13+
#include "bpf_tracing.h"
1314

1415
#define MAX_ENTRIES 1000
1516
#define MAX_NR_CPUS 1024

‎samples/bpf/offwaketime_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
#include <uapi/linux/bpf.h>
88
#include "bpf_helpers.h"
9+
#include "bpf_tracing.h"
910
#include <uapi/linux/ptrace.h>
1011
#include <uapi/linux/perf_event.h>
1112
#include <linux/version.h>

‎samples/bpf/sampleip_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <uapi/linux/bpf.h>
1010
#include <uapi/linux/bpf_perf_event.h>
1111
#include "bpf_helpers.h"
12+
#include "bpf_tracing.h"
1213

1314
#define MAX_IPS 8192
1415

‎samples/bpf/spintest_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <uapi/linux/bpf.h>
1111
#include <uapi/linux/perf_event.h>
1212
#include "bpf_helpers.h"
13+
#include "bpf_tracing.h"
1314

1415
struct bpf_map_def SEC("maps") my_map = {
1516
.type = BPF_MAP_TYPE_HASH,

‎samples/bpf/test_map_in_map_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <uapi/linux/in6.h>
1313
#include "bpf_helpers.h"
1414
#include "bpf_legacy.h"
15+
#include "bpf_tracing.h"
1516

1617
#define MAX_NR_PORTS 65536
1718

‎samples/bpf/test_overhead_kprobe_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/ptrace.h>
99
#include <uapi/linux/bpf.h>
1010
#include "bpf_helpers.h"
11+
#include "bpf_tracing.h"
1112

1213
#define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
1314

‎samples/bpf/test_probe_write_user_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <uapi/linux/bpf.h>
1010
#include <linux/version.h>
1111
#include "bpf_helpers.h"
12+
#include "bpf_tracing.h"
1213

1314
struct bpf_map_def SEC("maps") dnat_map = {
1415
.type = BPF_MAP_TYPE_HASH,

‎samples/bpf/trace_event_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <uapi/linux/bpf_perf_event.h>
1111
#include <uapi/linux/perf_event.h>
1212
#include "bpf_helpers.h"
13+
#include "bpf_tracing.h"
1314

1415
struct key_t {
1516
char comm[TASK_COMM_LEN];

‎samples/bpf/tracex1_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <uapi/linux/bpf.h>
1010
#include <linux/version.h>
1111
#include "bpf_helpers.h"
12+
#include "bpf_tracing.h"
1213

1314
#define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
1415

‎samples/bpf/tracex2_kern.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/version.h>
1010
#include <uapi/linux/bpf.h>
1111
#include "bpf_helpers.h"
12+
#include "bpf_tracing.h"
1213

1314
struct bpf_map_def SEC("maps") my_map = {
1415
.type = BPF_MAP_TYPE_HASH,

0 commit comments

Comments
 (0)