From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946398AbbEVRYr (ORCPT ); Fri, 22 May 2015 13:24:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44383 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946348AbbEVRYp (ORCPT ); Fri, 22 May 2015 13:24:45 -0400 Date: Fri, 22 May 2015 19:24:35 +0200 From: Jiri Olsa To: Wang Nan Cc: paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, jolsa@kernel.org, dsahern@gmail.com, ast@plumgrid.com, daniel@iogearbox.net, brendan.d.gregg@gmail.com, masami.hiramatsu.pt@hitachi.com, lizefan@huawei.com, linux-kernel@vger.kernel.org, pi3orama@163.com Subject: Re: [RFC PATCH v3 30/37] perf bpf: Add bpf-loader and open ELF object files Message-ID: <20150522172435.GH6609@krava.redhat.com> References: <1431860222-61636-1-git-send-email-wangnan0@huawei.com> <1431860222-61636-31-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1431860222-61636-31-git-send-email-wangnan0@huawei.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 On Sun, May 17, 2015 at 10:56:55AM +0000, Wang Nan wrote: SNIP > +#define DEFINE_PRINT_FN(name, level) \ > +static int libbpf_##name(const char *fmt, ...) \ > +{ \ > + va_list args; \ > + int ret; \ > + \ > + va_start(args, fmt); \ > + ret = veprintf(level, verbose, pr_fmt(fmt), args);\ > + va_end(args); \ > + return ret; \ > +} > + > +DEFINE_PRINT_FN(warning, 0) > +DEFINE_PRINT_FN(info, 0) > +DEFINE_PRINT_FN(debug, 1) > + > +static bool libbpf_inited = false; > + > +#define MAX_OBJECTS 128 > + > +struct { > + struct bpf_object *objects[MAX_OBJECTS]; > + size_t nr_objects; > +} params; apart from that we dont like this kind of static stuff, this seems like nice case for having simple handler like 'struct bpf_objects' carrying the above data.. what do I miss? also params should actually be static right? jirka