Messages in this thread | | | From | Vaibhav Nagarnaik <> | Date | Fri, 29 Jul 2011 10:41:39 -0700 | Subject | Re: [PATCH v2 1/4] trace-cmd: Add parse error checking target |
| |
On Fri, Jul 29, 2011 at 7:19 AM, Steven Rostedt <rostedt@goodmis.org> wrote: > On Mon, 2011-07-25 at 11:39 -0700, Vaibhav Nagarnaik wrote: >> Add another target 'check-events' which parses all the event formats and >> returns whether there are any issues with the print format strings. >> >> With an error in the format, the return value is 22 (EINVAL) and for >> success, it is 0. > > Could you write up a man page for this too? > > >> Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> >> --- >> Changelog v2-v1: >> * Pass any parsing failures in pevent structure >> >> parse-events.h | 2 ++ >> trace-cmd.c | 25 +++++++++++++++++++++++++ >> trace-usage.c | 5 +++++ >> trace-util.c | 36 ++++++++++++++++++++++++++---------- >> 4 files changed, 58 insertions(+), 10 deletions(-) >> >> diff --git a/parse-events.h b/parse-events.h >> index c32d715..f5cab15 100644 >> --- a/parse-events.h >> +++ b/parse-events.h >> @@ -402,6 +402,8 @@ struct pevent { >> struct event_handler *handlers; >> struct pevent_function_handler *func_handlers; >> >> + int parsing_failures; >> + >> /* cache */ >> struct event_format *last_event; >> }; >> diff --git a/trace-cmd.c b/trace-cmd.c >> index bff5bbf..5cfd97f 100644 >> --- a/trace-cmd.c >> +++ b/trace-cmd.c >> @@ -158,6 +158,31 @@ int main (int argc, char **argv) >> } else if (strcmp(argv[1], "stack") == 0) { >> trace_stack(argc, argv); >> exit(0); >> + } else if (strcmp(argv[1], "check-events") == 0) { >> + char *tracing; >> + int ret; >> + struct pevent *pevent = NULL; >> + >> + tracing = tracecmd_find_tracing_dir(); >> + >> + if (!tracing) { >> + printf("Can not find or mount tracing directory!\n" >> + "Either tracing is not configured for this " >> + "kernel\n" >> + "or you do not have the proper permissions to " >> + "mount the directory"); >> + exit(EINVAL); >> + } >> + >> + ret = 0; >> + pevent = tracecmd_local_events(tracing); >> + if (!pevent) >> + exit(EINVAL); >> + if (pevent->parsing_failures) >> + ret = EINVAL; > > Hmm, what about doing: > > if (!pevent || pevent->parsing_failures) > ret = EINVAL; > > > >> + pevent_free(pevent); > > And allow pevent_free() to take a NULL pointer? > > Hmm, I'll just apply this patch and then make the update. But could you > still send a man page patch?
Thanks Steve. I will send the man page patch.
Vaibhav Nagarnaik -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |