Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __PERF_CONFIG_H
0003 #define __PERF_CONFIG_H
0004 
0005 #include <stdbool.h>
0006 #include <linux/list.h>
0007 
0008 struct perf_config_item {
0009     char *name;
0010     char *value;
0011     bool from_system_config;
0012     struct list_head node;
0013 };
0014 
0015 struct perf_config_section {
0016     char *name;
0017     struct list_head items;
0018     bool from_system_config;
0019     struct list_head node;
0020 };
0021 
0022 struct perf_config_set {
0023     struct list_head sections;
0024 };
0025 
0026 extern const char *config_exclusive_filename;
0027 
0028 typedef int (*config_fn_t)(const char *, const char *, void *);
0029 
0030 int perf_default_config(const char *, const char *, void *);
0031 int perf_config(config_fn_t fn, void *);
0032 int perf_config_set(struct perf_config_set *set,
0033             config_fn_t fn, void *data);
0034 int perf_config_int(int *dest, const char *, const char *);
0035 int perf_config_u8(u8 *dest, const char *name, const char *value);
0036 int perf_config_u64(u64 *dest, const char *, const char *);
0037 int perf_config_bool(const char *, const char *);
0038 int config_error_nonbool(const char *);
0039 const char *perf_etc_perfconfig(void);
0040 const char *perf_home_perfconfig(void);
0041 int perf_config_system(void);
0042 int perf_config_global(void);
0043 
0044 struct perf_config_set *perf_config_set__new(void);
0045 struct perf_config_set *perf_config_set__load_file(const char *file);
0046 void perf_config_set__delete(struct perf_config_set *set);
0047 int perf_config_set__collect(struct perf_config_set *set, const char *file_name,
0048                  const char *var, const char *value);
0049 void perf_config__exit(void);
0050 void perf_config__refresh(void);
0051 
0052 /**
0053  * perf_config_sections__for_each - iterate thru all the sections
0054  * @list: list_head instance to iterate
0055  * @section: struct perf_config_section iterator
0056  */
0057 #define perf_config_sections__for_each_entry(list, section) \
0058         list_for_each_entry(section, list, node)
0059 
0060 /**
0061  * perf_config_items__for_each - iterate thru all the items
0062  * @list: list_head instance to iterate
0063  * @item: struct perf_config_item iterator
0064  */
0065 #define perf_config_items__for_each_entry(list, item)   \
0066         list_for_each_entry(item, list, node)
0067 
0068 /**
0069  * perf_config_set__for_each - iterate thru all the config section-item pairs
0070  * @set: evlist instance to iterate
0071  * @section: struct perf_config_section iterator
0072  * @item: struct perf_config_item iterator
0073  */
0074 #define perf_config_set__for_each_entry(set, section, item)         \
0075     perf_config_sections__for_each_entry(&set->sections, section)       \
0076     perf_config_items__for_each_entry(&section->items, item)
0077 
0078 #endif /* __PERF_CONFIG_H */