aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2009-08-24 17:40:22 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-26 15:30:02 -0400
commit57421dbbdc932d65f0e6a41ebb027a2bfe3d0669 (patch)
tree0dec1f947cc6d3e9d5fe813c31cbaa960c9ed7b6
parenta5a2f8e2acb991327952c45a13f5441fc09dffd6 (diff)
tracing: Convert event tracing code to use NR_syscalls
Convert the syscalls event tracing code to use NR_syscalls, instead of FTRACE_SYSCALL_MAX. NR_syscalls is standard accross most arches, and reduces code confusion/complexity. Signed-off-by: Jason Baron <jbaron@redhat.com> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Jiaying Zhang <jiayingz@google.com> Cc: Martin Bligh <mbligh@google.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Josh Stone <jistone@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: H. Peter Anwin <hpa@zytor.com> Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> LKML-Reference: <9b4f1a84ecae57cc6599412772efa36f0d2b815b.1251146513.git.jbaron@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
-rw-r--r--arch/x86/kernel/ftrace.c8
-rw-r--r--kernel/trace/trace_syscalls.c24
2 files changed, 16 insertions, 16 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 3cff1214e176..9dbb527e1652 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -494,7 +494,7 @@ static struct syscall_metadata *find_syscall_meta(unsigned long *syscall)
494 494
495struct syscall_metadata *syscall_nr_to_meta(int nr) 495struct syscall_metadata *syscall_nr_to_meta(int nr)
496{ 496{
497 if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0) 497 if (!syscalls_metadata || nr >= NR_syscalls || nr < 0)
498 return NULL; 498 return NULL;
499 499
500 return syscalls_metadata[nr]; 500 return syscalls_metadata[nr];
@@ -507,7 +507,7 @@ int syscall_name_to_nr(char *name)
507 if (!syscalls_metadata) 507 if (!syscalls_metadata)
508 return -1; 508 return -1;
509 509
510 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { 510 for (i = 0; i < NR_syscalls; i++) {
511 if (syscalls_metadata[i]) { 511 if (syscalls_metadata[i]) {
512 if (!strcmp(syscalls_metadata[i]->name, name)) 512 if (!strcmp(syscalls_metadata[i]->name, name))
513 return i; 513 return i;
@@ -533,13 +533,13 @@ static int __init arch_init_ftrace_syscalls(void)
533 unsigned long **psys_syscall_table = &sys_call_table; 533 unsigned long **psys_syscall_table = &sys_call_table;
534 534
535 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * 535 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
536 FTRACE_SYSCALL_MAX, GFP_KERNEL); 536 NR_syscalls, GFP_KERNEL);
537 if (!syscalls_metadata) { 537 if (!syscalls_metadata) {
538 WARN_ON(1); 538 WARN_ON(1);
539 return -ENOMEM; 539 return -ENOMEM;
540 } 540 }
541 541
542 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { 542 for (i = 0; i < NR_syscalls; i++) {
543 meta = find_syscall_meta(psys_syscall_table[i]); 543 meta = find_syscall_meta(psys_syscall_table[i]);
544 syscalls_metadata[i] = meta; 544 syscalls_metadata[i] = meta;
545 } 545 }
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index cb7f600cb02a..4f5fae6fad90 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -11,8 +11,8 @@
11static DEFINE_MUTEX(syscall_trace_lock); 11static DEFINE_MUTEX(syscall_trace_lock);
12static int sys_refcount_enter; 12static int sys_refcount_enter;
13static int sys_refcount_exit; 13static int sys_refcount_exit;
14static DECLARE_BITMAP(enabled_enter_syscalls, FTRACE_SYSCALL_MAX); 14static DECLARE_BITMAP(enabled_enter_syscalls, NR_syscalls);
15static DECLARE_BITMAP(enabled_exit_syscalls, FTRACE_SYSCALL_MAX); 15static DECLARE_BITMAP(enabled_exit_syscalls, NR_syscalls);
16 16
17enum print_line_t 17enum print_line_t
18print_syscall_enter(struct trace_iterator *iter, int flags) 18print_syscall_enter(struct trace_iterator *iter, int flags)
@@ -289,7 +289,7 @@ int reg_event_syscall_enter(void *ptr)
289 289
290 name = (char *)ptr; 290 name = (char *)ptr;
291 num = syscall_name_to_nr(name); 291 num = syscall_name_to_nr(name);
292 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 292 if (num < 0 || num >= NR_syscalls)
293 return -ENOSYS; 293 return -ENOSYS;
294 mutex_lock(&syscall_trace_lock); 294 mutex_lock(&syscall_trace_lock);
295 if (!sys_refcount_enter) 295 if (!sys_refcount_enter)
@@ -312,7 +312,7 @@ void unreg_event_syscall_enter(void *ptr)
312 312
313 name = (char *)ptr; 313 name = (char *)ptr;
314 num = syscall_name_to_nr(name); 314 num = syscall_name_to_nr(name);
315 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 315 if (num < 0 || num >= NR_syscalls)
316 return; 316 return;
317 mutex_lock(&syscall_trace_lock); 317 mutex_lock(&syscall_trace_lock);
318 sys_refcount_enter--; 318 sys_refcount_enter--;
@@ -330,7 +330,7 @@ int reg_event_syscall_exit(void *ptr)
330 330
331 name = (char *)ptr; 331 name = (char *)ptr;
332 num = syscall_name_to_nr(name); 332 num = syscall_name_to_nr(name);
333 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 333 if (num < 0 || num >= NR_syscalls)
334 return -ENOSYS; 334 return -ENOSYS;
335 mutex_lock(&syscall_trace_lock); 335 mutex_lock(&syscall_trace_lock);
336 if (!sys_refcount_exit) 336 if (!sys_refcount_exit)
@@ -353,7 +353,7 @@ void unreg_event_syscall_exit(void *ptr)
353 353
354 name = (char *)ptr; 354 name = (char *)ptr;
355 num = syscall_name_to_nr(name); 355 num = syscall_name_to_nr(name);
356 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 356 if (num < 0 || num >= NR_syscalls)
357 return; 357 return;
358 mutex_lock(&syscall_trace_lock); 358 mutex_lock(&syscall_trace_lock);
359 sys_refcount_exit--; 359 sys_refcount_exit--;
@@ -373,8 +373,8 @@ struct trace_event event_syscall_exit = {
373 373
374#ifdef CONFIG_EVENT_PROFILE 374#ifdef CONFIG_EVENT_PROFILE
375 375
376static DECLARE_BITMAP(enabled_prof_enter_syscalls, FTRACE_SYSCALL_MAX); 376static DECLARE_BITMAP(enabled_prof_enter_syscalls, NR_syscalls);
377static DECLARE_BITMAP(enabled_prof_exit_syscalls, FTRACE_SYSCALL_MAX); 377static DECLARE_BITMAP(enabled_prof_exit_syscalls, NR_syscalls);
378static int sys_prof_refcount_enter; 378static int sys_prof_refcount_enter;
379static int sys_prof_refcount_exit; 379static int sys_prof_refcount_exit;
380 380
@@ -420,7 +420,7 @@ int reg_prof_syscall_enter(char *name)
420 int num; 420 int num;
421 421
422 num = syscall_name_to_nr(name); 422 num = syscall_name_to_nr(name);
423 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 423 if (num < 0 || num >= NR_syscalls)
424 return -ENOSYS; 424 return -ENOSYS;
425 425
426 mutex_lock(&syscall_trace_lock); 426 mutex_lock(&syscall_trace_lock);
@@ -442,7 +442,7 @@ void unreg_prof_syscall_enter(char *name)
442 int num; 442 int num;
443 443
444 num = syscall_name_to_nr(name); 444 num = syscall_name_to_nr(name);
445 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 445 if (num < 0 || num >= NR_syscalls)
446 return; 446 return;
447 447
448 mutex_lock(&syscall_trace_lock); 448 mutex_lock(&syscall_trace_lock);
@@ -481,7 +481,7 @@ int reg_prof_syscall_exit(char *name)
481 int num; 481 int num;
482 482
483 num = syscall_name_to_nr(name); 483 num = syscall_name_to_nr(name);
484 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 484 if (num < 0 || num >= NR_syscalls)
485 return -ENOSYS; 485 return -ENOSYS;
486 486
487 mutex_lock(&syscall_trace_lock); 487 mutex_lock(&syscall_trace_lock);
@@ -503,7 +503,7 @@ void unreg_prof_syscall_exit(char *name)
503 int num; 503 int num;
504 504
505 num = syscall_name_to_nr(name); 505 num = syscall_name_to_nr(name);
506 if (num < 0 || num >= FTRACE_SYSCALL_MAX) 506 if (num < 0 || num >= NR_syscalls)
507 return; 507 return;
508 508
509 mutex_lock(&syscall_trace_lock); 509 mutex_lock(&syscall_trace_lock);