Skip to content

Commit cdc6a4b

Browse files
l0koddavem330
authored andcommitted
bpf: Remove redundant ifdef
Remove a useless ifdef __NR_bpf as requested by Wang Nan. Inline one-line static functions as it was in the bpf_sys.h file. Signed-off-by: Mickaël Salaün <mic@digikod.net> Cc: Alexei Starovoitov <ast@fb.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: David S. Miller <davem@davemloft.net> Cc: Wang Nan <wangnan0@huawei.com> Link: https://lkml.kernel.org/r/828ab1ff-4dcf-53ff-c97b-074adb895006@huawei.com Acked-by: Wang Nan <wangnan0@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 99f5711 commit cdc6a4b

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

tools/lib/bpf/bpf.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,15 @@
4242
# endif
4343
#endif
4444

45-
static __u64 ptr_to_u64(const void *ptr)
45+
static inline __u64 ptr_to_u64(const void *ptr)
4646
{
4747
return (__u64) (unsigned long) ptr;
4848
}
4949

50-
static int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
51-
unsigned int size)
50+
static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr,
51+
unsigned int size)
5252
{
53-
#ifdef __NR_bpf
5453
return syscall(__NR_bpf, cmd, attr, size);
55-
#else
56-
fprintf(stderr, "No bpf syscall, kernel headers too old?\n");
57-
errno = ENOSYS;
58-
return -1;
59-
#endif
6054
}
6155

6256
int bpf_create_map(enum bpf_map_type map_type, int key_size,

0 commit comments

Comments
 (0)