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