Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / tools / perf / util / config.h
blobc10b66dde2f35e407ce0b7a5431551c1cc40afdd
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PERF_CONFIG_H
3 #define __PERF_CONFIG_H
5 #include <stdbool.h>
6 #include <linux/list.h>
8 struct perf_config_item {
9 char *name;
10 char *value;
11 bool from_system_config;
12 struct list_head node;
15 struct perf_config_section {
16 char *name;
17 struct list_head items;
18 bool from_system_config;
19 struct list_head node;
22 struct perf_config_set {
23 struct list_head sections;
26 extern const char *config_exclusive_filename;
28 typedef int (*config_fn_t)(const char *, const char *, void *);
29 int perf_default_config(const char *, const char *, void *);
30 int perf_config(config_fn_t fn, void *);
31 int perf_config_int(int *dest, const char *, const char *);
32 int perf_config_u8(u8 *dest, const char *name, const char *value);
33 int perf_config_u64(u64 *dest, const char *, const char *);
34 int perf_config_bool(const char *, const char *);
35 int config_error_nonbool(const char *);
36 const char *perf_etc_perfconfig(void);
38 struct perf_config_set *perf_config_set__new(void);
39 void perf_config_set__delete(struct perf_config_set *set);
40 int perf_config_set__collect(struct perf_config_set *set, const char *file_name,
41 const char *var, const char *value);
42 void perf_config__exit(void);
43 void perf_config__refresh(void);
45 /**
46 * perf_config_sections__for_each - iterate thru all the sections
47 * @list: list_head instance to iterate
48 * @section: struct perf_config_section iterator
50 #define perf_config_sections__for_each_entry(list, section) \
51 list_for_each_entry(section, list, node)
53 /**
54 * perf_config_items__for_each - iterate thru all the items
55 * @list: list_head instance to iterate
56 * @item: struct perf_config_item iterator
58 #define perf_config_items__for_each_entry(list, item) \
59 list_for_each_entry(item, list, node)
61 /**
62 * perf_config_set__for_each - iterate thru all the config section-item pairs
63 * @set: evlist instance to iterate
64 * @section: struct perf_config_section iterator
65 * @item: struct perf_config_item iterator
67 #define perf_config_set__for_each_entry(set, section, item) \
68 perf_config_sections__for_each_entry(&set->sections, section) \
69 perf_config_items__for_each_entry(&section->items, item)
71 #endif /* __PERF_CONFIG_H */