Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-13 Thread Wangnan (F)
On 2015/7/14 3:54, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:09PM +, Wang Nan escreveu: +static int +bpf_object__create_maps(struct bpf_object *obj) +{ + unsigned int i; + size_t nr_maps; + int *pfd; + + nr_maps = obj->maps_buf_sz /

Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-13 Thread Arnaldo Carvalho de Melo
Em Thu, Jul 09, 2015 at 12:35:09PM +, Wang Nan escreveu: > +static int > +bpf_object__create_maps(struct bpf_object *obj) > +{ > + unsigned int i; > + size_t nr_maps; > + int *pfd; > + > + nr_maps = obj->maps_buf_sz / sizeof(struct bpf_map_def); > + if (!obj->maps_buf ||

Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-13 Thread Wangnan (F)
On 2015/7/14 3:54, Arnaldo Carvalho de Melo wrote: Em Thu, Jul 09, 2015 at 12:35:09PM +, Wang Nan escreveu: SNIP +static int +bpf_object__create_maps(struct bpf_object *obj) +{ + unsigned int i; + size_t nr_maps; + int *pfd; + + nr_maps = obj-maps_buf_sz /

Re: [PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-13 Thread Arnaldo Carvalho de Melo
Em Thu, Jul 09, 2015 at 12:35:09PM +, Wang Nan escreveu: SNIP +static int +bpf_object__create_maps(struct bpf_object *obj) +{ + unsigned int i; + size_t nr_maps; + int *pfd; + + nr_maps = obj-maps_buf_sz / sizeof(struct bpf_map_def); + if (!obj-maps_buf ||

[PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-09 Thread Wang Nan
This patch creates maps based on 'map' section in object file using bpf_create_map(), and stores the fds into an array in 'struct bpf_object'. Previous patches parse ELF object file and collects required data, but doesn't play with the kernel. They belong to the 'opening' phase. This patch is the

[PATCH 06/39] bpf tools: Create eBPF maps defined in an object file

2015-07-09 Thread Wang Nan
This patch creates maps based on 'map' section in object file using bpf_create_map(), and stores the fds into an array in 'struct bpf_object'. Previous patches parse ELF object file and collects required data, but doesn't play with the kernel. They belong to the 'opening' phase. This patch is the