1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
3 #define _LINUX_KERNEL_FTRACE_INTERNAL_H
5 int __register_ftrace_function(struct ftrace_ops *ops);
6 int __unregister_ftrace_function(struct ftrace_ops *ops);
8 #ifdef CONFIG_FUNCTION_TRACER
10 extern struct mutex ftrace_lock;
11 extern struct ftrace_ops global_ops;
13 #ifdef CONFIG_DYNAMIC_FTRACE
15 int ftrace_startup(struct ftrace_ops *ops, int command);
16 int ftrace_shutdown(struct ftrace_ops *ops, int command);
17 int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
19 #else /* !CONFIG_DYNAMIC_FTRACE */
21 /* Keep as macros so we do not need to define the commands */
22 # define ftrace_startup(ops, command) \
24 int ___ret = __register_ftrace_function(ops); \
26 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
29 # define ftrace_shutdown(ops, command) \
31 int ___ret = __unregister_ftrace_function(ops); \
33 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
37 ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
41 #endif /* CONFIG_DYNAMIC_FTRACE */
43 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
44 extern int ftrace_graph_active;
45 void update_function_graph_func(void);
46 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
47 # define ftrace_graph_active 0
48 static inline void update_function_graph_func(void) { }
49 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
51 #else /* !CONFIG_FUNCTION_TRACER */
52 #endif /* CONFIG_FUNCTION_TRACER */