提交 8c1a49ae 编写于 作者: S Steven Rostedt (Red Hat) 提交者: Steven Rostedt

tracing: Pass trace_array to set_flag callback

As options (flags) may affect instances instead of being global
the set_flag() callbacks need to receive the trace_array descriptor
of the instance they will be modifying.
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 6d0abeca
...@@ -1427,7 +1427,8 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter) ...@@ -1427,7 +1427,8 @@ static enum print_line_t blk_tracer_print_line(struct trace_iterator *iter)
return print_one_line(iter, true); return print_one_line(iter, true);
} }
static int blk_tracer_set_flag(u32 old_flags, u32 bit, int set) static int
blk_tracer_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
/* don't output context-info for blk_classic output */ /* don't output context-info for blk_classic output */
if (bit == TRACE_BLK_OPT_CLASSIC) { if (bit == TRACE_BLK_OPT_CLASSIC) {
......
...@@ -73,7 +73,8 @@ static struct tracer_flags dummy_tracer_flags = { ...@@ -73,7 +73,8 @@ static struct tracer_flags dummy_tracer_flags = {
.opts = dummy_tracer_opt .opts = dummy_tracer_opt
}; };
static int dummy_set_flag(u32 old_flags, u32 bit, int set) static int
dummy_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
return 0; return 0;
} }
...@@ -3339,13 +3340,14 @@ static int tracing_trace_options_show(struct seq_file *m, void *v) ...@@ -3339,13 +3340,14 @@ static int tracing_trace_options_show(struct seq_file *m, void *v)
return 0; return 0;
} }
static int __set_tracer_option(struct tracer *trace, static int __set_tracer_option(struct trace_array *tr,
struct tracer_flags *tracer_flags, struct tracer_flags *tracer_flags,
struct tracer_opt *opts, int neg) struct tracer_opt *opts, int neg)
{ {
struct tracer *trace = tr->current_trace;
int ret; int ret;
ret = trace->set_flag(tracer_flags->val, opts->bit, !neg); ret = trace->set_flag(tr, tracer_flags->val, opts->bit, !neg);
if (ret) if (ret)
return ret; return ret;
...@@ -3357,8 +3359,9 @@ static int __set_tracer_option(struct tracer *trace, ...@@ -3357,8 +3359,9 @@ static int __set_tracer_option(struct tracer *trace,
} }
/* Try to assign a tracer specific option */ /* Try to assign a tracer specific option */
static int set_tracer_option(struct tracer *trace, char *cmp, int neg) static int set_tracer_option(struct trace_array *tr, char *cmp, int neg)
{ {
struct tracer *trace = tr->current_trace;
struct tracer_flags *tracer_flags = trace->flags; struct tracer_flags *tracer_flags = trace->flags;
struct tracer_opt *opts = NULL; struct tracer_opt *opts = NULL;
int i; int i;
...@@ -3367,8 +3370,7 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg) ...@@ -3367,8 +3370,7 @@ static int set_tracer_option(struct tracer *trace, char *cmp, int neg)
opts = &tracer_flags->opts[i]; opts = &tracer_flags->opts[i];
if (strcmp(cmp, opts->name) == 0) if (strcmp(cmp, opts->name) == 0)
return __set_tracer_option(trace, trace->flags, return __set_tracer_option(tr, trace->flags, opts, neg);
opts, neg);
} }
return -EINVAL; return -EINVAL;
...@@ -3440,7 +3442,7 @@ static int trace_set_options(struct trace_array *tr, char *option) ...@@ -3440,7 +3442,7 @@ static int trace_set_options(struct trace_array *tr, char *option)
/* If no option could be set, test the specific tracer options */ /* If no option could be set, test the specific tracer options */
if (!trace_options[i]) if (!trace_options[i])
ret = set_tracer_option(tr->current_trace, cmp, neg); ret = set_tracer_option(tr, cmp, neg);
mutex_unlock(&trace_types_lock); mutex_unlock(&trace_types_lock);
...@@ -5689,7 +5691,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt, ...@@ -5689,7 +5691,7 @@ trace_options_write(struct file *filp, const char __user *ubuf, size_t cnt,
if (!!(topt->flags->val & topt->opt->bit) != val) { if (!!(topt->flags->val & topt->opt->bit) != val) {
mutex_lock(&trace_types_lock); mutex_lock(&trace_types_lock);
ret = __set_tracer_option(topt->tr->current_trace, topt->flags, ret = __set_tracer_option(topt->tr, topt->flags,
topt->opt, !val); topt->opt, !val);
mutex_unlock(&trace_types_lock); mutex_unlock(&trace_types_lock);
if (ret) if (ret)
......
...@@ -355,7 +355,8 @@ struct tracer { ...@@ -355,7 +355,8 @@ struct tracer {
void (*print_header)(struct seq_file *m); void (*print_header)(struct seq_file *m);
enum print_line_t (*print_line)(struct trace_iterator *iter); enum print_line_t (*print_line)(struct trace_iterator *iter);
/* If you handled the flag setting, return 0 */ /* If you handled the flag setting, return 0 */
int (*set_flag)(u32 old_flags, u32 bit, int set); int (*set_flag)(struct trace_array *tr,
u32 old_flags, u32 bit, int set);
/* Return 0 if OK with change, else return non-zero */ /* Return 0 if OK with change, else return non-zero */
int (*flag_changed)(struct tracer *tracer, int (*flag_changed)(struct tracer *tracer,
u32 mask, int set); u32 mask, int set);
......
...@@ -175,7 +175,8 @@ static void tracing_stop_function_trace(void) ...@@ -175,7 +175,8 @@ static void tracing_stop_function_trace(void)
unregister_ftrace_function(&trace_ops); unregister_ftrace_function(&trace_ops);
} }
static int func_set_flag(u32 old_flags, u32 bit, int set) static int
func_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
switch (bit) { switch (bit) {
case TRACE_FUNC_OPT_STACK: case TRACE_FUNC_OPT_STACK:
......
...@@ -1476,7 +1476,8 @@ void graph_trace_close(struct trace_iterator *iter) ...@@ -1476,7 +1476,8 @@ void graph_trace_close(struct trace_iterator *iter)
} }
} }
static int func_graph_set_flag(u32 old_flags, u32 bit, int set) static int
func_graph_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
if (bit == TRACE_GRAPH_PRINT_IRQS) if (bit == TRACE_GRAPH_PRINT_IRQS)
ftrace_graph_skip_irqs = !set; ftrace_graph_skip_irqs = !set;
......
...@@ -160,7 +160,8 @@ static struct ftrace_ops trace_ops __read_mostly = ...@@ -160,7 +160,8 @@ static struct ftrace_ops trace_ops __read_mostly =
#endif /* CONFIG_FUNCTION_TRACER */ #endif /* CONFIG_FUNCTION_TRACER */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static int irqsoff_set_flag(u32 old_flags, u32 bit, int set) static int
irqsoff_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
int cpu; int cpu;
...@@ -266,7 +267,8 @@ __trace_function(struct trace_array *tr, ...@@ -266,7 +267,8 @@ __trace_function(struct trace_array *tr,
#else #else
#define __trace_function trace_function #define __trace_function trace_function
static int irqsoff_set_flag(u32 old_flags, u32 bit, int set) static int
irqsoff_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
return -EINVAL; return -EINVAL;
} }
......
...@@ -62,7 +62,7 @@ static void nop_trace_reset(struct trace_array *tr) ...@@ -62,7 +62,7 @@ static void nop_trace_reset(struct trace_array *tr)
* If you don't implement it, then the flag setting will be * If you don't implement it, then the flag setting will be
* automatically accepted. * automatically accepted.
*/ */
static int nop_set_flag(u32 old_flags, u32 bit, int set) static int nop_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
/* /*
* Note that you don't need to update nop_flags.val yourself. * Note that you don't need to update nop_flags.val yourself.
......
...@@ -209,7 +209,8 @@ static void stop_func_tracer(int graph) ...@@ -209,7 +209,8 @@ static void stop_func_tracer(int graph)
} }
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER
static int wakeup_set_flag(u32 old_flags, u32 bit, int set) static int
wakeup_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
if (!(bit & TRACE_DISPLAY_GRAPH)) if (!(bit & TRACE_DISPLAY_GRAPH))
...@@ -311,7 +312,8 @@ __trace_function(struct trace_array *tr, ...@@ -311,7 +312,8 @@ __trace_function(struct trace_array *tr,
#else #else
#define __trace_function trace_function #define __trace_function trace_function
static int wakeup_set_flag(u32 old_flags, u32 bit, int set) static int
wakeup_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
{ {
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册