0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/module.h>
0010 #include <linux/ftrace.h>
0011
0012 #include "trace.h"
0013
0014
0015 enum {
0016 TRACE_NOP_OPT_ACCEPT = 0x1,
0017 TRACE_NOP_OPT_REFUSE = 0x2
0018 };
0019
0020
0021 static struct tracer_opt nop_opts[] = {
0022
0023 { TRACER_OPT(test_nop_accept, TRACE_NOP_OPT_ACCEPT) },
0024
0025 { TRACER_OPT(test_nop_refuse, TRACE_NOP_OPT_REFUSE) },
0026 { }
0027 };
0028
0029 static struct tracer_flags nop_flags = {
0030
0031 .val = 0,
0032 .opts = nop_opts
0033 };
0034
0035 static struct trace_array *ctx_trace;
0036
0037 static void start_nop_trace(struct trace_array *tr)
0038 {
0039
0040 }
0041
0042 static void stop_nop_trace(struct trace_array *tr)
0043 {
0044
0045 }
0046
0047 static int nop_trace_init(struct trace_array *tr)
0048 {
0049 ctx_trace = tr;
0050 start_nop_trace(tr);
0051 return 0;
0052 }
0053
0054 static void nop_trace_reset(struct trace_array *tr)
0055 {
0056 stop_nop_trace(tr);
0057 }
0058
0059
0060
0061
0062
0063
0064 static int nop_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
0065 {
0066
0067
0068
0069
0070 if (bit == TRACE_NOP_OPT_ACCEPT) {
0071 printk(KERN_DEBUG "nop_test_accept flag set to %d: we accept."
0072 " Now cat trace_options to see the result\n",
0073 set);
0074 return 0;
0075 }
0076
0077 if (bit == TRACE_NOP_OPT_REFUSE) {
0078 printk(KERN_DEBUG "nop_test_refuse flag set to %d: we refuse."
0079 " Now cat trace_options to see the result\n",
0080 set);
0081 return -EINVAL;
0082 }
0083
0084 return 0;
0085 }
0086
0087
0088 struct tracer nop_trace __read_mostly =
0089 {
0090 .name = "nop",
0091 .init = nop_trace_init,
0092 .reset = nop_trace_reset,
0093 #ifdef CONFIG_FTRACE_SELFTEST
0094 .selftest = trace_selftest_startup_nop,
0095 #endif
0096 .flags = &nop_flags,
0097 .set_flag = nop_set_flag,
0098 .allow_instances = true,
0099 };
0100