Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-10-01 Thread Andrii Nakryiko
On Thu, Oct 1, 2020 at 4:34 AM Hangbin Liu wrote: > > On Thu, 1 Oct 2020 at 02:30, Andrii Nakryiko > wrote: > > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > > index 32dc444224d8..5412aa7169db 100644 > > > --- a/tools/lib/bpf/libbpf.c > > > +++ b/tools/lib/bpf/libbpf.c > > >

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-10-01 Thread Hangbin Liu
On Thu, 1 Oct 2020 at 02:30, Andrii Nakryiko wrote: > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > > index 32dc444224d8..5412aa7169db 100644 > > --- a/tools/lib/bpf/libbpf.c > > +++ b/tools/lib/bpf/libbpf.c > > @@ -4215,7 +4215,7 @@ bpf_object__create_maps(struct bpf_object *ob

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-30 Thread Andrii Nakryiko
On Tue, Sep 29, 2020 at 7:34 PM Hangbin Liu wrote: > > On Tue, Sep 29, 2020 at 04:03:45PM -0700, Andrii Nakryiko wrote: > > > bpf_map__set_pin_path() > > > bpf_create_map_in_map()<- create inner or outer map > > > bpf_map__reuse_fd(map, inner/outer_fd) > > > bpf_object__load(obj) > > > - bpf

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-29 Thread Hangbin Liu
On Tue, Sep 29, 2020 at 04:03:45PM -0700, Andrii Nakryiko wrote: > > bpf_map__set_pin_path() > > bpf_create_map_in_map()<- create inner or outer map > > bpf_map__reuse_fd(map, inner/outer_fd) > > bpf_object__load(obj) > > - bpf_object__load_xattr() > > - bpf_object__create_maps() > >

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-29 Thread Andrii Nakryiko
On Tue, Sep 29, 2020 at 2:42 AM Hangbin Liu wrote: > > On Mon, Sep 28, 2020 at 08:30:42PM -0700, Andrii Nakryiko wrote: > > > @@ -431,6 +431,7 @@ bpf_map__prev(const struct bpf_map *map, const struct > > > bpf_object *obj); > > > /* get/set map FD */ > > > LIBBPF_API int bpf_map__fd(const struc

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-29 Thread Hangbin Liu
On Mon, Sep 28, 2020 at 08:30:42PM -0700, Andrii Nakryiko wrote: > > @@ -431,6 +431,7 @@ bpf_map__prev(const struct bpf_map *map, const struct > > bpf_object *obj); > > /* get/set map FD */ > > LIBBPF_API int bpf_map__fd(const struct bpf_map *map); > > LIBBPF_API int bpf_map__reuse_fd(struct bp

Re: [PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-28 Thread Andrii Nakryiko
On Mon, Sep 28, 2020 at 8:20 PM Hangbin Liu wrote: > > Besides bpf_map__reuse_fd(), which could let us reuse existing map fd. > bpf_object__reuse_map() could let us reuse existing pinned maps, which > is helpful. > > This functions could also be used when we add iproute2 libbpf support, > so we do

[PATCH bpf-next] libbpf: export bpf_object__reuse_map() to libbpf api

2020-09-28 Thread Hangbin Liu
Besides bpf_map__reuse_fd(), which could let us reuse existing map fd. bpf_object__reuse_map() could let us reuse existing pinned maps, which is helpful. This functions could also be used when we add iproute2 libbpf support, so we don't need to re-use or re-implement new functions like bpf_obj_get