Skip to content

Commit 1f15e94

Browse files
committed
btf_unit_test: Refactor load_bpf_object to take filename
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
1 parent 2091654 commit 1f15e94

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

AF_XDP-interaction/btf_unit_test.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ static int verbose = 1;
2323
#define EXIT_FAIL_BPF 4
2424
#define EXIT_FAIL_BTF 5
2525

26-
struct bpf_object *load_bpf_object() {
26+
struct bpf_object *load_bpf_object(const char *filename) {
2727
struct bpf_object *obj;
2828
char buf[100];
2929
int err;
3030

31-
obj = bpf_object__open_file("af_xdp_kern.o", NULL);
31+
obj = bpf_object__open_file(filename, NULL);
3232
err = libbpf_get_error(obj);
3333
if (err) {
3434
libbpf_strerror(err, buf, sizeof(buf));
@@ -110,12 +110,14 @@ int init_btf_info_via_bpf_object(struct bpf_object *bpf_obj)
110110
return 0;
111111
}
112112

113+
114+
113115
int main(int argc, char **argv)
114116
{
115117
struct bpf_object *bpf_obj;
116118
int err = 0;
117119

118-
bpf_obj = load_bpf_object();
120+
bpf_obj = load_bpf_object("af_xdp_kern.o");
119121
if (!bpf_obj)
120122
return EXIT_FAIL_BPF;
121123

0 commit comments

Comments
 (0)