[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <555A2A09.6090504@plumgrid.com>
Date: Mon, 18 May 2015 11:06:01 -0700
From: Alexei Starovoitov <ast@...mgrid.com>
To: Wang Nan <wangnan0@...wei.com>, paulus@...ba.org,
a.p.zijlstra@...llo.nl, mingo@...hat.com, acme@...nel.org,
namhyung@...nel.org, jolsa@...nel.org, dsahern@...il.com,
daniel@...earbox.net, brendan.d.gregg@...il.com,
masami.hiramatsu.pt@...achi.com
CC: lizefan@...wei.com, linux-kernel@...r.kernel.org, pi3orama@....com
Subject: Re: [RFC PATCH v3 09/37] bpf tools: Open eBPF object file and do
basic validation
On 5/17/15 3:56 AM, Wang Nan wrote:
> This patch adds basic 'struct bpf_object' which will be used for eBPF
> object file loading. eBPF object files are compiled by LLVM as ELF
> format. In this patch, libelf is used to open those files, read EHDR
> and do basic validation according to e_type and e_machine.
>
> All elf related staffs are grouped together and reside in elf field of
> 'struct bpf_object'. bpf_obj_clear_elf() is introduced to clear it.
>
> Signed-off-by: Wang Nan <wangnan0@...wei.com>
> ---
...
> +static void bpf_obj_clear_elf(struct bpf_object *obj)
> +{
> + if (!obj_elf_valid(obj))
> + return;
> +
> + if (obj->elf.elf) {
> + elf_end(obj->elf.elf);
> + obj->elf.elf = NULL;
the name of the function is odd.
'..clear_elf' ? Only because the field was named 'elf' ?
Also obj->elf.elf looks unbalanced.
may be bpf_obj_elf_finish() to match bpf_obj_elf_init()
and obj->efile.elf ?
> + }
> + if (obj->elf.fd >= 0) {
> + close(obj->elf.fd);
and the above will change to obj->efile.fd ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists