~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/trace/trace_nop.c

Version: ~ [ linux-5.10-rc5 ] ~ [ linux-5.9.10 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.79 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.159 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.208 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.245 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.245 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * nop tracer
  3  *
  4  * Copyright (C) 2008 Steven Noonan <steven@uplinklabs.net>
  5  *
  6  */
  7 
  8 #include <linux/module.h>
  9 #include <linux/ftrace.h>
 10 
 11 #include "trace.h"
 12 
 13 /* Our two options */
 14 enum {
 15         TRACE_NOP_OPT_ACCEPT = 0x1,
 16         TRACE_NOP_OPT_REFUSE = 0x2
 17 };
 18 
 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 */
 26 };
 27 
 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 */
 31         .opts = nop_opts
 32 };
 33 
 34 static struct trace_array       *ctx_trace;
 35 
 36 static void start_nop_trace(struct trace_array *tr)
 37 {
 38         /* Nothing to do! */
 39 }
 40 
 41 static void stop_nop_trace(struct trace_array *tr)
 42 {
 43         /* Nothing to do! */
 44 }
 45 
 46 static int nop_trace_init(struct trace_array *tr)
 47 {
 48         ctx_trace = tr;
 49         start_nop_trace(tr);
 50         return 0;
 51 }
 52 
 53 static void nop_trace_reset(struct trace_array *tr)
 54 {
 55         stop_nop_trace(tr);
 56 }
 57 
 58 /* It only serves as a signal handler and a callback to
 59  * accept or refuse the setting of a flag.
 60  * If you don't implement it, then the flag setting will be
 61  * automatically accepted.
 62  */
 63 static int nop_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
 64 {
 65         /*
 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
 68          */
 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",
 72                         set);
 73                 return 0;
 74         }
 75 
 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",
 79                         set);
 80                 return -EINVAL;
 81         }
 82 
 83         return 0;
 84 }
 85 
 86 
 87 struct tracer nop_trace __read_mostly =
 88 {
 89         .name           = "nop",
 90         .init           = nop_trace_init,
 91         .reset          = nop_trace_reset,
 92 #ifdef CONFIG_FTRACE_SELFTEST
 93         .selftest       = trace_selftest_startup_nop,
 94 #endif
 95         .flags          = &nop_flags,
 96         .set_flag       = nop_set_flag,
 97         .allow_instances = true,
 98 };
 99 
100 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp