Lines Matching +full:key +full:- +full:home

1 // SPDX-License-Identifier: GPL-2.0
16 #include <subcmd/exec-cmd.h>
22 #include "build-id.h"
83 if (len >= sizeof(value) - 1) in parse_value()
133 quote = 1-quote; in parse_value()
142 return isalnum(c) || c == '-' || c == '_'; in iskeychar()
159 return -1; in get_value()
168 return -1; in get_value()
171 return -1; in get_value()
180 return -1; in get_extended_base_var()
186 return -1; in get_extended_base_var()
193 return -1; in get_extended_base_var()
199 return -1; in get_extended_base_var()
203 return -1; in get_extended_base_var()
208 return -1; in get_extended_base_var()
219 return -1; in get_base_var()
225 return -1; in get_base_var()
227 return -1; in get_base_var()
246 /* We are at the file beginning; skip UTF8-encoded BOM in perf_parse_file()
295 return -1; in perf_parse_file()
360 return -1; in perf_config_u64()
372 return -1; in perf_config_int()
384 return -1; in perf_config_u8()
404 return perf_config_int(&ret, name, value) < 0 ? -1 : ret; in perf_config_bool_or_int()
428 return -1; in perf_buildid_config()
430 strncpy(buildid_dir, dir, MAXPATHLEN-1); in perf_buildid_config()
431 buildid_dir[MAXPATHLEN-1] = '\0'; in perf_buildid_config()
439 if (!strcmp(var, "core.proc-map-timeout")) in perf_default_core_config()
442 if (!strcmp(var, "core.addr2line-timeout")) in perf_default_core_config()
452 if (!strcmp(var, "ui.show-headers")) in perf_ui_config()
460 if (!strcmp(var, "stat.big-num")) in perf_stat_config()
463 if (!strcmp(var, "stat.no-csv-summary")) in perf_stat_config()
466 if (!strcmp(var, "stat.bpf-counter-events")) in perf_stat_config()
485 if (strstarts(var, "call-graph.")) in perf_default_config()
503 ret = -1; in perf_config_from_file()
542 const char *home = NULL; in home_perfconfig() local
547 home = getenv("HOME"); in home_perfconfig()
551 * - there is no place to read it from (HOME) in home_perfconfig()
552 * - we are asked not to (PERF_CONFIG_NOGLOBAL=1) in home_perfconfig()
554 if (!home || !*home || !perf_config_global()) in home_perfconfig()
557 config = strdup(mkpath(path, sizeof(path), "%s/.perfconfig", home)); in home_perfconfig()
559 pr_warning("Not enough memory to process %s/.perfconfig, ignoring it.\n", home); in home_perfconfig()
600 if (!strcmp(section->name, section_name)) in find_section()
611 list_for_each_entry(item, &section->items, node) in find_config_item()
612 if (!strcmp(item->name, name)) in find_config_item()
626 INIT_LIST_HEAD(&section->items); in add_section()
627 section->name = strdup(section_name); in add_section()
628 if (!section->name) { in add_section()
634 list_add_tail(&section->node, sections); in add_section()
646 item->name = strdup(name); in add_config_item()
647 if (!item->name) { in add_config_item()
653 list_add_tail(&item->node, &section->items); in add_config_item()
662 return -1; in set_value()
664 zfree(&item->value); in set_value()
665 item->value = val; in set_value()
672 int ret = -1; in collect_config()
673 char *ptr, *key; in collect_config() local
681 return -1; in collect_config()
683 sections = &set->sections; in collect_config()
684 key = ptr = strdup(var); in collect_config()
685 if (!key) { in collect_config()
687 return -1; in collect_config()
715 section->from_system_config = true; in collect_config()
716 item->from_system_config = true; in collect_config()
718 section->from_system_config = false; in collect_config()
719 item->from_system_config = false; in collect_config()
725 free(key); in collect_config()
738 int ret = -1; in perf_config_set__init()
761 INIT_LIST_HEAD(&set->sections); in perf_config_set__new()
773 INIT_LIST_HEAD(&set->sections); in perf_config_set__load_file()
792 char key[BUFSIZ]; in perf_config_set() local
797 char *value = item->value; in perf_config_set()
800 scnprintf(key, sizeof(key), "%s.%s", in perf_config_set()
801 section->name, item->name); in perf_config_set()
802 ret = fn(key, value, data); in perf_config_set()
804 pr_err("Error in the given config file: wrong config key-value pair %s=%s\n", in perf_config_set()
805 key, value); in perf_config_set()
821 return -1; in perf_config()
840 zfree(&item->name); in perf_config_item__delete()
841 zfree(&item->value); in perf_config_item__delete()
849 list_for_each_entry_safe(item, tmp, &section->items, node) { in perf_config_section__purge()
850 list_del_init(&item->node); in perf_config_section__purge()
858 zfree(&section->name); in perf_config_section__delete()
866 list_for_each_entry_safe(section, tmp, &set->sections, node) { in perf_config_set__purge()
867 list_del_init(&section->node); in perf_config_set__purge()
888 return -1; in config_error_nonbool()
896 /* default to $HOME/.debug */ in set_buildid_dir()
898 char *home = getenv("HOME"); in set_buildid_dir() local
900 if (home) { in set_buildid_dir()
902 home, DEBUG_CACHE_DIR); in set_buildid_dir()
904 strncpy(buildid_dir, DEBUG_CACHE_DIR, MAXPATHLEN-1); in set_buildid_dir()
906 buildid_dir[MAXPATHLEN-1] = '\0'; in set_buildid_dir()
923 if (!strcmp(var, d->name)) in perf_config_scan_cb()
924 d->ret = vsscanf(value, d->fmt, d->args); in perf_config_scan_cb()