Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Use macro RAW_SYSCALL_ARGS_NUM to replace number

This patch defines a macro RAW_SYSCALL_ARGS_NUM to replace the open
coded number '6'.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: bpf@vger.kernel.org
Link: https://lore.kernel.org/r/20221121075237.127706-2-leo.yan@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Leo Yan and committed by
Arnaldo Carvalho de Melo
eadcab4c 6ed24944

+7 -4
+7 -4
tools/perf/builtin-trace.c
··· 88 88 # define F_LINUX_SPECIFIC_BASE 1024 89 89 #endif 90 90 91 + #define RAW_SYSCALL_ARGS_NUM 6 92 + 91 93 /* 92 94 * strtoul: Go from a string to a value, i.e. for msr: MSR_FS_BASE to 0xc0000100 93 95 */ ··· 110 108 const char *sys_enter, 111 109 *sys_exit; 112 110 } bpf_prog_name; 113 - struct syscall_arg_fmt arg[6]; 111 + struct syscall_arg_fmt arg[RAW_SYSCALL_ARGS_NUM]; 114 112 u8 nr_args; 115 113 bool errpid; 116 114 bool timeout; ··· 1231 1229 */ 1232 1230 struct bpf_map_syscall_entry { 1233 1231 bool enabled; 1234 - u16 string_args_len[6]; 1232 + u16 string_args_len[RAW_SYSCALL_ARGS_NUM]; 1235 1233 }; 1236 1234 1237 1235 /* ··· 1663 1661 { 1664 1662 int idx; 1665 1663 1666 - if (nr_args == 6 && sc->fmt && sc->fmt->nr_args != 0) 1664 + if (nr_args == RAW_SYSCALL_ARGS_NUM && sc->fmt && sc->fmt->nr_args != 0) 1667 1665 nr_args = sc->fmt->nr_args; 1668 1666 1669 1667 sc->arg_fmt = calloc(nr_args, sizeof(*sc->arg_fmt)); ··· 1814 1812 sc->tp_format = trace_event__tp_format("syscalls", tp_name); 1815 1813 } 1816 1814 1817 - if (syscall__alloc_arg_fmts(sc, IS_ERR(sc->tp_format) ? 6 : sc->tp_format->format.nr_fields)) 1815 + if (syscall__alloc_arg_fmts(sc, IS_ERR(sc->tp_format) ? 1816 + RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields)) 1818 1817 return -ENOMEM; 1819 1818 1820 1819 if (IS_ERR(sc->tp_format))