Skip to content

Commit

Permalink
tracing: make trace_seq_reset global and rename to trace_seq_init
Browse files Browse the repository at this point in the history
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: Steven Rostedt <srostedt@redhat.com>
  • Loading branch information
Steven Rostedt committed Mar 2, 2009
1 parent 11a241a commit f952075
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 5 additions & 12 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,6 @@ __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
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)
{
int len;
Expand Down Expand Up @@ -395,7 +388,7 @@ trace_print_seq(struct seq_file *m, struct trace_seq *s)
s->buffer[len] = 0;
seq_puts(m, s->buffer);

trace_seq_reset(s);
trace_seq_init(s);
}

/**
Expand Down Expand Up @@ -2620,7 +2613,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
if (sret != -EBUSY)
return sret;

trace_seq_reset(&iter->seq);
trace_seq_init(&iter->seq);

/* copy the tracer to avoid using a global lock all around */
mutex_lock(&trace_types_lock);
Expand Down Expand Up @@ -2682,7 +2675,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
/* Now copy what we have to the user */
sret = trace_seq_to_user(&iter->seq, ubuf, cnt);
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
Expand Down Expand Up @@ -2819,7 +2812,7 @@ static ssize_t tracing_splice_read_pipe(struct file *filp,
partial[i].offset = 0;
partial[i].len = iter->seq.len;

trace_seq_reset(&iter->seq);
trace_seq_init(&iter->seq);
}

mutex_unlock(&iter->mutex);
Expand Down Expand Up @@ -3631,7 +3624,7 @@ trace_printk_seq(struct trace_seq *s)

printk(KERN_TRACE "%s", s->buffer);

trace_seq_reset(s);
trace_seq_init(s);
}

void ftrace_dump(void)
Expand Down
8 changes: 8 additions & 0 deletions kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,14 @@ struct trace_seq {
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

/*
Expand Down

0 comments on commit f952075

Please sign in to comment.