]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Add a helper for retrieving a map fd for a given name
authorMaciej Fijalkowski <maciejromanfijalkowski@gmail.com>
Fri, 1 Feb 2019 21:42:23 +0000 (22:42 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 1 Feb 2019 22:37:50 +0000 (23:37 +0100)
commitb4dd9d3157189d6a5f0552d2a077648e55914834
treec533d2064965a7f1071d14b53105e591cbb24867
parent63d463e904e400a2f70437a4eb9f973c3c2c6b03
libbpf: Add a helper for retrieving a map fd for a given name

XDP samples are mostly cooperating with eBPF maps through their file
descriptors. In case of a eBPF program that contains multiple maps it
might be tiresome to iterate through them and call bpf_map__fd for each
one. Add a helper mostly based on bpf_object__find_map_by_name, but
instead of returning the struct bpf_map pointer, return map fd.

Suggested-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h
tools/lib/bpf/libbpf.map