aboutsummaryrefslogtreecommitdiffstats
path: root/include/trace/ftrace.h
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-06-04 14:29:33 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-06-04 14:29:33 -0400
commitbeba4bb096201ceec0e8cfb7ce3172a53015bdaf (patch)
tree4306fed6cf744e861cebcf2040210b910a64a52c /include/trace/ftrace.h
parent195d28020147843dcf809730b2e9d876722371e6 (diff)
tracing: Add __get_dynamic_array_len() macro for trace events
If a trace event uses a dynamic array for something other than a string then there's currently no way the TP_printk() can figure out what size it is. A __get_dynamic_array_len() is required to know the length. This also simplifies the __get_bitmask() macro which required it as well, but instead just hardcoded it. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/trace/ftrace.h')
-rw-r--r--include/trace/ftrace.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 9b7a989dcbcc..0fd06fef9fac 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -203,6 +203,10 @@
203#define __get_dynamic_array(field) \ 203#define __get_dynamic_array(field) \
204 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 204 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
205 205
206#undef __get_dynamic_array_len
207#define __get_dynamic_array_len(field) \
208 ((__entry->__data_loc_##field >> 16) & 0xffff)
209
206#undef __get_str 210#undef __get_str
207#define __get_str(field) (char *)__get_dynamic_array(field) 211#define __get_str(field) (char *)__get_dynamic_array(field)
208 212
@@ -211,7 +215,7 @@
211 ({ \ 215 ({ \
212 void *__bitmask = __get_dynamic_array(field); \ 216 void *__bitmask = __get_dynamic_array(field); \
213 unsigned int __bitmask_size; \ 217 unsigned int __bitmask_size; \
214 __bitmask_size = (__entry->__data_loc_##field >> 16) & 0xffff; \ 218 __bitmask_size = __get_dynamic_array_len(field); \
215 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ 219 ftrace_print_bitmask_seq(p, __bitmask, __bitmask_size); \
216 }) 220 })
217 221
@@ -636,6 +640,7 @@ static inline void ftrace_test_probe_##call(void) \
636#undef __print_symbolic 640#undef __print_symbolic
637#undef __print_hex 641#undef __print_hex
638#undef __get_dynamic_array 642#undef __get_dynamic_array
643#undef __get_dynamic_array_len
639#undef __get_str 644#undef __get_str
640#undef __get_bitmask 645#undef __get_bitmask
641 646
@@ -700,6 +705,10 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
700#define __get_dynamic_array(field) \ 705#define __get_dynamic_array(field) \
701 ((void *)__entry + (__entry->__data_loc_##field & 0xffff)) 706 ((void *)__entry + (__entry->__data_loc_##field & 0xffff))
702 707
708#undef __get_dynamic_array_len
709#define __get_dynamic_array_len(field) \
710 ((__entry->__data_loc_##field >> 16) & 0xffff)
711
703#undef __get_str 712#undef __get_str
704#define __get_str(field) (char *)__get_dynamic_array(field) 713#define __get_str(field) (char *)__get_dynamic_array(field)
705 714