config.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef __PERF_CONFIG_H
  2. #define __PERF_CONFIG_H
  3. #include <stdbool.h>
  4. #include <linux/list.h>
  5. struct perf_config_item {
  6. char *name;
  7. char *value;
  8. bool from_system_config;
  9. struct list_head node;
  10. };
  11. struct perf_config_section {
  12. char *name;
  13. struct list_head items;
  14. bool from_system_config;
  15. struct list_head node;
  16. };
  17. struct perf_config_set {
  18. struct list_head sections;
  19. };
  20. extern const char *config_exclusive_filename;
  21. typedef int (*config_fn_t)(const char *, const char *, void *);
  22. int perf_default_config(const char *, const char *, void *);
  23. int perf_config(config_fn_t fn, void *);
  24. int perf_config_int(const char *, const char *);
  25. u64 perf_config_u64(const char *, const char *);
  26. int perf_config_bool(const char *, const char *);
  27. int config_error_nonbool(const char *);
  28. const char *perf_etc_perfconfig(void);
  29. struct perf_config_set *perf_config_set__new(void);
  30. void perf_config_set__delete(struct perf_config_set *set);
  31. int perf_config_set__collect(struct perf_config_set *set, const char *file_name,
  32. const char *var, const char *value);
  33. void perf_config__init(void);
  34. void perf_config__exit(void);
  35. void perf_config__refresh(void);
  36. /**
  37. * perf_config_sections__for_each - iterate thru all the sections
  38. * @list: list_head instance to iterate
  39. * @section: struct perf_config_section iterator
  40. */
  41. #define perf_config_sections__for_each_entry(list, section) \
  42. list_for_each_entry(section, list, node)
  43. /**
  44. * perf_config_items__for_each - iterate thru all the items
  45. * @list: list_head instance to iterate
  46. * @item: struct perf_config_item iterator
  47. */
  48. #define perf_config_items__for_each_entry(list, item) \
  49. list_for_each_entry(item, list, node)
  50. /**
  51. * perf_config_set__for_each - iterate thru all the config section-item pairs
  52. * @set: evlist instance to iterate
  53. * @section: struct perf_config_section iterator
  54. * @item: struct perf_config_item iterator
  55. */
  56. #define perf_config_set__for_each_entry(set, section, item) \
  57. perf_config_sections__for_each_entry(&set->sections, section) \
  58. perf_config_items__for_each_entry(&section->items, item)
  59. #endif /* __PERF_CONFIG_H */