4 * Copyright (C) 2008 Steven Noonan <steven@uplinklabs.net>
8 #include <linux/module.h>
9 #include <linux/ftrace.h>
15 TRACE_NOP_OPT_ACCEPT
= 0x1,
16 TRACE_NOP_OPT_REFUSE
= 0x2
19 /* Options for the tracer (see trace_options file) */
20 static struct tracer_opt nop_opts
[] = {
21 /* Option that will be accepted by set_flag callback */
22 { TRACER_OPT(test_nop_accept
, TRACE_NOP_OPT_ACCEPT
) },
23 /* Option that will be refused by set_flag callback */
24 { TRACER_OPT(test_nop_refuse
, TRACE_NOP_OPT_REFUSE
) },
25 { } /* Always set a last empty entry */
28 static struct tracer_flags nop_flags
= {
29 /* You can check your flags value here when you want. */
30 .val
= 0, /* By default: all flags disabled */
34 static struct trace_array
*ctx_trace
;
36 static void start_nop_trace(struct trace_array
*tr
)
41 static void stop_nop_trace(struct trace_array
*tr
)
46 static int nop_trace_init(struct trace_array
*tr
)
53 static void nop_trace_reset(struct trace_array
*tr
)
58 /* It only serves as a signal handler and a callback to
59 * accept or refuse tthe setting of a flag.
60 * If you don't implement it, then the flag setting will be
61 * automatically accepted.
63 static int nop_set_flag(struct trace_array
*tr
, u32 old_flags
, u32 bit
, int set
)
66 * Note that you don't need to update nop_flags.val yourself.
67 * The tracing Api will do it automatically if you return 0
69 if (bit
== TRACE_NOP_OPT_ACCEPT
) {
70 printk(KERN_DEBUG
"nop_test_accept flag set to %d: we accept."
71 " Now cat trace_options to see the result\n",
76 if (bit
== TRACE_NOP_OPT_REFUSE
) {
77 printk(KERN_DEBUG
"nop_test_refuse flag set to %d: we refuse."
78 "Now cat trace_options to see the result\n",
87 struct tracer nop_trace __read_mostly
=
90 .init
= nop_trace_init
,
91 .reset
= nop_trace_reset
,
92 #ifdef CONFIG_FTRACE_SELFTEST
93 .selftest
= trace_selftest_startup_nop
,
96 .set_flag
= nop_set_flag
,
97 .allow_instances
= true,