Skip to content

Commit e00cc72

Browse files
committed
chore: check libbpf dev
1 parent ae2a332 commit e00cc72

File tree

4 files changed

+47
-28
lines changed

4 files changed

+47
-28
lines changed

core/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ set(CMAKE_C_FLAGS
44
"${CMAKE_C_FLAGS} -Werror -Wunused-function -Wstrict-prototypes -Wenum-compare -Wunused-variable -Wunused-but-set-variable -Wsign-compare -O2 -fstack-protector-strong -fno-omit-frame-pointer -fno-strict-aliasing -std=gnu11"
55
)
66

7+
find_path(LIBBPF_INCLUDE_DIR bpf/libbpf.h)
8+
find_library(LIBBPF_LIBRARY bpf)
9+
10+
if(NOT LIBBPF_INCLUDE_DIR OR NOT LIBBPF_LIBRARY)
11+
message(FATAL_ERROR "libbpf not found. Please install it.")
12+
endif()
13+
714
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
815
add_library(
916
epass STATIC

core/include/linux/bpf_ir.h

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,33 +1065,36 @@ struct builtin_pass_cfg {
10651065
};
10661066

10671067
#define DEF_CUSTOM_PASS(pass_def, check_applyc, param_loadc, param_unloadc) \
1068-
{ .pass = pass_def, \
1069-
.param = NULL, \
1070-
.param_load = param_loadc, \
1071-
.param_unload = param_unloadc, \
1072-
.check_apply = check_applyc }
1068+
{ \
1069+
.pass = pass_def, .param = NULL, .param_load = param_loadc, \
1070+
.param_unload = param_unloadc, .check_apply = check_applyc \
1071+
}
10731072

10741073
#define DEF_BUILTIN_PASS_CFG(namec, param_loadc, param_unloadc) \
1075-
{ .name = namec, \
1076-
.param = NULL, \
1077-
.enable = false, \
1078-
.enable_cfg = false, \
1079-
.param_load = param_loadc, \
1080-
.param_unload = param_unloadc }
1074+
{ \
1075+
.name = namec, .param = NULL, .enable = false, \
1076+
.enable_cfg = false, .param_load = param_loadc, \
1077+
.param_unload = param_unloadc \
1078+
}
10811079

10821080
#define DEF_BUILTIN_PASS_ENABLE_CFG(namec, param_loadc, param_unloadc) \
1083-
{ .name = namec, \
1084-
.param = NULL, \
1085-
.enable = true, \
1086-
.enable_cfg = false, \
1087-
.param_load = param_loadc, \
1088-
.param_unload = param_unloadc }
1081+
{ \
1082+
.name = namec, .param = NULL, .enable = true, \
1083+
.enable_cfg = false, .param_load = param_loadc, \
1084+
.param_unload = param_unloadc \
1085+
}
10891086

1090-
#define DEF_FUNC_PASS(fun, msg, en_def) \
1091-
{ .pass = fun, .name = msg, .enabled = en_def, .force_enable = false }
1087+
#define DEF_FUNC_PASS(fun, msg, en_def) \
1088+
{ \
1089+
.pass = fun, .name = msg, .enabled = en_def, \
1090+
.force_enable = false \
1091+
}
10921092

1093-
#define DEF_NON_OVERRIDE_FUNC_PASS(fun, msg) \
1094-
{ .pass = fun, .name = msg, .enabled = true, .force_enable = true }
1093+
#define DEF_NON_OVERRIDE_FUNC_PASS(fun, msg) \
1094+
{ \
1095+
.pass = fun, .name = msg, .enabled = true, \
1096+
.force_enable = true \
1097+
}
10951098

10961099
/* Passes End */
10971100

@@ -1125,10 +1128,11 @@ struct ir_value bpf_ir_value_stack_ptr(struct ir_function *fun);
11251128

11261129
struct ir_value bpf_ir_value_r0(struct ir_function *fun);
11271130

1128-
#define VR_POS_STACK_PTR \
1129-
(struct ir_vr_pos){ .allocated = true, \
1130-
.alloc_reg = BPF_REG_10, \
1131-
.spilled = 0 }
1131+
#define VR_POS_STACK_PTR \
1132+
(struct ir_vr_pos) \
1133+
{ \
1134+
.allocated = true, .alloc_reg = BPF_REG_10, .spilled = 0 \
1135+
}
11321136

11331137
struct ir_value bpf_ir_value_norm_stack_ptr(void);
11341138

core/include/linux/list.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ struct list_head {
4141
struct list_head *next, *prev;
4242
};
4343

44-
#define LIST_HEAD_INIT(name) { &(name), &(name) }
44+
#define LIST_HEAD_INIT(name) \
45+
{ \
46+
&(name), &(name) \
47+
}
4548

4649
#define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name)
4750

@@ -349,7 +352,10 @@ struct hlist_node {
349352
struct hlist_node *next, **pprev;
350353
};
351354

352-
#define HLIST_HEAD_INIT { .first = NULL }
355+
#define HLIST_HEAD_INIT \
356+
{ \
357+
.first = NULL \
358+
}
353359
#define HLIST_HEAD(name) struct hlist_head name = { .first = NULL }
354360
#define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL)
355361
static inline void INIT_HLIST_NODE(struct hlist_node *h)

core/scripts/gen_kernel.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
# Generating kernel source files
44

5-
KERNEL_PATH=/home/linsy/Projects/ebpf/ePass-kernel
5+
GIT_REPO=$(git rev-parse --show-toplevel)
6+
7+
KERNEL_PATH=$GIT_REPO/ePass-kernel
68

79
if [ ! -d $KERNEL_PATH ]; then
810
echo "Directory does not exists"

0 commit comments

Comments
 (0)