Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

2015-05-18 Thread Alexei Starovoitov
On 5/18/15 5:47 AM, Wangnan (F) wrote: +prog->insns_cnt = size / sizeof(struct bpf_insn); +memcpy(prog->insns, data, + prog->insns_cnt * sizeof(struct bpf_insn)); Doesn't the data need to be swapped? Thanks, Namhyung I'm not very sure, since they are instructions. Byte o

Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

2015-05-18 Thread Wangnan (F)
在 2015/5/18 20:29, Namhyung Kim 写道: Hi, On Sun, May 17, 2015 at 10:56:41AM +, Wang Nan wrote: This patch collects all programs in an object file into an array of 'struct bpf_program' for further processing. That structure is for representing each eBPF program. 'bpf_prog' should be a bette

Re: [RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

2015-05-18 Thread Namhyung Kim
Hi, On Sun, May 17, 2015 at 10:56:41AM +, Wang Nan wrote: > This patch collects all programs in an object file into an array of > 'struct bpf_program' for further processing. That structure is for > representing each eBPF program. 'bpf_prog' should be a better name, but > it has been used by l

[RFC PATCH v3 16/37] bpf tools: Collect eBPF programs from their own sections

2015-05-17 Thread Wang Nan
This patch collects all programs in an object file into an array of 'struct bpf_program' for further processing. That structure is for representing each eBPF program. 'bpf_prog' should be a better name, but it has been used by linux/filter.h. Although it is a kernel space name, I still prefer to ca