Skip to content

Commit

Permalink
examples: include bpf_helpers.h from common.h
Browse files Browse the repository at this point in the history
Since bpf_helpers.h includes bpf_helper_defs.h, which depends on certain
types like __u64 being defined, work with a single common.h include in
examples to make sure this is all set up properly.

This ensures any future vendor updates to bpf_*.h continue to function.

Signed-off-by: Timo Beckers <[email protected]>
  • Loading branch information
ti-mo committed Mar 30, 2022
1 parent a4ccb18 commit e0ada27
Show file tree
Hide file tree
Showing 19 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/cgroup_skb/cgroup_skb.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build ignore

#include "bpf_helpers.h"
#include "common.h"

char __license[] SEC("license") = "Dual MIT/GPL";

Expand Down
Binary file modified examples/fentry/bpf_bpfeb.o
Binary file not shown.
Binary file modified examples/fentry/bpf_bpfel.o
Binary file not shown.
1 change: 0 additions & 1 deletion examples/fentry/fentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "common.h"

#include "bpf_endian.h"
#include "bpf_helpers.h"
#include "bpf_tracing.h"

#define AF_INET 2
Expand Down
1 change: 0 additions & 1 deletion examples/headers/bpf_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* in advance since bpf_helper_defs.h uses such types
* as __u64.
*/
#include "common.h"
#include "bpf_helper_defs.h"

#define __uint(name, val) int (*name)[val]
Expand Down
2 changes: 2 additions & 0 deletions examples/headers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ typedef __u32 __be32;
typedef __u64 __be64;
typedef __u32 __wsum;

#include "bpf_helpers.h"

enum bpf_map_type {
BPF_MAP_TYPE_UNSPEC = 0,
BPF_MAP_TYPE_HASH = 1,
Expand Down
2 changes: 1 addition & 1 deletion examples/kprobe/kprobe.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build ignore

#include "bpf_helpers.h"
#include "common.h"

char __license[] SEC("license") = "Dual MIT/GPL";

Expand Down
Binary file modified examples/kprobe_percpu/bpf_bpfeb.o
Binary file not shown.
Binary file modified examples/kprobe_percpu/bpf_bpfel.o
Binary file not shown.
2 changes: 0 additions & 2 deletions examples/kprobe_percpu/kprobe_percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "common.h"

#include "bpf_helpers.h"

char __license[] SEC("license") = "Dual MIT/GPL";

struct bpf_map_def SEC("maps") kprobe_map = {
Expand Down
2 changes: 1 addition & 1 deletion examples/kprobepin/kprobe_pin.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// +build ignore

#include "bpf_helpers.h"
#include "common.h"

char __license[] SEC("license") = "Dual MIT/GPL";

Expand Down
Binary file modified examples/ringbuffer/bpf_bpfeb.o
Binary file not shown.
Binary file modified examples/ringbuffer/bpf_bpfel.o
Binary file not shown.
2 changes: 0 additions & 2 deletions examples/ringbuffer/ringbuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "common.h"

#include "bpf_helpers.h"

char __license[] SEC("license") = "Dual MIT/GPL";

struct event {
Expand Down
Binary file modified examples/tracepoint_in_c/bpf_bpfeb.o
Binary file not shown.
Binary file modified examples/tracepoint_in_c/bpf_bpfel.o
Binary file not shown.
2 changes: 0 additions & 2 deletions examples/tracepoint_in_c/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "common.h"

#include "bpf_helpers.h"

char __license[] SEC("license") = "Dual MIT/GPL";

struct bpf_map_def SEC("maps") counting_map = {
Expand Down
Binary file modified examples/uretprobe/bpf_bpfel_x86.o
Binary file not shown.
1 change: 0 additions & 1 deletion examples/uretprobe/uretprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "common.h"

#include "bpf_helpers.h"
#include "bpf_tracing.h"

char __license[] SEC("license") = "Dual MIT/GPL";
Expand Down

0 comments on commit e0ada27

Please sign in to comment.