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

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

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /kernel/trace/trace_nop.c (Version linux-6.11-rc3) and /kernel/trace/trace_nop.c (Version linux-5.10.223)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * nop tracer                                       3  * nop tracer
  4  *                                                  4  *
  5  * Copyright (C) 2008 Steven Noonan <steven@up      5  * Copyright (C) 2008 Steven Noonan <steven@uplinklabs.net>
  6  *                                                  6  *
  7  */                                                 7  */
  8                                                     8 
  9 #include <linux/module.h>                           9 #include <linux/module.h>
 10 #include <linux/ftrace.h>                          10 #include <linux/ftrace.h>
 11                                                    11 
 12 #include "trace.h"                                 12 #include "trace.h"
 13                                                    13 
 14 /* Our two options */                              14 /* Our two options */
 15 enum {                                             15 enum {
 16         TRACE_NOP_OPT_ACCEPT = 0x1,                16         TRACE_NOP_OPT_ACCEPT = 0x1,
 17         TRACE_NOP_OPT_REFUSE = 0x2                 17         TRACE_NOP_OPT_REFUSE = 0x2
 18 };                                                 18 };
 19                                                    19 
 20 /* Options for the tracer (see trace_options f     20 /* Options for the tracer (see trace_options file) */
 21 static struct tracer_opt nop_opts[] = {            21 static struct tracer_opt nop_opts[] = {
 22         /* Option that will be accepted by set     22         /* Option that will be accepted by set_flag callback */
 23         { TRACER_OPT(test_nop_accept, TRACE_NO     23         { TRACER_OPT(test_nop_accept, TRACE_NOP_OPT_ACCEPT) },
 24         /* Option that will be refused by set_     24         /* Option that will be refused by set_flag callback */
 25         { TRACER_OPT(test_nop_refuse, TRACE_NO     25         { TRACER_OPT(test_nop_refuse, TRACE_NOP_OPT_REFUSE) },
 26         { } /* Always set a last empty entry *     26         { } /* Always set a last empty entry */
 27 };                                                 27 };
 28                                                    28 
 29 static struct tracer_flags nop_flags = {           29 static struct tracer_flags nop_flags = {
 30         /* You can check your flags value here     30         /* You can check your flags value here when you want. */
 31         .val = 0, /* By default: all flags dis     31         .val = 0, /* By default: all flags disabled */
 32         .opts = nop_opts                           32         .opts = nop_opts
 33 };                                                 33 };
 34                                                    34 
 35 static struct trace_array       *ctx_trace;        35 static struct trace_array       *ctx_trace;
 36                                                    36 
 37 static void start_nop_trace(struct trace_array     37 static void start_nop_trace(struct trace_array *tr)
 38 {                                                  38 {
 39         /* Nothing to do! */                       39         /* Nothing to do! */
 40 }                                                  40 }
 41                                                    41 
 42 static void stop_nop_trace(struct trace_array      42 static void stop_nop_trace(struct trace_array *tr)
 43 {                                                  43 {
 44         /* Nothing to do! */                       44         /* Nothing to do! */
 45 }                                                  45 }
 46                                                    46 
 47 static int nop_trace_init(struct trace_array *     47 static int nop_trace_init(struct trace_array *tr)
 48 {                                                  48 {
 49         ctx_trace = tr;                            49         ctx_trace = tr;
 50         start_nop_trace(tr);                       50         start_nop_trace(tr);
 51         return 0;                                  51         return 0;
 52 }                                                  52 }
 53                                                    53 
 54 static void nop_trace_reset(struct trace_array     54 static void nop_trace_reset(struct trace_array *tr)
 55 {                                                  55 {
 56         stop_nop_trace(tr);                        56         stop_nop_trace(tr);
 57 }                                                  57 }
 58                                                    58 
 59 /* It only serves as a signal handler and a ca     59 /* It only serves as a signal handler and a callback to
 60  * accept or refuse the setting of a flag.         60  * accept or refuse the setting of a flag.
 61  * If you don't implement it, then the flag se     61  * If you don't implement it, then the flag setting will be
 62  * automatically accepted.                         62  * automatically accepted.
 63  */                                                63  */
 64 static int nop_set_flag(struct trace_array *tr     64 static int nop_set_flag(struct trace_array *tr, u32 old_flags, u32 bit, int set)
 65 {                                                  65 {
 66         /*                                         66         /*
 67          * Note that you don't need to update      67          * Note that you don't need to update nop_flags.val yourself.
 68          * The tracing Api will do it automati     68          * The tracing Api will do it automatically if you return 0
 69          */                                        69          */
 70         if (bit == TRACE_NOP_OPT_ACCEPT) {         70         if (bit == TRACE_NOP_OPT_ACCEPT) {
 71                 printk(KERN_DEBUG "nop_test_ac     71                 printk(KERN_DEBUG "nop_test_accept flag set to %d: we accept."
 72                         " Now cat trace_option     72                         " Now cat trace_options to see the result\n",
 73                         set);                      73                         set);
 74                 return 0;                          74                 return 0;
 75         }                                          75         }
 76                                                    76 
 77         if (bit == TRACE_NOP_OPT_REFUSE) {         77         if (bit == TRACE_NOP_OPT_REFUSE) {
 78                 printk(KERN_DEBUG "nop_test_re     78                 printk(KERN_DEBUG "nop_test_refuse flag set to %d: we refuse."
 79                         " Now cat trace_option     79                         " Now cat trace_options to see the result\n",
 80                         set);                      80                         set);
 81                 return -EINVAL;                    81                 return -EINVAL;
 82         }                                          82         }
 83                                                    83 
 84         return 0;                                  84         return 0;
 85 }                                                  85 }
 86                                                    86 
 87                                                    87 
 88 struct tracer nop_trace __read_mostly =            88 struct tracer nop_trace __read_mostly =
 89 {                                                  89 {
 90         .name           = "nop",                   90         .name           = "nop",
 91         .init           = nop_trace_init,          91         .init           = nop_trace_init,
 92         .reset          = nop_trace_reset,         92         .reset          = nop_trace_reset,
 93 #ifdef CONFIG_FTRACE_SELFTEST                      93 #ifdef CONFIG_FTRACE_SELFTEST
 94         .selftest       = trace_selftest_start     94         .selftest       = trace_selftest_startup_nop,
 95 #endif                                             95 #endif
 96         .flags          = &nop_flags,              96         .flags          = &nop_flags,
 97         .set_flag       = nop_set_flag,            97         .set_flag       = nop_set_flag,
 98         .allow_instances = true,                   98         .allow_instances = true,
 99 };                                                 99 };
100                                                   100 
101                                                   101 

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

kernel.org | git.kernel.org | LWN.net | Project Home | 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.

sflogo.php