Messages in this thread | | | Date | Tue, 14 Jan 2014 21:56:55 -0500 | From | Steven Rostedt <> | Subject | Re: [PATCH 01/17] tools lib traceevent: Add state member to struct trace_seq |
| |
On Wed, 15 Jan 2014 11:49:28 +0900 Namhyung Kim <namhyung@kernel.org> 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@kernel.org> 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@goodmis.org>
I'll try to look at the rest of the patches tomorrow.
-- Steve
| |