aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2009-12-01 03:23:30 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-01 11:33:28 -0500
commit31c16b13349970b2684248c7d8608d2a96ae135d (patch)
tree0f0a2bee35f604090b30d6724e13bb2faec8a6a5 /kernel
parentbf56a4ea9f1683c5b223fd3a5dbea23f1fa91c34 (diff)
trace_syscalls: Set event_enter_##sname->data to its metadata
Set event_enter_##sname->data to its metadata, it makes codes simpler. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Acked-by: Jason Baron <jbaron@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> LKML-Reference: <4B14D282.7050709@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_syscalls.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 00d6e176f5b6..39649b1675dd 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -51,7 +51,7 @@ static struct syscall_metadata *syscall_nr_to_meta(int nr)
51 return syscalls_metadata[nr]; 51 return syscalls_metadata[nr];
52} 52}
53 53
54int syscall_name_to_nr(char *name) 54int syscall_name_to_nr(const char *name)
55{ 55{
56 int i; 56 int i;
57 57
@@ -172,18 +172,11 @@ extern char *__bad_type_size(void);
172int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s) 172int syscall_enter_format(struct ftrace_event_call *call, struct trace_seq *s)
173{ 173{
174 int i; 174 int i;
175 int nr;
176 int ret; 175 int ret;
177 struct syscall_metadata *entry; 176 struct syscall_metadata *entry = call->data;
178 struct syscall_trace_enter trace; 177 struct syscall_trace_enter trace;
179 int offset = offsetof(struct syscall_trace_enter, args); 178 int offset = offsetof(struct syscall_trace_enter, args);
180 179
181 nr = syscall_name_to_nr(call->data);
182 entry = syscall_nr_to_meta(nr);
183
184 if (!entry)
185 return 0;
186
187 ret = trace_seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%zu;" 180 ret = trace_seq_printf(s, "\tfield:%s %s;\toffset:%zu;\tsize:%zu;"
188 "\tsigned:%u;\n", 181 "\tsigned:%u;\n",
189 SYSCALL_FIELD(int, nr)); 182 SYSCALL_FIELD(int, nr));
@@ -245,18 +238,11 @@ int syscall_exit_format(struct ftrace_event_call *call, struct trace_seq *s)
245int syscall_enter_define_fields(struct ftrace_event_call *call) 238int syscall_enter_define_fields(struct ftrace_event_call *call)
246{ 239{
247 struct syscall_trace_enter trace; 240 struct syscall_trace_enter trace;
248 struct syscall_metadata *meta; 241 struct syscall_metadata *meta = call->data;
249 int ret; 242 int ret;
250 int nr;
251 int i; 243 int i;
252 int offset = offsetof(typeof(trace), args); 244 int offset = offsetof(typeof(trace), args);
253 245
254 nr = syscall_name_to_nr(call->data);
255 meta = syscall_nr_to_meta(nr);
256
257 if (!meta)
258 return 0;
259
260 ret = trace_define_common_fields(call); 246 ret = trace_define_common_fields(call);
261 if (ret) 247 if (ret)
262 return ret; 248 return ret;
@@ -366,9 +352,9 @@ int reg_event_syscall_enter(struct ftrace_event_call *call)
366{ 352{
367 int ret = 0; 353 int ret = 0;
368 int num; 354 int num;
369 char *name; 355 const char *name;
370 356
371 name = (char *)call->data; 357 name = ((struct syscall_metadata *)call->data)->name;
372 num = syscall_name_to_nr(name); 358 num = syscall_name_to_nr(name);
373 if (num < 0 || num >= NR_syscalls) 359 if (num < 0 || num >= NR_syscalls)
374 return -ENOSYS; 360 return -ENOSYS;
@@ -389,9 +375,9 @@ int reg_event_syscall_enter(struct ftrace_event_call *call)
389void unreg_event_syscall_enter(struct ftrace_event_call *call) 375void unreg_event_syscall_enter(struct ftrace_event_call *call)
390{ 376{
391 int num; 377 int num;
392 char *name; 378 const char *name;
393 379
394 name = (char *)call->data; 380 name = ((struct syscall_metadata *)call->data)->name;
395 num = syscall_name_to_nr(name); 381 num = syscall_name_to_nr(name);
396 if (num < 0 || num >= NR_syscalls) 382 if (num < 0 || num >= NR_syscalls)
397 return; 383 return;
@@ -407,9 +393,9 @@ int reg_event_syscall_exit(struct ftrace_event_call *call)
407{ 393{
408 int ret = 0; 394 int ret = 0;
409 int num; 395 int num;
410 char *name; 396 const char *name;
411 397
412 name = call->data; 398 name = ((struct syscall_metadata *)call->data)->name;
413 num = syscall_name_to_nr(name); 399 num = syscall_name_to_nr(name);
414 if (num < 0 || num >= NR_syscalls) 400 if (num < 0 || num >= NR_syscalls)
415 return -ENOSYS; 401 return -ENOSYS;
@@ -430,9 +416,9 @@ int reg_event_syscall_exit(struct ftrace_event_call *call)
430void unreg_event_syscall_exit(struct ftrace_event_call *call) 416void unreg_event_syscall_exit(struct ftrace_event_call *call)
431{ 417{
432 int num; 418 int num;
433 char *name; 419 const char *name;
434 420
435 name = call->data; 421 name = ((struct syscall_metadata *)call->data)->name;
436 num = syscall_name_to_nr(name); 422 num = syscall_name_to_nr(name);
437 if (num < 0 || num >= NR_syscalls) 423 if (num < 0 || num >= NR_syscalls)
438 return; 424 return;