config.h 1.9 KB

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