trace_stat: don't call seq_printf() in seq_operation->start()
PATCH 1/1 trace_stat: don't call seq_printf() in seq_operation->start()
Impact: Fix incorrect way using seq_file's API
Use SEQ_START_TOKEN instead of calling ->stat_headers() int seq_operation->start().
Signed-off-by Lai Jiangshan <[email protected]>
---
kernel/trace/trace_stat.c +7 -1
@@ -160,7 +160,7 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)/* If we are in the beginning of the file, print the headers */ if (!*pos && session->ts->stat_headers) - session->ts->stat_headers (s); +return SEQ_START_TOKEN ;return seq_list_start (&session->stat_list, *pos); }
@@ -169,6 +169,9 @@ static void *stat_seq_next(struct seq_file *s, void *p, loff_t *pos) {struct tracer_stat_session *session = s->private; +if (p ==SEQ_START_TOKEN ) +return seq_list_start (&session->stat_list, *pos); +return seq_list_next (p, &session->stat_list, pos); }
@@ -183,6 +186,9 @@ static int stat_seq_show(struct seq_file *s, void *v)struct tracer_stat_session *session = s->private; struct trace_stat_list *l = list_entry(v, struct trace_stat_list, list); +if (v ==SEQ_START_TOKEN ) +return session->ts->stat_headers (s); +return session->ts->stat_show (s, l->stat); }
Commit-ID: e6f489013b985b58d096a3091ece0ed579367232 Gitweb: http://git.kernel.org/tip/e6f489013b985b58d096a3091ece0ed579367232 Author: Lai Jiangshan <[email protected]> AuthorDate: Wed, 25 Mar 2009 16:27:17 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 25 Mar 2009 18:32:34 +0100
trace_stat: don't call seq_printf() in seq_operation->start()
Impact: Fix incorrect way using seq_file's API
Use SEQ_START_TOKEN instead of calling ->stat_headers() int seq_operation->start().
Signed-off-by Lai Jiangshan <[email protected]>
Acked-by Steven Rostedt <[email protected]>
Cc Alexey Dobriyan <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- kernel/trace/trace_stat.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
kernel/trace/trace_stat.c +7 -1
@@ -163,7 +163,7 @@ static void *stat_seq_start(struct seq_file *s, loff_t *pos)/* If we are in the beginning of the file, print the headers */ if (!*pos && session->ts->stat_headers) - session->ts->stat_headers (s); +return SEQ_START_TOKEN ;return seq_list_start (&session->stat_list, *pos); }
@@ -172,6 +172,9 @@ static void *stat_seq_next(struct seq_file *s, void *p, loff_t *pos) {struct tracer_stat_session *session = s->private; +if (p ==SEQ_START_TOKEN ) +return seq_list_start (&session->stat_list, *pos); +return seq_list_next (p, &session->stat_list, pos); }
@@ -186,6 +189,9 @@ static int stat_seq_show(struct seq_file *s, void *v)struct tracer_stat_session *session = s->private; struct trace_stat_list *l = list_entry(v, struct trace_stat_list, list); +if (v ==SEQ_START_TOKEN ) +return session->ts->stat_headers (s); +return session->ts->stat_show (s, l->stat); }