Commit f9520750 authored by Steven Rostedt's avatar Steven Rostedt

tracing: make trace_seq_reset global and rename to trace_seq_init

Impact: clean up

The trace_seq functions may be used separately outside of the ftrace
iterator. The trace_seq_reset is needed for these operations.

This patch also renames trace_seq_reset to the more appropriate
trace_seq_init.
Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
parent 11a241a3
...@@ -342,13 +342,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu) ...@@ -342,13 +342,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
tracing_record_cmdline(tsk); tracing_record_cmdline(tsk);
} }
static void
trace_seq_reset(struct trace_seq *s)
{
s->len = 0;
s->readpos = 0;
}
ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt) ssize_t trace_seq_to_user(struct trace_seq *s, char __user *ubuf, size_t cnt)
{ {
int len; int len;
...@@ -395,7 +388,7 @@ trace_print_seq(struct seq_file *m, struct trace_seq *s) ...@@ -395,7 +388,7 @@ trace_print_seq(struct seq_file *m, struct trace_seq *s)
s->buffer[len] = 0; s->buffer[len] = 0;
seq_puts(m, s->buffer); seq_puts(m, s->buffer);
trace_seq_reset(s); trace_seq_init(s);
} }
/** /**
...@@ -2620,7 +2613,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, ...@@ -2620,7 +2613,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
if (sret != -EBUSY) if (sret != -EBUSY)
return sret; return sret;
trace_seq_reset(&iter->seq); trace_seq_init(&iter->seq);
/* copy the tracer to avoid using a global lock all around */ /* copy the tracer to avoid using a global lock all around */
mutex_lock(&trace_types_lock); mutex_lock(&trace_types_lock);
...@@ -2682,7 +2675,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf, ...@@ -2682,7 +2675,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
/* Now copy what we have to the user */ /* Now copy what we have to the user */
sret = trace_seq_to_user(&iter->seq, ubuf, cnt); sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
if (iter->seq.readpos >= iter->seq.len) if (iter->seq.readpos >= iter->seq.len)
trace_seq_reset(&iter->seq); trace_seq_init(&iter->seq);
/* /*
* If there was nothing to send to user, inspite of consuming trace * If there was nothing to send to user, inspite of consuming trace
...@@ -2819,7 +2812,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp, ...@@ -2819,7 +2812,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
partial[i].offset = 0; partial[i].offset = 0;
partial[i].len = iter->seq.len; partial[i].len = iter->seq.len;
trace_seq_reset(&iter->seq); trace_seq_init(&iter->seq);
} }
mutex_unlock(&iter->mutex); mutex_unlock(&iter->mutex);
...@@ -3631,7 +3624,7 @@ trace_printk_seq(struct trace_seq *s) ...@@ -3631,7 +3624,7 @@ trace_printk_seq(struct trace_seq *s)
printk(KERN_TRACE "%s", s->buffer); printk(KERN_TRACE "%s", s->buffer);
trace_seq_reset(s); trace_seq_init(s);
} }
void ftrace_dump(void) void ftrace_dump(void)
......
...@@ -395,6 +395,14 @@ struct trace_seq { ...@@ -395,6 +395,14 @@ struct trace_seq {
unsigned int readpos; unsigned int readpos;
}; };
static inline void
trace_seq_init(struct trace_seq *s)
{
s->len = 0;
s->readpos = 0;
}
#define TRACE_PIPE_ALL_CPU -1 #define TRACE_PIPE_ALL_CPU -1
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment