OSDN Git Service

libbpf: Move directory creation into _pin() functions
authorToke Høiland-Jørgensen <toke@redhat.com>
Sat, 2 Nov 2019 11:09:39 +0000 (12:09 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 2 Nov 2019 19:35:07 +0000 (12:35 -0700)
commit196f8487f51ee6e2a46f51e10ac3f4ca67574ba9
tree4a2053bceebc780361068b64a6298c977bacfd20
parent4580b25fcee5347327aaffcec31c615ec28a889a
libbpf: Move directory creation into _pin() functions

The existing pin_*() functions all try to create the parent directory
before pinning. Move this check into the per-object _pin() functions
instead. This ensures consistent behaviour when auto-pinning is
added (which doesn't go through the top-level pin_maps() function), at the
cost of a few more calls to mkdir().

Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/157269297985.394725.5882630952992598610.stgit@toke.dk
tools/lib/bpf/libbpf.c