aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_output.c
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-06-26 09:42:41 -0400
committerSteven Rostedt <rostedt@goodmis.org>2014-07-01 07:13:39 -0400
commit7b039cb4c5a90d8ea576b17e096f7334457aeb57 (patch)
treef901548a3740e26a36f142e049e28918199ca67f /kernel/trace/trace_output.c
parent3f4d8f78a07dba1cb333ce749bd6a15c1ada362d (diff)
tracing: Add trace_seq_buffer_ptr() helper function
There's several locations in the kernel that open code the calculation of the next location in the trace_seq buffer. This is usually done with p->buffer + p->len Instead of having this open coded, supply a helper function in the header to do it for them. This function is called trace_seq_buffer_ptr(). Link: http://lkml.kernel.org/p/20140626220129.452783019@goodmis.org Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r--kernel/trace/trace_output.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index b8930f79a04b..c6977d5a9b12 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -75,7 +75,7 @@ ftrace_print_flags_seq(struct trace_seq *p, const char *delim,
75{ 75{
76 unsigned long mask; 76 unsigned long mask;
77 const char *str; 77 const char *str;
78 const char *ret = p->buffer + p->len; 78 const char *ret = trace_seq_buffer_ptr(p);
79 int i, first = 1; 79 int i, first = 1;
80 80
81 for (i = 0; flag_array[i].name && flags; i++) { 81 for (i = 0; flag_array[i].name && flags; i++) {
@@ -111,7 +111,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
111 const struct trace_print_flags *symbol_array) 111 const struct trace_print_flags *symbol_array)
112{ 112{
113 int i; 113 int i;
114 const char *ret = p->buffer + p->len; 114 const char *ret = trace_seq_buffer_ptr(p);
115 115
116 for (i = 0; symbol_array[i].name; i++) { 116 for (i = 0; symbol_array[i].name; i++) {
117 117
@@ -122,7 +122,7 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val,
122 break; 122 break;
123 } 123 }
124 124
125 if (ret == (const char *)(p->buffer + p->len)) 125 if (ret == (const char *)(trace_seq_buffer_ptr(p)))
126 trace_seq_printf(p, "0x%lx", val); 126 trace_seq_printf(p, "0x%lx", val);
127 127
128 trace_seq_putc(p, 0); 128 trace_seq_putc(p, 0);
@@ -137,7 +137,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
137 const struct trace_print_flags_u64 *symbol_array) 137 const struct trace_print_flags_u64 *symbol_array)
138{ 138{
139 int i; 139 int i;
140 const char *ret = p->buffer + p->len; 140 const char *ret = trace_seq_buffer_ptr(p);
141 141
142 for (i = 0; symbol_array[i].name; i++) { 142 for (i = 0; symbol_array[i].name; i++) {
143 143
@@ -148,7 +148,7 @@ ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val,
148 break; 148 break;
149 } 149 }
150 150
151 if (ret == (const char *)(p->buffer + p->len)) 151 if (ret == (const char *)(trace_seq_buffer_ptr(p)))
152 trace_seq_printf(p, "0x%llx", val); 152 trace_seq_printf(p, "0x%llx", val);
153 153
154 trace_seq_putc(p, 0); 154 trace_seq_putc(p, 0);
@@ -162,7 +162,7 @@ const char *
162ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr, 162ftrace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr,
163 unsigned int bitmask_size) 163 unsigned int bitmask_size)
164{ 164{
165 const char *ret = p->buffer + p->len; 165 const char *ret = trace_seq_buffer_ptr(p);
166 166
167 trace_seq_bitmask(p, bitmask_ptr, bitmask_size * 8); 167 trace_seq_bitmask(p, bitmask_ptr, bitmask_size * 8);
168 trace_seq_putc(p, 0); 168 trace_seq_putc(p, 0);
@@ -175,7 +175,7 @@ const char *
175ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) 175ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len)
176{ 176{
177 int i; 177 int i;
178 const char *ret = p->buffer + p->len; 178 const char *ret = trace_seq_buffer_ptr(p);
179 179
180 for (i = 0; i < buf_len; i++) 180 for (i = 0; i < buf_len; i++)
181 trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]); 181 trace_seq_printf(p, "%s%2.2x", i == 0 ? "" : " ", buf[i]);