Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
3#define _LINUX_KERNEL_FTRACE_INTERNAL_H
4
5#ifdef CONFIG_FUNCTION_TRACER
6
7extern struct mutex ftrace_lock;
8extern struct ftrace_ops global_ops;
9
10#ifdef CONFIG_DYNAMIC_FTRACE
11
12int ftrace_startup(struct ftrace_ops *ops, int command);
13int ftrace_shutdown(struct ftrace_ops *ops, int command);
14int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
15
16#else /* !CONFIG_DYNAMIC_FTRACE */
17
18int __register_ftrace_function(struct ftrace_ops *ops);
19int __unregister_ftrace_function(struct ftrace_ops *ops);
20/* Keep as macros so we do not need to define the commands */
21# define ftrace_startup(ops, command) \
22 ({ \
23 int ___ret = __register_ftrace_function(ops); \
24 if (!___ret) \
25 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
26 ___ret; \
27 })
28# define ftrace_shutdown(ops, command) \
29 ({ \
30 int ___ret = __unregister_ftrace_function(ops); \
31 if (!___ret) \
32 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
33 ___ret; \
34 })
35static inline int
36ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
37{
38 return 1;
39}
40#endif /* CONFIG_DYNAMIC_FTRACE */
41
42#ifdef CONFIG_FUNCTION_GRAPH_TRACER
43extern int ftrace_graph_active;
44void update_function_graph_func(void);
45#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
46# define ftrace_graph_active 0
47static inline void update_function_graph_func(void) { }
48#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
49
50#else /* !CONFIG_FUNCTION_TRACER */
51#endif /* CONFIG_FUNCTION_TRACER */
52
53#endif
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_KERNEL_FTRACE_INTERNAL_H
3#define _LINUX_KERNEL_FTRACE_INTERNAL_H
4
5int __register_ftrace_function(struct ftrace_ops *ops);
6int __unregister_ftrace_function(struct ftrace_ops *ops);
7
8#ifdef CONFIG_FUNCTION_TRACER
9
10extern struct mutex ftrace_lock;
11extern struct ftrace_ops global_ops;
12
13#ifdef CONFIG_DYNAMIC_FTRACE
14
15int ftrace_startup(struct ftrace_ops *ops, int command);
16int ftrace_shutdown(struct ftrace_ops *ops, int command);
17int ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs);
18
19#else /* !CONFIG_DYNAMIC_FTRACE */
20
21/* Keep as macros so we do not need to define the commands */
22# define ftrace_startup(ops, command) \
23 ({ \
24 int ___ret = __register_ftrace_function(ops); \
25 if (!___ret) \
26 (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
27 ___ret; \
28 })
29# define ftrace_shutdown(ops, command) \
30 ({ \
31 int ___ret = __unregister_ftrace_function(ops); \
32 if (!___ret) \
33 (ops)->flags &= ~FTRACE_OPS_FL_ENABLED; \
34 ___ret; \
35 })
36static inline int
37ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip, void *regs)
38{
39 return 1;
40}
41#endif /* CONFIG_DYNAMIC_FTRACE */
42
43#ifdef CONFIG_FUNCTION_GRAPH_TRACER
44extern int ftrace_graph_active;
45void update_function_graph_func(void);
46#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
47# define ftrace_graph_active 0
48static inline void update_function_graph_func(void) { }
49#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
50
51#else /* !CONFIG_FUNCTION_TRACER */
52#endif /* CONFIG_FUNCTION_TRACER */
53
54#endif