aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace')
-rw-r--r--kernel/trace/trace_events.c22
-rw-r--r--kernel/trace/trace_export.c8
2 files changed, 25 insertions, 5 deletions
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index af8fb8ebef0b..9c7ecfb3416f 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -62,6 +62,28 @@ err:
62} 62}
63EXPORT_SYMBOL_GPL(trace_define_field); 63EXPORT_SYMBOL_GPL(trace_define_field);
64 64
65#define __common_field(type, item) \
66 ret = trace_define_field(call, #type, "common_" #item, \
67 offsetof(typeof(ent), item), \
68 sizeof(ent.item), \
69 is_signed_type(type)); \
70 if (ret) \
71 return ret;
72
73int trace_define_common_fields(struct ftrace_event_call *call)
74{
75 int ret;
76 struct trace_entry ent;
77
78 __common_field(unsigned short, type);
79 __common_field(unsigned char, flags);
80 __common_field(unsigned char, preempt_count);
81 __common_field(int, pid);
82 __common_field(int, tgid);
83
84 return ret;
85}
86
65#ifdef CONFIG_MODULES 87#ifdef CONFIG_MODULES
66 88
67static void trace_destroy_fields(struct ftrace_event_call *call) 89static void trace_destroy_fields(struct ftrace_event_call *call)
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c
index cf2c752a25bf..70875303ae46 100644
--- a/kernel/trace/trace_export.c
+++ b/kernel/trace/trace_export.c
@@ -189,11 +189,9 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
189 struct args field; \ 189 struct args field; \
190 int ret; \ 190 int ret; \
191 \ 191 \
192 __common_field(unsigned char, type, 0); \ 192 ret = trace_define_common_fields(event_call); \
193 __common_field(unsigned char, flags, 0); \ 193 if (ret) \
194 __common_field(unsigned char, preempt_count, 0); \ 194 return ret; \
195 __common_field(int, pid, 1); \
196 __common_field(int, tgid, 1); \
197 \ 195 \
198 tstruct; \ 196 tstruct; \
199 \ 197 \