Skip to content

Commit 42d120e

Browse files
Tom Zanussirostedt
authored andcommitted
tracing: Move is_good_name() from trace_probe.h to trace.h
is_good_name() is useful for other trace infrastructure, such as synthetic events, so make it available via trace.h. Link: https://lkml.kernel.org/r/cc6d6a2d7da6957fcbe1e2922e76d18d2bb459b4.1602598160.git.zanussi@kernel.org Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Tested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Tom Zanussi <zanussi@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
1 parent 7d27adf commit 42d120e

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

kernel/trace/trace.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/glob.h>
2020
#include <linux/irq_work.h>
2121
#include <linux/workqueue.h>
22+
#include <linux/ctype.h>
2223

2324
#ifdef CONFIG_FTRACE_SYSCALLS
2425
#include <asm/unistd.h> /* For NR_SYSCALLS */
@@ -2090,4 +2091,16 @@ static __always_inline void trace_iterator_reset(struct trace_iterator *iter)
20902091
iter->pos = -1;
20912092
}
20922093

2094+
/* Check the name is good for event/group/fields */
2095+
static inline bool is_good_name(const char *name)
2096+
{
2097+
if (!isalpha(*name) && *name != '_')
2098+
return false;
2099+
while (*++name != '\0') {
2100+
if (!isalpha(*name) && !isdigit(*name) && *name != '_')
2101+
return false;
2102+
}
2103+
return true;
2104+
}
2105+
20932106
#endif /* _LINUX_KERNEL_TRACE_H */

kernel/trace/trace_probe.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include <linux/tracefs.h>
1717
#include <linux/types.h>
1818
#include <linux/string.h>
19-
#include <linux/ctype.h>
2019
#include <linux/ptrace.h>
2120
#include <linux/perf_event.h>
2221
#include <linux/kprobes.h>
@@ -348,18 +347,6 @@ bool trace_probe_match_command_args(struct trace_probe *tp,
348347
#define trace_probe_for_each_link_rcu(pos, tp) \
349348
list_for_each_entry_rcu(pos, &(tp)->event->files, list)
350349

351-
/* Check the name is good for event/group/fields */
352-
static inline bool is_good_name(const char *name)
353-
{
354-
if (!isalpha(*name) && *name != '_')
355-
return false;
356-
while (*++name != '\0') {
357-
if (!isalpha(*name) && !isdigit(*name) && *name != '_')
358-
return false;
359-
}
360-
return true;
361-
}
362-
363350
#define TPARG_FL_RETURN BIT(0)
364351
#define TPARG_FL_KERNEL BIT(1)
365352
#define TPARG_FL_FENTRY BIT(2)

0 commit comments

Comments
 (0)