From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751872AbcFWOP4 (ORCPT ); Thu, 23 Jun 2016 10:15:56 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33880 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751760AbcFWOPy (ORCPT ); Thu, 23 Jun 2016 10:15:54 -0400 Subject: Re: [PATCH v11 2/3] perf config: Reimplement perf_config() introducing new perf_config__init() and perf_config__finish() To: Arnaldo Carvalho de Melo References: <1466687020-21198-1-git-send-email-treeze.taeung@gmail.com> <1466687020-21198-3-git-send-email-treeze.taeung@gmail.com> <20160623133827.GO4213@kernel.org> Cc: linux-kernel@vger.kernel.org, Jiri Olsa , Namhyung Kim , Ingo Molnar , Peter Zijlstra , Alexander Shishkin , Masami Hiramatsu , Wang Nan , Jiri Olsa , Ingo Molnar From: Taeung Song Message-ID: <576BEF15.9020405@gmail.com> Date: Thu, 23 Jun 2016 23:15:49 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <20160623133827.GO4213@kernel.org> 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 06/23/2016 10:38 PM, Arnaldo Carvalho de Melo wrote: > Em Thu, Jun 23, 2016 at 10:03:39PM +0900, Taeung Song escreveu: >> +/** >> + * perf_config_sections__for_each - iterate thru all the sections >> + * @list: list_head instance to iterate >> + * @section: struct perf_config_section iterator >> + */ >> +#define perf_config_sections__for_each(list, section) \ >> + list_for_each_entry(section, list, node) >> + > > I was almost applying this but then there is a little detail, which is > that it is a goal to make the tools/ code look as much as kernel code as > possible, to encourage kernel developers to contribute to the tools > codebase and also to expose userspace developers to kernel practices. > > With that said, please rename these for_each macros to for_each_entry, > i.e.: > > perf_config_sections__for_each_entry() > perf_config_items__for_each_entry() > > As for_each and for_each_entry both exist in the kernel and have well > know semantics that we want to keep. > > Probably there are cases in tools/ where we break this rule, I'll check > and fix. > Granted ! :) I sent v12 with above changes a moment ago. Thanks, Taeung > >> +/** >> + * perf_config_items__for_each - iterate thru all the items >> + * @list: list_head instance to iterate >> + * @item: struct perf_config_item iterator >> + */ >> +#define perf_config_items__for_each(list, item) \ >> + list_for_each_entry(item, list, node) >> + >> +/** >> + * perf_config_set__for_each - iterate thru all the config section-item pairs >> + * @set: evlist instance to iterate >> + * @section: struct perf_config_section iterator >> + * @item: struct perf_config_item iterator >> + */ >> +#define perf_config_set__for_each(set, section, item) \ >> + perf_config_sections__for_each(&set->sections, section) \ >> + perf_config_items__for_each(§ion->items, item) >> >> #endif /* __PERF_CONFIG_H */ >> -- >> 2.5.0