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
);
18 int ftrace_startup_subops(struct ftrace_ops
*ops
, struct ftrace_ops
*subops
, int command
);
19 int ftrace_shutdown_subops(struct ftrace_ops
*ops
, struct ftrace_ops
*subops
, int command
);
21 #else /* !CONFIG_DYNAMIC_FTRACE */
23 /* Keep as macros so we do not need to define the commands */
24 # define ftrace_startup(ops, command) \
26 int ___ret = __register_ftrace_function(ops); \
28 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
31 # define ftrace_shutdown(ops, command) \
33 int ___ret = __unregister_ftrace_function(ops); \
35 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
39 ftrace_ops_test(struct ftrace_ops
*ops
, unsigned long ip
, void *regs
)
43 static inline int ftrace_startup_subops(struct ftrace_ops
*ops
, struct ftrace_ops
*subops
, int command
)
47 static inline int ftrace_shutdown_subops(struct ftrace_ops
*ops
, struct ftrace_ops
*subops
, int command
)
51 #endif /* CONFIG_DYNAMIC_FTRACE */
53 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
54 extern int ftrace_graph_active
;
55 # ifdef CONFIG_DYNAMIC_FTRACE
56 extern void fgraph_update_pid_func(void);
58 static inline void fgraph_update_pid_func(void) {}
60 #else /* !CONFIG_FUNCTION_GRAPH_TRACER */
61 # define ftrace_graph_active 0
62 static inline void fgraph_update_pid_func(void) {}
63 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
65 #else /* !CONFIG_FUNCTION_TRACER */
66 #endif /* CONFIG_FUNCTION_TRACER */