Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
0003 #define  _LINUX_KERNEL_FTRACE_INTERNAL_H
0004 
0005 #ifdef CONFIG_FUNCTION_TRACER
0006 
0007 extern struct mutex ftrace_lock;
0008 extern struct ftrace_ops global_ops;
0009 
0010 #ifdef CONFIG_DYNAMIC_FTRACE
0011 
0012 int ftrace_startup(struct ftrace_ops *ops, int command);
0013 int ftrace_shutdown(struct ftrace_ops *ops, int command);
0014 int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
0015 
0016 #else /* !CONFIG_DYNAMIC_FTRACE */
0017 
0018 int __register_ftrace_function(struct ftrace_ops *ops);
0019 int __unregister_ftrace_function(struct ftrace_ops *ops);
0020 /* Keep as macros so we do not need to define the commands */
0021 # define ftrace_startup(ops, command)                   \
0022     ({                              \
0023         int ___ret = __register_ftrace_function(ops);       \
0024         if (!___ret)                        \
0025             (ops)->flags |= FTRACE_OPS_FL_ENABLED;      \
0026         ___ret;                         \
0027     })
0028 # define ftrace_shutdown(ops, command)                  \
0029     ({                              \
0030         int ___ret = __unregister_ftrace_function(ops);     \
0031         if (!___ret)                        \
0032             (ops)->flags &= ~FTRACE_OPS_FL_ENABLED;     \
0033         ___ret;                         \
0034     })
0035 static inline int
0036 ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
0037 {
0038     return 1;
0039 }
0040 #endif /* CONFIG_DYNAMIC_FTRACE */
0041 
0042 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
0043 extern int ftrace_graph_active;
0044 void update_function_graph_func(void);
0045 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
0046 # define ftrace_graph_active 0
0047 static inline void update_function_graph_func(void) { }
0048 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
0049 
0050 #else /* !CONFIG_FUNCTION_TRACER */
0051 #endif /* CONFIG_FUNCTION_TRACER */
0052 
0053 #endif