Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1429829

Re: [PATCH v11 2/3] perf config: Reimplement perf_config() introducing new perf_config__init() and perf_config__finish()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v11 2/3] perf config: Reimplement perf_config() introducing new perf_config__init() and perf_config__finish()
Date 2016-06-23 15:40 +0200
Message-ID <rNd1n-2aV-3@gated-at.bofh.it> (permalink)
References <rNcyl-1Zv-3@gated-at.bofh.it> <rNcyl-1Zv-25@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Thanks,

- Arnaldo

> +/**
> + * 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(&section->items, item)
>  
>  #endif /* __PERF_CONFIG_H */
> -- 
> 2.5.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v11 0/3] perf config: Reimplement perf_config() Taeung Song <treeze.taeung@gmail.com> - 2016-06-23 15:10 +0200
  [PATCH v11 1/3] perf config: Bring declarations about config from util/cache.h to util/config.h Taeung Song <treeze.taeung@gmail.com> - 2016-06-23 15:10 +0200
  [PATCH v11 3/3] perf config: Reimplement show_config() using config_set__for_each Taeung Song <treeze.taeung@gmail.com> - 2016-06-23 15:10 +0200
  [PATCH v11 2/3] perf config: Reimplement perf_config() introducing new perf_config__init() and perf_config__finish() Taeung Song <treeze.taeung@gmail.com> - 2016-06-23 15:10 +0200
    Re: [PATCH v11 2/3] perf config: Reimplement perf_config()  introducing new perf_config__init() and perf_config__finish() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 15:40 +0200
      Re: [PATCH v11 2/3] perf config: Reimplement perf_config()  introducing new perf_config__init() and perf_config__finish() Taeung Song <treeze.taeung@gmail.com> - 2016-06-23 16:20 +0200
        Re: [PATCH v11 2/3] perf config: Reimplement perf_config()  introducing new perf_config__init() and perf_config__finish() Arnaldo Carvalho de Melo <acme@kernel.org> - 2016-06-23 16:40 +0200
          Re: [PATCH v11 2/3] perf config: Reimplement perf_config()  introducing new perf_config__init() and perf_config__finish() Taeung Song <taeung.dev@gmail.com> - 2016-06-23 16:40 +0200

csiph-web