diff options
| author | Andrii Nakryiko <[email protected]> | 2024-01-24 02:21:10 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2024-01-25 00:21:01 +0000 |
| commit | 364f848375af311150210a1ad3c5bcb800b65b48 (patch) | |
| tree | acdf69ee43fa21a47b81f24c6f0e961382ca5a91 /tools/lib/bpf/bpf.c | |
| parent | libbpf: Add bpf_token_create() API (diff) | |
| download | kernel-364f848375af311150210a1ad3c5bcb800b65b48.tar.gz kernel-364f848375af311150210a1ad3c5bcb800b65b48.zip | |
libbpf: Add BPF token support to bpf_map_create() API
Add ability to provide token_fd for BPF_MAP_CREATE command through
bpf_map_create() 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/lib/bpf/bpf.c')
| -rw-r--r-- | tools/lib/bpf/bpf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c index 54978198147c..9b11ca25e977 100644 --- a/tools/lib/bpf/bpf.c +++ b/tools/lib/bpf/bpf.c @@ -169,8 +169,7 @@ int bpf_map_create(enum bpf_map_type map_type, __u32 max_entries, const struct bpf_map_create_opts *opts) { - const size_t attr_sz = offsetofend(union bpf_attr, - value_type_btf_obj_fd); + const size_t attr_sz = offsetofend(union bpf_attr, map_token_fd); union bpf_attr attr; int fd; @@ -200,6 +199,8 @@ int bpf_map_create(enum bpf_map_type map_type, attr.numa_node = OPTS_GET(opts, numa_node, 0); attr.map_ifindex = OPTS_GET(opts, map_ifindex, 0); + attr.map_token_fd = OPTS_GET(opts, token_fd, 0); + fd = sys_bpf_fd(BPF_MAP_CREATE, &attr, attr_sz); return libbpf_err_errno(fd); } |
