Re: [RFC][PATCH 14/23 v4] tracing: Convert seq_buf_path() to be like seq_path()

From: Steven Rostedt
Date: Fri Nov 14 2014 - 12:48:04 EST


On Fri, 14 Nov 2014 17:53:08 +0100
Petr Mladek <pmladek@xxxxxxx> wrote:


> > /**
> > diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c
> > index 3c63b619d6b7..475412e31de5 100644
> > --- a/kernel/trace/trace_seq.c
> > +++ b/kernel/trace/trace_seq.c
> > @@ -342,7 +342,7 @@ int trace_seq_path(struct trace_seq *s, const struct path *path)
> > return 0;
> > }
> >
> > - ret = seq_buf_path(&s->seq, path);
> > + ret = seq_buf_path(&s->seq, path, "\n");
> >
> > if (unlikely(seq_buf_has_overflowed(&s->seq))) {
> > s->seq.len = save_len;
> > @@ -350,7 +350,7 @@ int trace_seq_path(struct trace_seq *s, const struct path *path)
> > return 0;
> > }
> >
> > - return ret;
> > + return 1;
>
> Ah, I have just realized that this should return -1 when
> seq_buf_path() returns -1.

It really doesn't matter as long as it's not zero. The one user just
tests if the return is zero or not.

trace_seq() doesn't have to follow all the same rules as seq_buf()
does, as seq_buf() is more in line with seq_file().


>
> Note that set_buf_path() does not longer calls seq_buf_set_overflow(s)
> when the path handling fails. Therefore the above check for overflow
> will probably never happen.

This is in a transitional state of the patch series. The final version
of seq_buf_path() will call seq_buf_commit() which will put the seq_buf
in an overflow state if it isn't correct. Trying to fix this version
here will probably just cause me to make another stupid mistake and
ruin the final version ;-)

-- Steve

>
> Best Regards,
> Petr
>
> > }
> > EXPORT_SYMBOL_GPL(trace_seq_path);
> >
> > --
> > 2.1.1
> >
> >

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/