Skip to content

Commit

Permalink
bpf: run clang-format
Browse files Browse the repository at this point in the history
Some minor modification so that the bpf source code matches our current
clang-format config.

Signed-off-by: Kornilios Kourtis <[email protected]>
  • Loading branch information
kkourt committed Jul 7, 2023
1 parent 186a3fb commit c91efb9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
1 change: 0 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ AlignTrailingComments: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
Expand Down
3 changes: 1 addition & 2 deletions bpf/process/pfilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,7 @@ process_filter_capabilities(__u32 ty, __u32 op, __u32 ns, __u64 val,

if (op == op_filter_in)
return (caps & val) ? PFILTER_ACCEPT : PFILTER_REJECT;
return (caps & val) ? PFILTER_REJECT :
PFILTER_ACCEPT; /* op_filter_notin */
return (caps & val) ? PFILTER_REJECT : PFILTER_ACCEPT; /* op_filter_notin */
}

#ifdef __CAP_CHANGES_FILTER
Expand Down
2 changes: 1 addition & 1 deletion bpf/process/types/basic.h
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ __copy_char_iovec(long off, unsigned long arg, unsigned long cnt,
/* PARSE_IOVEC_ENTRIES will jump here when done or return error */
char_iovec_done :

s = (int *)args_off(e, off_orig);
s = (int *)args_off(e, off_orig);
s[0] = size;
s[1] = size;
return size + 8;
Expand Down
32 changes: 16 additions & 16 deletions bpf/test/bpf_lseek.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
#include "bpf_task.h"

/*
* # cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_lseek/format
* name: sys_enter_lseek
* ID: 682
* format:
* field:unsigned short common_type; offset:0; size:2; signed:0;
* field:unsigned char common_flags; offset:2; size:1; signed:0;
* field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
* field:int common_pid; offset:4; size:4; signed:1;
*
* field:int __syscall_nr; offset:8; size:4; signed:1;
* field:unsigned int fd; offset:16; size:8; signed:0;
* field:off_t offset; offset:24; size:8; signed:0;
* field:unsigned int whence; offset:32; size:8; signed:0;
*
* print fmt: "fd: 0x%08lx, offset: 0x%08lx, whence: 0x%08lx", ((unsigned long)(REC->fd)), ((unsigned long)(REC->offset)), ((unsigned long)(REC->whence))
*/
* # cat /sys/kernel/debug/tracing/events/syscalls/sys_enter_lseek/format
* name: sys_enter_lseek
* ID: 682
* format:
* field:unsigned short common_type; offset:0; size:2; signed:0;
* field:unsigned char common_flags; offset:2; size:1; signed:0;
* field:unsigned char common_preempt_count; offset:3; size:1; signed:0;
* field:int common_pid; offset:4; size:4; signed:1;
*
* field:int __syscall_nr; offset:8; size:4; signed:1;
* field:unsigned int fd; offset:16; size:8; signed:0;
* field:off_t offset; offset:24; size:8; signed:0;
* field:unsigned int whence; offset:32; size:8; signed:0;
*
* print fmt: "fd: 0x%08lx, offset: 0x%08lx, whence: 0x%08lx", ((unsigned long)(REC->fd)), ((unsigned long)(REC->offset)), ((unsigned long)(REC->whence))
*/
struct sys_enter_lseek_args {
__u16 common_type;
__u8 common_flags;
Expand Down

0 comments on commit c91efb9

Please sign in to comment.