staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / test_stub.c
blob84e81a89e2f97129ba608f858d8bd1ea7c0d3086
1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 /* Copyright (C) 2019 Netronome Systems, Inc. */
4 #include <bpf/bpf.h>
5 #include <bpf/libbpf.h>
6 #include <string.h>
8 int bpf_prog_test_load(const char *file, enum bpf_prog_type type,
9 struct bpf_object **pobj, int *prog_fd)
11 struct bpf_prog_load_attr attr;
13 memset(&attr, 0, sizeof(struct bpf_prog_load_attr));
14 attr.file = file;
15 attr.prog_type = type;
16 attr.expected_attach_type = 0;
17 attr.prog_flags = BPF_F_TEST_RND_HI32;
19 return bpf_prog_load_xattr(&attr, pobj, prog_fd);
22 int bpf_test_load_program(enum bpf_prog_type type, const struct bpf_insn *insns,
23 size_t insns_cnt, const char *license,
24 __u32 kern_version, char *log_buf,
25 size_t log_buf_sz)
27 struct bpf_load_program_attr load_attr;
29 memset(&load_attr, 0, sizeof(struct bpf_load_program_attr));
30 load_attr.prog_type = type;
31 load_attr.expected_attach_type = 0;
32 load_attr.name = NULL;
33 load_attr.insns = insns;
34 load_attr.insns_cnt = insns_cnt;
35 load_attr.license = license;
36 load_attr.kern_version = kern_version;
37 load_attr.prog_flags = BPF_F_TEST_RND_HI32;
39 return bpf_load_program_xattr(&load_attr, log_buf, log_buf_sz);