Skip to content

Commit

Permalink
Rename SYSCALL and TRACEPOINT to avoid conflicts
Browse files Browse the repository at this point in the history
Signed-off-by: Afsan Hossain <[email protected]>
  • Loading branch information
mdafsanhossain committed Nov 9, 2023
1 parent 9020772 commit dad8c01
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
9 changes: 3 additions & 6 deletions driver/modern_bpf/helpers/interfaces/attached_programs.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
/* This enum is used to tell if we are considering a syscall or a tracepoint */
enum intrumentation_type
{
//SYSCALL definition is skipped on powerpc since SYSCALL is already defined in vmlinux.h
#ifndef __TARGET_ARCH_powerpc
SYSCALL = 0,
#endif
TRACEPOINT = 1,
MODERN_BPF_SYSCALL = 0,
MODERN_BPF_TRACEPOINT = 1,
};

/* The sampling logic is used by all BPF programs attached to the kernel.
Expand All @@ -40,7 +37,7 @@ static __always_inline bool sampling_logic(void* ctx, u32 id, enum intrumentatio
/* If we have a syscall we use the sampling_syscall_table otherwise
* with tracepoints we use the sampling_tracepoint_table.
*/
if(type == SYSCALL)
if(type == MODERN_BPF_SYSCALL)
{
sampling_flag = maps__64bit_sampling_syscall_table(id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int BPF_PROG(sys_enter,
return 0;
}

if(sampling_logic(ctx, syscall_id, SYSCALL))
if(sampling_logic(ctx, syscall_id, MODERN_BPF_SYSCALL))
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int BPF_PROG(sys_exit,
return 0;
}

if(sampling_logic(ctx, syscall_id, SYSCALL))
if(sampling_logic(ctx, syscall_id, MODERN_BPF_SYSCALL))
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int BPF_PROG(pf_kernel,
unsigned long address, struct pt_regs *regs,
unsigned long error_code)
{
if(sampling_logic(ctx, PPME_PAGE_FAULT_E, TRACEPOINT))
if(sampling_logic(ctx, PPME_PAGE_FAULT_E, MODERN_BPF_TRACEPOINT))
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int BPF_PROG(pf_user,
unsigned long address, struct pt_regs *regs,
unsigned long error_code)
{
if(sampling_logic(ctx, PPME_PAGE_FAULT_E, TRACEPOINT))
if(sampling_logic(ctx, PPME_PAGE_FAULT_E, MODERN_BPF_TRACEPOINT))
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int BPF_PROG(sched_switch,
bool preempt, struct task_struct *prev,
struct task_struct *next)
{
if(sampling_logic(ctx, PPME_SCHEDSWITCH_6_E, TRACEPOINT))
if(sampling_logic(ctx, PPME_SCHEDSWITCH_6_E, MODERN_BPF_TRACEPOINT))
{
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SEC("tp_btf/signal_deliver")
int BPF_PROG(signal_deliver,
int sig, struct kernel_siginfo *info, struct k_sigaction *ka)
{
if(sampling_logic(ctx, PPME_SIGNALDELIVER_E, TRACEPOINT))
if(sampling_logic(ctx, PPME_SIGNALDELIVER_E, MODERN_BPF_TRACEPOINT))
{
return 0;
}
Expand Down

0 comments on commit dad8c01

Please sign in to comment.