tracing: Adding new functions for kernel access to Ftrace instances
Adding 2 new functions - 1) struct trace_array *trace_array_get_by_name(const char *name); Return pointer to a trace array with given name. If it does not exist, create and return pointer to the new trace array. 2) int trace_array_set_clr_event(struct trace_array *tr, const char *system ,const char *event, bool enable); Enable/Disable events to this trace array. Additionally, - To handle reference counters, export trace_array_put() - Due to introduction of the above 2 new functions, we no longer need to export - ftrace_set_clr_event & trace_array_create APIs. Link: http://lkml.kernel.org/r/1574276919-11119-2-git-send-email-divya.indi@oracle.com Signed-off-by: Divya Indi <divya.indi@oracle.com> Reviewed-by: Aruna Ramakrishna <aruna.ramakrishna@oracle.com> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:

committed by
Steven Rostedt (VMware)

parent
fc809bc5ce
commit
2887978714
@@ -827,7 +827,6 @@ int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set)
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(ftrace_set_clr_event);
|
||||
|
||||
/**
|
||||
* trace_set_clr_event - enable or disable an event
|
||||
@@ -852,6 +851,32 @@ int trace_set_clr_event(const char *system, const char *event, int set)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(trace_set_clr_event);
|
||||
|
||||
/**
|
||||
* trace_array_set_clr_event - enable or disable an event for a trace array.
|
||||
* @tr: concerned trace array.
|
||||
* @system: system name to match (NULL for any system)
|
||||
* @event: event name to match (NULL for all events, within system)
|
||||
* @enable: true to enable, false to disable
|
||||
*
|
||||
* This is a way for other parts of the kernel to enable or disable
|
||||
* event recording.
|
||||
*
|
||||
* Returns 0 on success, -EINVAL if the parameters do not match any
|
||||
* registered events.
|
||||
*/
|
||||
int trace_array_set_clr_event(struct trace_array *tr, const char *system,
|
||||
const char *event, bool enable)
|
||||
{
|
||||
int set;
|
||||
|
||||
if (!tr)
|
||||
return -ENOENT;
|
||||
|
||||
set = (enable == true) ? 1 : 0;
|
||||
return __ftrace_set_clr_event(tr, NULL, system, event, set);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(trace_array_set_clr_event);
|
||||
|
||||
/* 128 should be much more than enough */
|
||||
#define EVENT_BUF_SIZE 127
|
||||
|
||||
|
Reference in New Issue
Block a user