tracing: Add __find_event_file() to find event files without restrictions

By adding the function __find_event_file() that can search for files without
restrictions, such as if the event associated with the file has a reg
function, or if it has the "ignore" flag set, the files that are associated
to ftrace internal events (like trace_marker and function events) can be
found and used.

find_event_file() still returns a "filtered" file, as most callers need a
valid trace event file. One created by the trace_events.h macros and not one
created for parsing ftrace specific events.
Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent c94e45bc
...@@ -1454,6 +1454,9 @@ extern void trace_event_enable_tgid_record(bool enable); ...@@ -1454,6 +1454,9 @@ extern void trace_event_enable_tgid_record(bool enable);
extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr); extern int event_trace_add_tracer(struct dentry *parent, struct trace_array *tr);
extern int event_trace_del_tracer(struct trace_array *tr); extern int event_trace_del_tracer(struct trace_array *tr);
extern struct trace_event_file *__find_event_file(struct trace_array *tr,
const char *system,
const char *event);
extern struct trace_event_file *find_event_file(struct trace_array *tr, extern struct trace_event_file *find_event_file(struct trace_array *tr,
const char *system, const char *system,
const char *event); const char *event);
......
...@@ -2473,8 +2473,9 @@ __trace_add_event_dirs(struct trace_array *tr) ...@@ -2473,8 +2473,9 @@ __trace_add_event_dirs(struct trace_array *tr)
} }
} }
/* Returns any file that matches the system and event */
struct trace_event_file * struct trace_event_file *
find_event_file(struct trace_array *tr, const char *system, const char *event) __find_event_file(struct trace_array *tr, const char *system, const char *event)
{ {
struct trace_event_file *file; struct trace_event_file *file;
struct trace_event_call *call; struct trace_event_call *call;
...@@ -2485,10 +2486,7 @@ find_event_file(struct trace_array *tr, const char *system, const char *event) ...@@ -2485,10 +2486,7 @@ find_event_file(struct trace_array *tr, const char *system, const char *event)
call = file->event_call; call = file->event_call;
name = trace_event_name(call); name = trace_event_name(call);
if (!name || !call->class || !call->class->reg) if (!name || !call->class)
continue;
if (call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
continue; continue;
if (strcmp(event, name) == 0 && if (strcmp(event, name) == 0 &&
...@@ -2498,6 +2496,20 @@ find_event_file(struct trace_array *tr, const char *system, const char *event) ...@@ -2498,6 +2496,20 @@ find_event_file(struct trace_array *tr, const char *system, const char *event)
return NULL; return NULL;
} }
/* Returns valid trace event files that match system and event */
struct trace_event_file *
find_event_file(struct trace_array *tr, const char *system, const char *event)
{
struct trace_event_file *file;
file = __find_event_file(tr, system, event);
if (!file || !file->event_call->class->reg ||
file->event_call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)
return NULL;
return file;
}
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
/* Avoid typos */ /* Avoid typos */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment