[PATCH v11 0/1] Infrastructure code for perf-config

From: Taeung Song
Date: Wed May 04 2016 - 08:21:52 EST


We can use the config files (i.e user wide ~/.perfconfig
and system wide $(sysconfdir)/perfconfig)
to configure perf tools. perf-config help user
manage the config files, not manually look into or edit them.

Introduce new infrastructure code for config
management features of perf-config subcommand.

This pathset contains basic code for various purposes of configuration management
showing current configs, in the near future,
showing all configs with default value,
getting current configs from the config files
or writing configs that user type on the config files, etc.

IMHO, I think this infrastructure code is needed
to add new funcationalities for config management of perf-config.

If anyone reviews this, I'd appreciate it.


- don't initialize perf_config_set with all default configs and remove the patch for it.
- add struct default_config_item for only default config (Namhyung)
- define each default_config_item array as const type (Namhyung)
- In the near future, default values of each actual config variable
could be replaced with the default_config_item arrays (Namhyung)

- fix default values of colors.normal and colors.selected
according ui_browser__colorsets[] at ui/browser.c
- recheck all default config values looking into relevant codes
- v9 1/2, 2/2 acked by Namhyung Kim (see https://lkml.org/lkml/2016/4/20/834)

- don't use the arbitrary maximum 'MAX_CONFIGS' (Arnaldo, Namhyung)
- change two-dimensinal arrays 'default_config_items' to array of pointers (Namhyung)
- remove needless 'enum perf_config_secion_idx'
- add sections 'intel-pt','convert' and their items
- modify perf_config_set__init() in accordance with new default config sections and items
- (applied two previous patches 860b8d4 and 20105ca from this patchset)

- rebased onto the current acme/perf/core

- rename 'is_custom' to 'is_allocated' to be proper (Masami)
- fix the code about free() or zfree() in perf_config_*__delete() (Masami)
- check set == NULL or not in show_config() (Masami)

- don't use goto in add_config_item() (Masami)

- departmentalize perf_config_set__delete() (Arnaldo)
- remove confusing find_config() (Arnaldo)
- use pr_debug() instead of pr_err() (Arnaldo)
- use zfree() instead of free() (Arnaldo)
- more compact in perf_config_set__new() (Arnaldo)
- rename variables 'perf_configs', 'config_items', etc. (Arnaldo)

- fill perf_config_set__delete() in collect_config() for state of error
- fill the code setting is_custom value in add_config_item() (Namhyung)

- use the section list that contains configs each section
instead of the single config list (Namhyung)
- exclude a patch for '--list-all' option from this patchset

- remove perf_config_kind (user, system or both config files)
and needless at this time, etc. (Namhyung)
- separate this patch as several patches (Namhyung)
- fix typing errors, etc.

Taeung Song (1):
perf config: Prepare all default configs

tools/perf/util/config.c | 150 ++++++++++++++++++++++++++++++++++++++++++++++-
tools/perf/util/config.h | 46 ++++++++++++++-
2 files changed, 194 insertions(+), 2 deletions(-)