Hi Steven, On Wed, Apr 17, 2019 at 1:48 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote: > .... > > +/** > > + * tracecmd_read_headers_failures - read the header information from trace.dat > > + * @handle: input handle for the trace.dat file > > + * @parsing_failures: return number of failures while parsing the event files > > + * > > + * This reads the trace.dat file for various information. Like the > > + * format of the ring buffer, event formats, ftrace formats, kallsyms > > + * and printk. > > + */ > > +int tracecmd_read_headers_failures(struct tracecmd_input *handle, > > + int *parsing_failures) > > Let's not add this. Instead add a "parsing_failures" to the > tracecmd_input handle, and add: > > int tracecmd_get_parsing_failures(struct tracecmd_input *handle) > { > return handle->parsing_failures; > } > I hesitated if to add new API, or use additional parameter to the existing functions. The reason for this change is to remove "parsing_failures" from traceevent library, that's why I decided not to move it to trace-cmd library. Using new library API is nicer, I can reimplement it in this way, but we may have the same concerns when trace-cmd library comes out. > > +{ > > + return _tracecmd_read_headers(handle, parsing_failures); > > +} > > + > > [..] > > > diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c > > index 52fa1bd..fe116cc 100644 > > --- a/tracecmd/trace-read.c > > +++ b/tracecmd/trace-read.c > > @@ -1417,6 +1417,7 @@ void trace_report (int argc, char **argv) > > unsigned long long tsoffset = 0; > > unsigned long long ts2secs = 0; > > unsigned long long ts2sc; > > + int parsing_failures; > > int show_stat = 0; > > int show_funcs = 0; > > int show_endian = 0; > > @@ -1714,10 +1715,10 @@ void trace_report (int argc, char **argv) > > tracecmd_print_events(handle, print_event); > > return; > > } > > - > > - ret = tracecmd_read_headers(handle); > > + parsing_failures = 0; > > + ret = tracecmd_read_headers_failures(handle, &parsing_failures); > > Here we should do: > > ret = tracecmd_read_headers(handle); > > > if (check_event_parsing) { > > - if (ret || tep_get_parsing_failures(pevent)) > > if (ret || tracecmd_get_parsing_failures(handle)) > > -- Steve > > > + if (ret || parsing_failures) > > exit(EINVAL); > > else > > exit(0); > -- Tzvetomir (Ceco) Stoyanov VMware Open Source Technology Center