diff options
author | Steven Rostedt <srostedt@redhat.com> | 2010-05-05 10:52:31 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2010-05-05 11:46:17 -0400 |
commit | 2e26ca7150a4f2ab3e69471dfc65f131e7dd7a05 (patch) | |
tree | 6570a1670df3baafc7ab95b7f718a5dc2d04bd53 /include/linux/tracepoint.h | |
parent | 03d646e62b06e9364e2dbb939d67934c6c9826cd (diff) |
tracing: Fix tracepoint.h DECLARE_TRACE() to allow more than one header
When more than one header is included under CREATE_TRACE_POINTS
the DECLARE_TRACE() macro is not defined back to its original meaning
and the second include will fail to initialize the TRACE_EVENT()
and DECLARE_TRACE() correctly.
To fix this the tracepoint.h file moves the define of DECLARE_TRACE()
out of the #ifdef _LINUX_TRACEPOINT_H protection (just like the
define of the TRACE_EVENT()). This way the define_trace.h will undef
the DECLARE_TRACE() at the end and allow new headers to start
from scratch.
This patch also requires fixing the include/events/napi.h
It currently uses DECLARE_TRACE() and should be converted to a TRACE_EVENT()
format. But I'll leave that change to the authors of that file.
But since the napi.h file depends on using the CREATE_TRACE_POINTS
and does not define its own DEFINE_TRACE() it must use the define_trace.h
method instead.
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/tracepoint.h')
-rw-r--r-- | include/linux/tracepoint.h | 114 |
1 files changed, 59 insertions, 55 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 78b4bd3be496..1d85f9a6a199 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h | |||
@@ -33,6 +33,65 @@ struct tracepoint { | |||
33 | * Keep in sync with vmlinux.lds.h. | 33 | * Keep in sync with vmlinux.lds.h. |
34 | */ | 34 | */ |
35 | 35 | ||
36 | /* | ||
37 | * Connect a probe to a tracepoint. | ||
38 | * Internal API, should not be used directly. | ||
39 | */ | ||
40 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
41 | |||
42 | /* | ||
43 | * Disconnect a probe from a tracepoint. | ||
44 | * Internal API, should not be used directly. | ||
45 | */ | ||
46 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
47 | |||
48 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
49 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
50 | extern void tracepoint_probe_update_all(void); | ||
51 | |||
52 | struct tracepoint_iter { | ||
53 | struct module *module; | ||
54 | struct tracepoint *tracepoint; | ||
55 | }; | ||
56 | |||
57 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
58 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
59 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
60 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
61 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
62 | struct tracepoint *begin, struct tracepoint *end); | ||
63 | |||
64 | /* | ||
65 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
66 | * probe unregistration and the end of module exit to make sure there is no | ||
67 | * caller executing a probe when it is freed. | ||
68 | */ | ||
69 | static inline void tracepoint_synchronize_unregister(void) | ||
70 | { | ||
71 | synchronize_sched(); | ||
72 | } | ||
73 | |||
74 | #define PARAMS(args...) args | ||
75 | |||
76 | #ifdef CONFIG_TRACEPOINTS | ||
77 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
78 | struct tracepoint *end); | ||
79 | #else | ||
80 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
81 | struct tracepoint *end) | ||
82 | { } | ||
83 | #endif /* CONFIG_TRACEPOINTS */ | ||
84 | |||
85 | #endif /* _LINUX_TRACEPOINT_H */ | ||
86 | |||
87 | /* | ||
88 | * Note: we keep the TRACE_EVENT and DECLARE_TRACE outside the include | ||
89 | * file ifdef protection. | ||
90 | * This is due to the way trace events work. If a file includes two | ||
91 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
92 | * will override the TRACE_EVENT and break the second include. | ||
93 | */ | ||
94 | |||
36 | #ifndef DECLARE_TRACE | 95 | #ifndef DECLARE_TRACE |
37 | 96 | ||
38 | #define TP_PROTO(args...) args | 97 | #define TP_PROTO(args...) args |
@@ -96,9 +155,6 @@ struct tracepoint { | |||
96 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ | 155 | #define EXPORT_TRACEPOINT_SYMBOL(name) \ |
97 | EXPORT_SYMBOL(__tracepoint_##name) | 156 | EXPORT_SYMBOL(__tracepoint_##name) |
98 | 157 | ||
99 | extern void tracepoint_update_probe_range(struct tracepoint *begin, | ||
100 | struct tracepoint *end); | ||
101 | |||
102 | #else /* !CONFIG_TRACEPOINTS */ | 158 | #else /* !CONFIG_TRACEPOINTS */ |
103 | #define DECLARE_TRACE(name, proto, args) \ | 159 | #define DECLARE_TRACE(name, proto, args) \ |
104 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ | 160 | static inline void _do_trace_##name(struct tracepoint *tp, proto) \ |
@@ -119,61 +175,9 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin, | |||
119 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) | 175 | #define EXPORT_TRACEPOINT_SYMBOL_GPL(name) |
120 | #define EXPORT_TRACEPOINT_SYMBOL(name) | 176 | #define EXPORT_TRACEPOINT_SYMBOL(name) |
121 | 177 | ||
122 | static inline void tracepoint_update_probe_range(struct tracepoint *begin, | ||
123 | struct tracepoint *end) | ||
124 | { } | ||
125 | #endif /* CONFIG_TRACEPOINTS */ | 178 | #endif /* CONFIG_TRACEPOINTS */ |
126 | #endif /* DECLARE_TRACE */ | 179 | #endif /* DECLARE_TRACE */ |
127 | 180 | ||
128 | /* | ||
129 | * Connect a probe to a tracepoint. | ||
130 | * Internal API, should not be used directly. | ||
131 | */ | ||
132 | extern int tracepoint_probe_register(const char *name, void *probe); | ||
133 | |||
134 | /* | ||
135 | * Disconnect a probe from a tracepoint. | ||
136 | * Internal API, should not be used directly. | ||
137 | */ | ||
138 | extern int tracepoint_probe_unregister(const char *name, void *probe); | ||
139 | |||
140 | extern int tracepoint_probe_register_noupdate(const char *name, void *probe); | ||
141 | extern int tracepoint_probe_unregister_noupdate(const char *name, void *probe); | ||
142 | extern void tracepoint_probe_update_all(void); | ||
143 | |||
144 | struct tracepoint_iter { | ||
145 | struct module *module; | ||
146 | struct tracepoint *tracepoint; | ||
147 | }; | ||
148 | |||
149 | extern void tracepoint_iter_start(struct tracepoint_iter *iter); | ||
150 | extern void tracepoint_iter_next(struct tracepoint_iter *iter); | ||
151 | extern void tracepoint_iter_stop(struct tracepoint_iter *iter); | ||
152 | extern void tracepoint_iter_reset(struct tracepoint_iter *iter); | ||
153 | extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, | ||
154 | struct tracepoint *begin, struct tracepoint *end); | ||
155 | |||
156 | /* | ||
157 | * tracepoint_synchronize_unregister must be called between the last tracepoint | ||
158 | * probe unregistration and the end of module exit to make sure there is no | ||
159 | * caller executing a probe when it is freed. | ||
160 | */ | ||
161 | static inline void tracepoint_synchronize_unregister(void) | ||
162 | { | ||
163 | synchronize_sched(); | ||
164 | } | ||
165 | |||
166 | #define PARAMS(args...) args | ||
167 | |||
168 | #endif /* _LINUX_TRACEPOINT_H */ | ||
169 | |||
170 | /* | ||
171 | * Note: we keep the TRACE_EVENT outside the include file ifdef protection. | ||
172 | * This is due to the way trace events work. If a file includes two | ||
173 | * trace event headers under one "CREATE_TRACE_POINTS" the first include | ||
174 | * will override the TRACE_EVENT and break the second include. | ||
175 | */ | ||
176 | |||
177 | #ifndef TRACE_EVENT | 181 | #ifndef TRACE_EVENT |
178 | /* | 182 | /* |
179 | * For use with the TRACE_EVENT macro: | 183 | * For use with the TRACE_EVENT macro: |