diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2014-06-26 09:42:41 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2014-07-01 07:13:39 -0400 |
commit | 7b039cb4c5a90d8ea576b17e096f7334457aeb57 (patch) | |
tree | f901548a3740e26a36f142e049e28918199ca67f /include/linux/trace_seq.h | |
parent | 3f4d8f78a07dba1cb333ce749bd6a15c1ada362d (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 'include/linux/trace_seq.h')
-rw-r--r-- | include/linux/trace_seq.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/trace_seq.h b/include/linux/trace_seq.h index dd85753e1bb0..ea6c9dea79e3 100644 --- a/include/linux/trace_seq.h +++ b/include/linux/trace_seq.h | |||
@@ -25,6 +25,21 @@ trace_seq_init(struct trace_seq *s) | |||
25 | s->full = 0; | 25 | s->full = 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | /** | ||
29 | * trace_seq_buffer_ptr - return pointer to next location in buffer | ||
30 | * @s: trace sequence descriptor | ||
31 | * | ||
32 | * Returns the pointer to the buffer where the next write to | ||
33 | * the buffer will happen. This is useful to save the location | ||
34 | * that is about to be written to and then return the result | ||
35 | * of that write. | ||
36 | */ | ||
37 | static inline unsigned char * | ||
38 | trace_seq_buffer_ptr(struct trace_seq *s) | ||
39 | { | ||
40 | return s->buffer + s->len; | ||
41 | } | ||
42 | |||
28 | /* | 43 | /* |
29 | * Currently only defined when tracing is enabled. | 44 | * Currently only defined when tracing is enabled. |
30 | */ | 45 | */ |