rv.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #include <linux/mutex.h>
  3. struct rv_interface {
  4. struct dentry *root_dir;
  5. struct dentry *monitors_dir;
  6. };
  7. #include "../trace.h"
  8. #include <linux/tracefs.h>
  9. #include <linux/rv.h>
  10. #define RV_MODE_WRITE TRACE_MODE_WRITE
  11. #define RV_MODE_READ TRACE_MODE_READ
  12. #define rv_create_dir tracefs_create_dir
  13. #define rv_create_file tracefs_create_file
  14. #define rv_remove tracefs_remove
  15. #define MAX_RV_MONITOR_NAME_SIZE 32
  16. #define MAX_RV_REACTOR_NAME_SIZE 32
  17. extern struct mutex rv_interface_lock;
  18. #ifdef CONFIG_RV_REACTORS
  19. struct rv_reactor_def {
  20. struct list_head list;
  21. struct rv_reactor *reactor;
  22. /* protected by the monitor interface lock */
  23. int counter;
  24. };
  25. #endif
  26. struct rv_monitor_def {
  27. struct list_head list;
  28. struct rv_monitor *monitor;
  29. struct dentry *root_d;
  30. #ifdef CONFIG_RV_REACTORS
  31. struct rv_reactor_def *rdef;
  32. bool reacting;
  33. #endif
  34. bool task_monitor;
  35. };
  36. struct dentry *get_monitors_root(void);
  37. int rv_disable_monitor(struct rv_monitor_def *mdef);
  38. int rv_enable_monitor(struct rv_monitor_def *mdef);
  39. #ifdef CONFIG_RV_REACTORS
  40. int reactor_populate_monitor(struct rv_monitor_def *mdef);
  41. void reactor_cleanup_monitor(struct rv_monitor_def *mdef);
  42. int init_rv_reactors(struct dentry *root_dir);
  43. #else
  44. static inline int reactor_populate_monitor(struct rv_monitor_def *mdef)
  45. {
  46. return 0;
  47. }
  48. static inline void reactor_cleanup_monitor(struct rv_monitor_def *mdef)
  49. {
  50. return;
  51. }
  52. static inline int init_rv_reactors(struct dentry *root_dir)
  53. {
  54. return 0;
  55. }
  56. #endif