[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151103121050.GF5733@danjae.kornet>
Date: Tue, 3 Nov 2015 21:10:50 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Taeung Song <treeze.taeung@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-kernel@...r.kernel.org, jolsa@...hat.com,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH v9 3/9] perf config: Collect configs to handle config
variables
On Tue, Nov 03, 2015 at 10:50:14AM +0900, Taeung Song wrote:
> Collecting configs into list because of two reason.
>
> First of all, if there are same variables both user
> and system config file, they all will be printed
> when 'list' command work. But if config variables are
> duplicated, user config variables should only be printed
> because it has priority.
>
> Lastly, list into which configs is collected
> will be required to keep and handle config variables
> and values in the near furture. For example,
> getting or setting functionality.
>
> And change show_config() function.
> Old show_config() worked depending on perf_config().
> New show_config() work using collected configs list.
>
> Signed-off-by: Taeung Song <treeze.taeung@...il.com>
Acked-by: Namhyung Kim <namhyung@...nel.org>
One nitpick again..
[SNIP]
> +static int collect_current_config(const char *var, const char *value,
> + void *spec_sections __maybe_unused)
The spec_sections is actually used, so "__maybe_unused" is not necessary.
Thanks,
Namhyung
> +{
> + int ret = -1;
> + char *ptr, *key;
> + char *section_name, *name;
> + struct config_section *section = NULL;
> + struct config_element *element = NULL;
> + struct list_head *sections = (struct list_head *)spec_sections;
> +
> + key = ptr = strdup(var);
> + if (!key) {
> + pr_err("%s: strdup failed\n", __func__);
> + return -1;
> + }
> +
> + section_name = strsep(&ptr, ".");
> + name = ptr;
> + if (name == NULL || value == NULL)
> + goto out_err;
> +
> + find_config(sections, §ion, &element, section_name, name);
> +
> + if (!section) {
> + section = init_section(section_name);
> + if (!section)
> + goto out_err;
> + list_add_tail(§ion->list, sections);
> + }
> +
> + value = strdup(value);
> + if (!value) {
> + pr_err("%s: strdup failed\n", __func__);
> + goto out_err;
> + }
> +
> + if (!element)
> + add_element(§ion->element_head, name, value);
> + else {
> + free(element->value);
> + element->value = (char *)value;
> + }
> +
> + ret = 0;
> +out_err:
> + free(key);
> + return ret;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists