aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <[email protected]>2021-12-01 23:28:21 +0000
committerAlexei Starovoitov <[email protected]>2021-12-02 23:23:40 +0000
commit186d1a86003ddcf0ec9e85e17ece868663106639 (patch)
tree3d5cbe7ae03605ed244657b169fd6d70d9b04689 /tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
parentselftests/bpf: Mute xdpxceiver.c's deprecation warnings (diff)
downloadkernel-186d1a86003ddcf0ec9e85e17ece868663106639.tar.gz
kernel-186d1a86003ddcf0ec9e85e17ece868663106639.zip
selftests/bpf: Remove all the uses of deprecated bpf_prog_load_xattr()
Migrate all the selftests that were still using bpf_prog_load_xattr(). Few are converted to skeleton, others will use bpf_object__open_file() API. Signed-off-by: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
index 86f97681ad89..6a953f4adfdc 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockopt_inherit.c
@@ -167,20 +167,20 @@ static int prog_attach(struct bpf_object *obj, int cgroup_fd, const char *title)
static void run_test(int cgroup_fd)
{
- struct bpf_prog_load_attr attr = {
- .file = "./sockopt_inherit.o",
- };
int server_fd = -1, client_fd;
struct bpf_object *obj;
void *server_err;
pthread_t tid;
- int ignored;
int err;
- err = bpf_prog_load_xattr(&attr, &obj, &ignored);
- if (CHECK_FAIL(err))
+ obj = bpf_object__open_file("sockopt_inherit.o", NULL);
+ if (!ASSERT_OK_PTR(obj, "obj_open"))
return;
+ err = bpf_object__load(obj);
+ if (!ASSERT_OK(err, "obj_load"))
+ goto close_bpf_object;
+
err = prog_attach(obj, cgroup_fd, "cgroup/getsockopt");
if (CHECK_FAIL(err))
goto close_bpf_object;