tracing: Add boiler plate for subsystem filter
The system filter can be used to set multiple event filters that exist within the system. But currently it displays the last filter written that does not necessarily correspond to the filters within the system. The system filter itself is not used to filter any events. The system filter is just a means to set filters of the events within it. Because this causes an ambiguous state when the system filter reads a filter string but the events within the system have different strings it is best to just show a boiler plate: ### global filter ### # Use this to set filters for multiple events. # Only events with the given fields will be affected. # If no events are modified, an error message will be displayed here. If an error occurs while writing to the system filter, the system filter will replace the boiler plate with the error message as it currently does. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
Родитель
ed0449af53
Коммит
49aa29513e
|
@ -27,6 +27,12 @@
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
#include "trace_output.h"
|
#include "trace_output.h"
|
||||||
|
|
||||||
|
#define DEFAULT_SYS_FILTER_MESSAGE \
|
||||||
|
"### global filter ###\n" \
|
||||||
|
"# Use this to set filters for multiple events.\n" \
|
||||||
|
"# Only events with the given fields will be affected.\n" \
|
||||||
|
"# If no events are modified, an error message will be displayed here"
|
||||||
|
|
||||||
enum filter_op_ids
|
enum filter_op_ids
|
||||||
{
|
{
|
||||||
OP_OR,
|
OP_OR,
|
||||||
|
@ -646,7 +652,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
|
||||||
if (filter && filter->filter_string)
|
if (filter && filter->filter_string)
|
||||||
trace_seq_printf(s, "%s\n", filter->filter_string);
|
trace_seq_printf(s, "%s\n", filter->filter_string);
|
||||||
else
|
else
|
||||||
trace_seq_printf(s, "none\n");
|
trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
|
||||||
mutex_unlock(&event_mutex);
|
mutex_unlock(&event_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1838,7 +1844,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
|
||||||
if (!filter)
|
if (!filter)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
replace_filter_string(filter, filter_string);
|
/* System filters just show a default message */
|
||||||
|
kfree(filter->filter_string);
|
||||||
|
filter->filter_string = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* No event actually uses the system filter
|
* No event actually uses the system filter
|
||||||
* we can free it without synchronize_sched().
|
* we can free it without synchronize_sched().
|
||||||
|
@ -1848,14 +1857,12 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
|
||||||
|
|
||||||
parse_init(ps, filter_ops, filter_string);
|
parse_init(ps, filter_ops, filter_string);
|
||||||
err = filter_parse(ps);
|
err = filter_parse(ps);
|
||||||
if (err) {
|
if (err)
|
||||||
append_filter_err(ps, system->filter);
|
goto err_filter;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = replace_system_preds(system, ps, filter_string);
|
err = replace_system_preds(system, ps, filter_string);
|
||||||
if (err)
|
if (err)
|
||||||
append_filter_err(ps, system->filter);
|
goto err_filter;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
filter_opstack_clear(ps);
|
filter_opstack_clear(ps);
|
||||||
|
@ -1865,6 +1872,11 @@ out_unlock:
|
||||||
mutex_unlock(&event_mutex);
|
mutex_unlock(&event_mutex);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
err_filter:
|
||||||
|
replace_filter_string(filter, filter_string);
|
||||||
|
append_filter_err(ps, system->filter);
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PERF_EVENTS
|
#ifdef CONFIG_PERF_EVENTS
|
||||||
|
|
Загрузка…
Ссылка в новой задаче