^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * builtin-config.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (C) 2015, Taeung Song <treeze.taeung@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include "builtin.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include "util/cache.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <subcmd/parse-options.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "util/debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "util/config.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static bool use_system_config, use_user_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static const char * const config_usage[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) "perf config [<file-option>] [options] [section.name[=value] ...]",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) enum actions {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) ACTION_LIST = 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) } actions;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) static struct option config_options[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) OPT_SET_UINT('l', "list", &actions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) "show current config variables", ACTION_LIST),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) OPT_BOOLEAN(0, "system", &use_system_config, "use system config file"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) OPT_BOOLEAN(0, "user", &use_user_config, "use user config file"),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) OPT_END()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static int set_config(struct perf_config_set *set, const char *file_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) struct perf_config_section *section = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) struct perf_config_item *item = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) const char *first_line = "# this file is auto-generated.";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) FILE *fp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) if (set == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) fp = fopen(file_name, "w");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) if (!fp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) fprintf(fp, "%s\n", first_line);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* overwrite configvariables */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) perf_config_items__for_each_entry(&set->sections, section) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) if (!use_system_config && section->from_system_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) fprintf(fp, "[%s]\n", section->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) perf_config_items__for_each_entry(§ion->items, item) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) if (!use_system_config && item->from_system_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) if (item->value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) fprintf(fp, "\t%s = %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) item->name, item->value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) fclose(fp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) static int show_spec_config(struct perf_config_set *set, const char *var)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) struct perf_config_section *section;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct perf_config_item *item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) if (set == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) perf_config_items__for_each_entry(&set->sections, section) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) if (!strstarts(var, section->name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) perf_config_items__for_each_entry(§ion->items, item) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) const char *name = var + strlen(section->name) + 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) if (strcmp(name, item->name) == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) char *value = item->value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) if (value) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) printf("%s=%s\n", var, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static int show_config(struct perf_config_set *set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct perf_config_section *section;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) struct perf_config_item *item;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) if (set == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) perf_config_set__for_each_entry(set, section, item) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) char *value = item->value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) if (value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) printf("%s.%s=%s\n", section->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) item->name, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) static int parse_config_arg(char *arg, char **var, char **value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) const char *last_dot = strchr(arg, '.');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * Since "var" actually contains the section name and the real
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * config variable name separated by a dot, we have to know where the dot is.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) if (last_dot == NULL || last_dot == arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) pr_err("The config variable does not contain a section name: %s\n", arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) if (!last_dot[1]) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) pr_err("The config variable does not contain a variable name: %s\n", arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) *value = strchr(arg, '=');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) if (*value == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) *var = arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) else if (!strcmp(*value, "=")) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) pr_err("The config variable does not contain a value: %s\n", arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) *value = *value + 1; /* excluding a first character '=' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) *var = strsep(&arg, "=");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) if (*var[0] == '\0') {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) pr_err("invalid config variable: %s\n", arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) int cmd_config(int argc, const char **argv)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) int i, ret = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct perf_config_set *set;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) char *user_config = mkpath("%s/.perfconfig", getenv("HOME"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) const char *config_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) bool changed = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) argc = parse_options(argc, argv, config_options, config_usage,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) PARSE_OPT_STOP_AT_NON_OPTION);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) if (use_system_config && use_user_config) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) pr_err("Error: only one config file at a time\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) parse_options_usage(config_usage, config_options, "user", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) parse_options_usage(NULL, config_options, "system", 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) if (use_system_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) config_exclusive_filename = perf_etc_perfconfig();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) else if (use_user_config)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) config_exclusive_filename = user_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) if (!config_exclusive_filename)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) config_filename = user_config;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) config_filename = config_exclusive_filename;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) * At only 'config' sub-command, individually use the config set
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) * because of reinitializing with options config file location.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) set = perf_config_set__new();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) if (!set)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) switch (actions) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) case ACTION_LIST:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) if (argc) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) pr_err("Error: takes no arguments\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) parse_options_usage(config_usage, config_options, "l", 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) do_action_list:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) if (show_config(set) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) pr_err("Nothing configured, "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) "please check your %s \n", config_filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) if (!argc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) goto do_action_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) for (i = 0; argv[i]; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) char *var, *value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) char *arg = strdup(argv[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) if (!arg) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) pr_err("%s: strdup failed\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (parse_config_arg(arg, &var, &value) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) free(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) if (value == NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) if (show_spec_config(set, var) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) pr_err("%s is not configured: %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) var, config_filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) free(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) if (perf_config_set__collect(set, config_filename,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) var, value) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) pr_err("Failed to add '%s=%s'\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) var, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) free(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) changed = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) free(arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) if (!changed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) if (set_config(set, config_filename) < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) pr_err("Failed to set the configs on %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) config_filename);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) goto out_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) out_err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) perf_config_set__delete(set);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) }