libbpf: cleanup after partial failure in bpf_object__pin
authorStanislav Fomichev <sdf@google.com>
Fri, 9 Nov 2018 16:21:41 +0000 (08:21 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 10 Nov 2018 23:56:10 +0000 (15:56 -0800)
commit0c19a9fbc9cdba29c7effb34fd5a97226bf934e6
treec5eb6df4d8b1e102e9e9f9a4ac1dad116b08a1a9
parent108d50a976db70c59e6f2fc58d3252fd38ef3fc4
libbpf: cleanup after partial failure in bpf_object__pin

bpftool will use bpf_object__pin in the next commits to pin all programs
and maps from the file; in case of a partial failure, we need to get
back to the clean state (undo previous program/map pins).

As part of a cleanup, I've added and exported separate routines to
pin all maps (bpf_object__pin_maps) and progs (bpf_object__pin_programs)
of an object.

Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h