tracing: always provide a prototype for tracing_alloc_snapshot()
PATCH 1/1 tracing: always provide a prototype for tracing_alloc_snapshot()
The tracing_alloc_snapshot() symbol is always exported even with !CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or we'll see the following warning:
kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
820 | int tracing_alloc_snapshot(void)
| ^~~~~~~~~~~~~~~~~~~~~~
--- kernel/trace/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/trace/trace.h +2 -1
@@ -2275,6 +2275,8 @@ static inline void __init trace_event_init(void) { }static inline void trace_event_update_all (struct trace_eval_map **map,int len) { }#endif +int tracing_alloc_snapshot (void ); +#ifdef CONFIG_TRACER_SNAPSHOT extern const struct file_operations snapshot_fops;extern const struct file_operations snapshot_raw_fops;
@@ -2282,7 +2284,6 @@ extern const struct file_operations snapshot_raw_fops;/* Used when creating instances */ int trace_allocate_snapshot (struct trace_array *tr,int size); -int tracing_alloc_snapshot (void );void tracing_snapshot_cond (struct trace_array *tr,void *cond_data);int tracing_snapshot_cond_enable (struct trace_array *tr,void *cond_data,cond_update_fn_t update);int tracing_snapshot_cond_disable (struct trace_array *tr);
Signature · 1 line
2.47.3
Quoted 10 lines · On Tue, 31 Mar 2026 10:20:01 +0200 Bartosz Golaszewski…
The
tracing_alloc_snapshot()symbol is always exported even with !CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or we'll see the following warning:
kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
820 | inttracing_alloc_snapshot(void)| ^~~~~~~~~~~~~~~~~~~~~~Fixes bade44fe5462 ("tracing: Move snapshot code out of trace.c and into trace_snapshot.c")Signed-off-by Bartosz Golaszewski <[email protected]>
Good catch!
Thanks!
Quoted 28 lines
--- kernel/trace/trace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)kernel/trace/trace.h +2
-1@@ -2275,6 +2275,8 @@ static inline void __init trace_event_init(void) { }static inline void trace_event_update_all (struct trace_eval_map **map,int len) { }#endif +int tracing_alloc_snapshot (void ); +#ifdef CONFIG_TRACER_SNAPSHOT extern const struct file_operations snapshot_fops;extern const struct file_operations snapshot_raw_fops;@@ -2282,7 +2284,6 @@ extern const struct file_operations snapshot_raw_fops;/* Used when creating instances */ int trace_allocate_snapshot (struct trace_array *tr,int size); -int tracing_alloc_snapshot (void );void tracing_snapshot_cond (struct trace_array *tr,void *cond_data);int tracing_snapshot_cond_enable (struct trace_array *tr,void *cond_data,cond_update_fn_t update);int tracing_snapshot_cond_disable (struct trace_array *tr);Signature · 1 line
2.47.3
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Steven Rostedt
maintainerQuoted 11 lines · On Tue, 31 Mar 2026 18:20:36 +0900 Masami Hiramatsu (Google)…
Quoted 8 lines · On Tue, 31 Mar 2026 10:20:01 +0200 Bartosz Golaszewski…
The
tracing_alloc_snapshot()symbol is always exported even with !CONFIG_TRACER_SNAPSHOT so the prototype too must be always visible or we'll see the following warning:
kernel/trace/trace.c:820:5: warning: no previous prototype for ‘tracing_alloc_snapshot’ [-Wmissing-prototypes]
820 | inttracing_alloc_snapshot(void)| ^~~~~~~~~~~~~~~~~~~~~~
Quoted 6 lines
Quoted 2 lines
Fixes bade44fe5462 ("tracing: Move snapshot code out of trace.c and into trace_snapshot.c")Signed-off-by Bartosz Golaszewski <[email protected]>Good catch!
But is the wrong fix. I already fixed it properly:
https://patch.msgid.link/20260328101946.2c4ef4a5@robin
It's still in the testing phase but will be going to linux-next this week.
-- Steve