diff options
author | Namhyung Kim <namhyung.kim@lge.com> | 2013-06-04 01:20:19 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-07-12 12:52:12 -0400 |
commit | 6a48aec3a7179b0cdae2339d5a4072214ee6c6fe (patch) | |
tree | 69c90f24708f8526819e9bb42601790757d4910c | |
parent | 79d5adf06dd530fe6a9ab3d086b2d23eb7560491 (diff) |
tools lib traceevent: Add trace_seq_reset()
Sometimes it'd be useful if existing trace_seq can be reused. But
currently it's impossible since there's no API to reset the trace_seq.
Let's add trace_seq_reset() for this case.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1370323231-14022-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/lib/traceevent/event-parse.h | 1 | ||||
-rw-r--r-- | tools/lib/traceevent/trace-seq.c | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h index bfceab948f22..39f0c1dca915 100644 --- a/tools/lib/traceevent/event-parse.h +++ b/tools/lib/traceevent/event-parse.h | |||
@@ -69,6 +69,7 @@ struct trace_seq { | |||
69 | }; | 69 | }; |
70 | 70 | ||
71 | void trace_seq_init(struct trace_seq *s); | 71 | void trace_seq_init(struct trace_seq *s); |
72 | void trace_seq_reset(struct trace_seq *s); | ||
72 | void trace_seq_destroy(struct trace_seq *s); | 73 | void trace_seq_destroy(struct trace_seq *s); |
73 | 74 | ||
74 | extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) | 75 | extern int trace_seq_printf(struct trace_seq *s, const char *fmt, ...) |
diff --git a/tools/lib/traceevent/trace-seq.c b/tools/lib/traceevent/trace-seq.c index a57db805136a..d7f2e68bc5b9 100644 --- a/tools/lib/traceevent/trace-seq.c +++ b/tools/lib/traceevent/trace-seq.c | |||
@@ -49,6 +49,19 @@ void trace_seq_init(struct trace_seq *s) | |||
49 | } | 49 | } |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * trace_seq_reset - re-initialize the trace_seq structure | ||
53 | * @s: a pointer to the trace_seq structure to reset | ||
54 | */ | ||
55 | void trace_seq_reset(struct trace_seq *s) | ||
56 | { | ||
57 | if (!s) | ||
58 | return; | ||
59 | TRACE_SEQ_CHECK(s); | ||
60 | s->len = 0; | ||
61 | s->readpos = 0; | ||
62 | } | ||
63 | |||
64 | /** | ||
52 | * trace_seq_destroy - free up memory of a trace_seq | 65 | * trace_seq_destroy - free up memory of a trace_seq |
53 | * @s: a pointer to the trace_seq to free the buffer | 66 | * @s: a pointer to the trace_seq to free the buffer |
54 | * | 67 | * |