Re: [PATCH 01/17] tools lib traceevent: Add state member to structtrace_seq

From: Steven Rostedt
Date: Tue Jan 14 2014 - 21:57:03 EST


On Wed, 15 Jan 2014 11:49:28 +0900
Namhyung Kim <namhyung@xxxxxxxxxx> wrote:

> Hi Steve,
>
> On Tue, 14 Jan 2014 21:00:58 -0500, Steven Rostedt wrote:
> > On Wed, 15 Jan 2014 10:45:24 +0900
> > Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> >>
> >> @@ -32,8 +33,9 @@
> >> #define TRACE_SEQ_POISON ((void *)0xdeadbeef)
> >> #define TRACE_SEQ_CHECK(s) \
> >> do { \
> >> - if ((s)->buffer == TRACE_SEQ_POISON) \
> >> - die("Usage of trace_seq after it was destroyed"); \
> >> + if (WARN_ONCE((s)->buffer == TRACE_SEQ_POISON, \
> >> + "Usage of trace_seq after it was destroyed")) \
> >> + (s)->state = TRACE_SEQ__BUFFER_POISONED; \
> >> } while (0)
> >>
> >> @@ -189,9 +205,15 @@ int trace_seq_putc(struct trace_seq *s, unsigned char c)
> >> {
> >> TRACE_SEQ_CHECK(s);
> >>
> >> + if (s->state != TRACE_SEQ__GOOD)
> >> + return 0;
> >> +
> >
> > Instead of adding all of these, we can extend the macro
> > TRACE_SEQ_CHECK() which does a
> > if (s->state != TRACE_SEQ__GOOD)
> > return;
> >
> > and a TRACE_SEQ_CHECK_RET() that does a return 0;
>
> Oh, it looks better. But I'd like to TRACE_SEQ_CHECK() as is for some
> cases. How about this?
>
>

Looks good to me.

Acked-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

I'll try to look at the rest of the patches tomorrow.

-- Steve


--
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/