Commit f19ddfe0 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Alexei Starovoitov
Browse files

selftests/bpf: Use explicit bpf_test_load_program() helper calls



Remove the second part of prog loading testing helper re-definition:

  -Dbpf_load_program=bpf_test_load_program

This completes the clean up of deprecated libbpf program loading APIs.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarDave Marchevsky <davemarchevsky@fb.com>
Link: https://lore.kernel.org/bpf/20211103220845.2676888-13-andrii@kernel.org
parent cbdb1461
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -23,8 +23,7 @@ BPF_GCC ?= $(shell command -v bpf-gcc;)
SAN_CFLAGS	?=
CFLAGS += -g -O0 -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS)		\
	  -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)		\
	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)			\
	  -Dbpf_load_program=bpf_test_load_program
	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)
LDLIBS += -lcap -lelf -lz -lrt -lpthread

# Silence some warnings when compiled with clang
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ static int prog_load(void)
	};
	size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);

	return bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
	return bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB,
			       prog, insns_cnt, "GPL", 0,
			       bpf_log_buf, BPF_LOG_BUF_SIZE);
}
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static int prog_load_cnt(int verdict, int val)
	size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
	int ret;

	ret = bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
	ret = bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB,
			       prog, insns_cnt, "GPL", 0,
			       bpf_log_buf, BPF_LOG_BUF_SIZE);

+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ static int prog_load(int verdict)
	};
	size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);

	return bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
	return bpf_test_load_program(BPF_PROG_TYPE_CGROUP_SKB,
			       prog, insns_cnt, "GPL", 0,
			       bpf_log_buf, BPF_LOG_BUF_SIZE);
}
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ void serial_test_flow_dissector_load_bytes(void)

	/* make sure bpf_skb_load_bytes is not allowed from skb-less context
	 */
	fd = bpf_load_program(BPF_PROG_TYPE_FLOW_DISSECTOR, prog,
	fd = bpf_test_load_program(BPF_PROG_TYPE_FLOW_DISSECTOR, prog,
			      ARRAY_SIZE(prog), "GPL", 0, NULL, 0);
	CHECK(fd < 0,
	      "flow_dissector-bpf_skb_load_bytes-load",
Loading