1/* SPDX-License-Identifier: GPL-2.0 */
2#include <linux/mutex.h>
3
4struct 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
23extern struct mutex rv_interface_lock;
24
25#ifdef CONFIG_RV_REACTORS
26struct rv_reactor_def {
27 struct list_head list;
28 struct rv_reactor *reactor;
29 /* protected by the monitor interface lock */
30 int counter;
31};
32#endif
33
34struct rv_monitor_def {
35 struct list_head list;
36 struct rv_monitor *monitor;
37 struct dentry *root_d;
38#ifdef CONFIG_RV_REACTORS
39 struct rv_reactor_def *rdef;
40 bool reacting;
41#endif
42 bool task_monitor;
43};
44
45struct dentry *get_monitors_root(void);
46int rv_disable_monitor(struct rv_monitor_def *mdef);
47int rv_enable_monitor(struct rv_monitor_def *mdef);
48
49#ifdef CONFIG_RV_REACTORS
50int reactor_populate_monitor(struct rv_monitor_def *mdef);
51void reactor_cleanup_monitor(struct rv_monitor_def *mdef);
52int init_rv_reactors(struct dentry *root_dir);
53#else
54static inline int reactor_populate_monitor(struct rv_monitor_def *mdef)
55{
56 return 0;
57}
58
59static inline void reactor_cleanup_monitor(struct rv_monitor_def *mdef)
60{
61 return;
62}
63
64static inline int init_rv_reactors(struct dentry *root_dir)
65{
66 return 0;
67}
68#endif
69

source code of linux/kernel/trace/rv/rv.h