From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752402AbbEDI4c (ORCPT ); Mon, 4 May 2015 04:56:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49105 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751976AbbEDI41 (ORCPT ); Mon, 4 May 2015 04:56:27 -0400 Date: Mon, 4 May 2015 10:56:24 +0200 From: Jiri Olsa To: Taeung Song Cc: Arnaldo Carvalho de Melo , linux-kernel@vger.kernel.org, namhyung@kernel.org Subject: Re: [PATCH 3/4] perf tools: Add a option 'all' to perf-config. Message-ID: <20150504085624.GC22694@krava.brq.redhat.com> References: <1430116466-14427-1-git-send-email-treeze.taeung@gmail.com> <1430116466-14427-3-git-send-email-treeze.taeung@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1430116466-14427-3-git-send-email-treeze.taeung@gmail.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 Mon, Apr 27, 2015 at 03:34:25PM +0900, Taeung Song wrote: > A option 'all' is to display both current config variables and > all possible config variables with default values. > The syntax examples are like below > > perf config [options] > > display all perf config with default values. > # perf config > or > # perf config -a | --all hum, seems some values are mixed: [jolsa@krava perf]$ ./perf config | grep size call-graph.dump-size = report.queue-size = true SNIP > struct list_head *sections; > @@ -28,6 +29,8 @@ static const char * const config_usage[] = { > static const struct option config_options[] = { > OPT_GROUP("Action"), > OPT_BOOLEAN('l', "list", ¶ms.list_action, "show current config variables"), > + OPT_BOOLEAN('a', "all", ¶ms.all_action, > + "show current and all possible config variables with default values"), > OPT_END() > }; > > @@ -204,6 +207,49 @@ static int collect_config(const char *var, const char *value, > return add_config_element(§ion_node->element_head, subkey, value); > } > > +static int merge_config(const char *var, const char *value, > + void *cb __maybe_unused) > +{ > + const char *section_name, *subkey; > + parse_key(var, §ion_name, &subkey); > + return set_config(section_name, subkey, value); > +} > + > +static int show_all_config(void) > +{ > + int ret = 0; > + struct config_section *section_node; > + struct config_element *element_node; > + char *pwd, *all_config; > + > + pwd = getenv("PWD"); > + all_config = strdup(mkpath("%s/util/PERFCONFIG-DEFAULT", pwd)); I haven't checked the whole code, but this cannot be dependent on the presence of the kernel tree.. I'll give it more time later today jirka