From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754685AbbERS1V (ORCPT ); Mon, 18 May 2015 14:27:21 -0400 Received: from mail-ig0-f169.google.com ([209.85.213.169]:35099 "EHLO mail-ig0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752295AbbERS1U (ORCPT ); Mon, 18 May 2015 14:27:20 -0400 Message-ID: <555A2F05.207@plumgrid.com> Date: Mon, 18 May 2015 11:27:17 -0700 From: Alexei Starovoitov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Wang Nan , paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com CC: lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 12/37] bpf tools: Collect version and license from ELF sections References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-13-git-send-email-wangnan0@huawei.com> In-Reply-To: <1431860222-61636-13-git-send-email-wangnan0@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/17/15 3:56 AM, Wang Nan wrote: > Expand bpf_obj_elf_collect() to collect license and kernel version > information in eBPF object file. eBPF object file should have a section > named 'license', which contains a string. It should also have a section > named 'version', contains a u32 LINUX_VERSION_CODE. > > bpf_obj_validate() is introduced to validate object file after loaded. > Currently it only check existance of 'version' section. > > Signed-off-by: Wang Nan ... > +#ifdef min > +# undef min > +#endif > +#define min(x, y) ({ \ > + typeof(x) _min1 = (x); \ > + typeof(y) _min2 = (y); \ > + (void) (&_min1 == &_min2); \ > + _min1 < _min2 ? _min1 : _min2; }) > + copy-paste from lib traceevent? there is another container_of copy-paste later in the patches. please use something like tools/lib/bpf/utils.h file for such things, so we can consolidate and share this code later.