summaryrefslogtreecommitdiff
path: root/tools/lib/bpf/libbpf.h
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2020-07-23 11:41:17 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-07-25 20:16:33 -0700
commitcd31039a7347610863aa8b77a9162048999723d0 (patch)
tree1484dab071877cccf5a8fe973c7392f123aa7ac8 /tools/lib/bpf/libbpf.h
parent5ce6e77c7edf7310a0ff9532fd6b9693c082ab32 (diff)
downloadlinux-cd31039a7347610863aa8b77a9162048999723d0.tar.gz
linux-cd31039a7347610863aa8b77a9162048999723d0.tar.bz2
linux-cd31039a7347610863aa8b77a9162048999723d0.zip
tools/libbpf: Add support for bpf map element iterator
Add map_fd to bpf_iter_attach_opts and flags to bpf_link_create_opts. Later on, bpftool or selftest will be able to create a bpf map element iterator by passing map_fd to the kernel during link creation time. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200723184117.590673-1-yhs@fb.com
Diffstat (limited to 'tools/lib/bpf/libbpf.h')
-rw-r--r--tools/lib/bpf/libbpf.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index c2272132e929..c6813791fa7e 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -264,8 +264,9 @@ LIBBPF_API struct bpf_link *bpf_map__attach_struct_ops(struct bpf_map *map);
struct bpf_iter_attach_opts {
size_t sz; /* size of this struct for forward/backward compatibility */
+ __u32 map_fd;
};
-#define bpf_iter_attach_opts__last_field sz
+#define bpf_iter_attach_opts__last_field map_fd
LIBBPF_API struct bpf_link *
bpf_program__attach_iter(struct bpf_program *prog,