Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753426AbbFCVd3 (ORCPT ); Wed, 3 Jun 2015 17:33:29 -0400 Received: from mail.kernel.org ([198.145.29.136]:56651 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751656AbbFCVdU (ORCPT ); Wed, 3 Jun 2015 17:33:20 -0400 Date: Wed, 3 Jun 2015 18:33:14 -0300 From: Arnaldo Carvalho de Melo To: Wang Nan Cc: namhyung@kernel.org, alexei.starovoitov@gmail.com, masami.hiramatsu.pt@hitachi.com, paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, lizefan@huawei.com, hekuang@huawei.com, xiakaixu@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v5 06/30] bpf tools: Open eBPF object file and do basic validation Message-ID: <20150603213314.GB32707@kernel.org> References: <1433144296-74992-1-git-send-email-wangnan0@huawei.com> <1433144296-74992-7-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433144296-74992-7-git-send-email-wangnan0@huawei.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1809 Lines: 49 Em Mon, Jun 01, 2015 at 07:37:52AM +0000, Wang Nan escreveu: > 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 > Acked-by: Alexei Starovoitov Plese do: cd .git/hooks/ mv To avoid submitting patches that produce this: [acme@ssdandy linux]$ am /wb/1.patch Applying: bpf tools: Open eBPF object file and do basic validation /home/acme/git/linux/.git/rebase-apply/patch:98: trailing whitespace. /home/acme/git/linux/.git/rebase-apply/patch:145: space before tab in indent. pr_debug("loading %s\n", path); warning: 2 lines add whitespace errors. tools/lib/bpf/libbpf.c:130: trailing whitespace. + tools/lib/bpf/libbpf.c:177: space before tab in indent. + pr_debug("loading %s\n", path); [acme@ssdandy linux]$ ---------------------------- Fixing it up this time, - Arnaldo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/