This source file includes following definitions.
- dyn_event_init
- dyn_event_add
- dyn_event_remove
1
2
3
4
5
6 #ifndef _TRACE_DYNEVENT_H
7 #define _TRACE_DYNEVENT_H
8
9 #include <linux/kernel.h>
10 #include <linux/list.h>
11 #include <linux/mutex.h>
12 #include <linux/seq_file.h>
13
14 #include "trace.h"
15
16 struct dyn_event;
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 struct dyn_event_operations {
41 struct list_head list;
42 int (*create)(int argc, const char *argv[]);
43 int (*show)(struct seq_file *m, struct dyn_event *ev);
44 bool (*is_busy)(struct dyn_event *ev);
45 int (*free)(struct dyn_event *ev);
46 bool (*match)(const char *system, const char *event,
47 int argc, const char **argv, struct dyn_event *ev);
48 };
49
50
51 int dyn_event_register(struct dyn_event_operations *ops);
52
53
54
55
56
57
58
59
60
61 struct dyn_event {
62 struct list_head list;
63 struct dyn_event_operations *ops;
64 };
65
66 extern struct list_head dyn_event_list;
67
68 static inline
69 int dyn_event_init(struct dyn_event *ev, struct dyn_event_operations *ops)
70 {
71 if (!ev || !ops)
72 return -EINVAL;
73
74 INIT_LIST_HEAD(&ev->list);
75 ev->ops = ops;
76 return 0;
77 }
78
79 static inline int dyn_event_add(struct dyn_event *ev)
80 {
81 lockdep_assert_held(&event_mutex);
82
83 if (!ev || !ev->ops)
84 return -EINVAL;
85
86 list_add_tail(&ev->list, &dyn_event_list);
87 return 0;
88 }
89
90 static inline void dyn_event_remove(struct dyn_event *ev)
91 {
92 lockdep_assert_held(&event_mutex);
93 list_del_init(&ev->list);
94 }
95
96 void *dyn_event_seq_start(struct seq_file *m, loff_t *pos);
97 void *dyn_event_seq_next(struct seq_file *m, void *v, loff_t *pos);
98 void dyn_event_seq_stop(struct seq_file *m, void *v);
99 int dyn_events_release_all(struct dyn_event_operations *type);
100 int dyn_event_release(int argc, char **argv, struct dyn_event_operations *type);
101
102
103
104
105
106
107
108
109 #define for_each_dyn_event(pos) \
110 list_for_each_entry(pos, &dyn_event_list, list)
111
112
113
114
115
116
117 #define for_each_dyn_event_safe(pos, n) \
118 list_for_each_entry_safe(pos, n, &dyn_event_list, list)
119
120 #endif