[PATCH 08/12] tracing: declare __trace_bprintk_fmt/__tracepoint_str as external arrays
From: Vegard Nossum
Date: Sun Oct 16 2016 - 11:58:05 EST
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
---
kernel/trace/trace.c | 2 +-
kernel/trace/trace.h | 7 +++----
kernel/trace/trace_printk.c | 8 ++++----
3 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d1bee81..50af466 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7642,7 +7642,7 @@ __init static int tracer_alloc_buffers(void)
goto out_free_buffer_mask;
/* Only allocate trace_printk buffers if a trace_printk exists */
- if (__stop___trace_bprintk_fmt != __start___trace_bprintk_fmt)
+ if (ext_size(__trace_bprintk_fmt))
/* Must be called before global_trace.buffer is allocated */
trace_printk_init_buffers();
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index fd24b1f..75d2750 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -2,6 +2,7 @@
#ifndef _LINUX_KERNEL_TRACE_H
#define _LINUX_KERNEL_TRACE_H
+#include <linux/extarray.h>
#include <linux/fs.h>
#include <linux/atomic.h>
#include <linux/sched.h>
@@ -1605,11 +1606,9 @@ extern int trace_event_enable_disable(struct trace_event_file *file,
int enable, int soft_disable);
extern int tracing_alloc_snapshot(void);
-extern const char *__start___trace_bprintk_fmt[];
-extern const char *__stop___trace_bprintk_fmt[];
+DECLARE_EXTARRAY(const char *, __trace_bprintk_fmt);
-extern const char *__start___tracepoint_str[];
-extern const char *__stop___tracepoint_str[];
+DECLARE_EXTARRAY(const char *, __tracepoint_str);
void trace_printk_control(bool enabled);
void trace_printk_init_buffers(void);
diff --git a/kernel/trace/trace_printk.c b/kernel/trace/trace_printk.c
index ad1d6164..0d66509 100644
--- a/kernel/trace/trace_printk.c
+++ b/kernel/trace/trace_printk.c
@@ -255,10 +255,10 @@ static const char **find_next(void *v, loff_t *pos)
int start_index;
int last_index;
- start_index = __stop___trace_bprintk_fmt - __start___trace_bprintk_fmt;
+ start_index = ext_size(__trace_bprintk_fmt);
if (*pos < start_index)
- return __start___trace_bprintk_fmt + *pos;
+ return ext_start(__trace_bprintk_fmt) + *pos;
/*
* The __tracepoint_str section is treated the same as the
@@ -273,10 +273,10 @@ static const char **find_next(void *v, loff_t *pos)
* the ASCII text for userspace.
*/
last_index = start_index;
- start_index = __stop___tracepoint_str - __start___tracepoint_str;
+ start_index = ext_size(__tracepoint_str);
if (*pos < last_index + start_index)
- return __start___tracepoint_str + (*pos - last_index);
+ return ext_start(__tracepoint_str) + (*pos - last_index);
start_index += last_index;
return find_next_mod_format(start_index, v, fmt, pos);
--
2.10.0.479.g221bd91