Re: [RFC PATCH v4 06/29] bpf tools: Open eBPF object file and do basic validation

From: Alexei Starovoitov
Date: Wed May 27 2015 - 21:44:53 EST


On Wed, May 27, 2015 at 05:19:41AM +0000, Wang Nan wrote:
> This patch defines basic interface of libbpf. 'struct bpf_object' will
> be the handler of each object file. Its internal structure is hide to
> user. 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 efile field of
> 'struct bpf_object'. bpf_object__elf_finish() is introduced to clear it.
>
> After all eBPF programs in an object file are loaded, related ELF
> information is useless. Close the object file and free those memory.
>
> zfree() and zclose() are introduced to ensure setting NULL pointers and
> negative file descriptors after resources are released.
>
> Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>

the __ notation actually looks good in this context.
Acked-by: Alexei Starovoitov <ast@xxxxxxxxxxxx>

btw, you didn't cc me on this set, luckily I found it on lkml.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/