Skip to content

Commit

Permalink
chore(driver/bpf): move BPF_PROBE macro definitions to types.h.
Browse files Browse the repository at this point in the history
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
  • Loading branch information
FedeDP authored and poiana committed Mar 11, 2024
1 parent 6dc6516 commit 03f027a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
15 changes: 0 additions & 15 deletions driver/bpf/configure/RSS_STAT_ARRAY/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,12 @@ or GPL2.txt for full copies of the license.
*/

#include "../../quirks.h"

#include <uapi/linux/bpf.h>

#include "../../ppm_events_public.h"
#include "../../bpf_helpers.h"
#include "../../types.h"
#include "../../maps.h"

// struct mm_struct declaration
#include <linux/mm_types.h>

#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME #event) \
int bpf_##event(struct type *ctx)
#else
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME prefix #event) \
int bpf_##event(struct type *ctx)
#endif

BPF_PROBE("signal/", signal_deliver, signal_deliver_args)
{
long val;
Expand Down
10 changes: 0 additions & 10 deletions driver/bpf/probe.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,6 @@ or GPL2.txt for full copies of the license.
#include "fillers.h"
#include "builtins.h"

#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME #event) \
int bpf_##event(struct type *ctx)
#else
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME prefix #event) \
int bpf_##event(struct type *ctx)
#endif

#define __NR_ia32_socketcall 102

BPF_PROBE("raw_syscalls/", sys_enter, sys_enter_args)
Expand Down
10 changes: 10 additions & 0 deletions driver/bpf/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ or GPL2.txt for full copies of the license.
#define TP_NAME "tracepoint/"
#endif

#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME #event) \
int bpf_##event(struct type *ctx)
#else
#define BPF_PROBE(prefix, event, type) \
__bpf_section(TP_NAME prefix #event) \
int bpf_##event(struct type *ctx)
#endif

#ifdef BPF_SUPPORTS_RAW_TRACEPOINTS
struct sys_enter_args {
unsigned long regs;
Expand Down

0 comments on commit 03f027a

Please sign in to comment.