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.tae...@gmail.com>

Acked-by: Namhyung Kim <namhy...@kernel.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, &section, &element, section_name, name);
> +
> +     if (!section) {
> +             section = init_section(section_name);
> +             if (!section)
> +                     goto out_err;
> +             list_add_tail(&section->list, sections);
> +     }
> +
> +     value = strdup(value);
> +     if (!value) {
> +             pr_err("%s: strdup failed\n", __func__);
> +             goto out_err;
> +     }
> +
> +     if (!element)
> +             add_element(&section->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 majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to