On Thu, 29 Apr 2021 07:01:18 +0300 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote: > --- a/lib/trace-cmd/include/private/trace-cmd-private.h > +++ b/lib/trace-cmd/include/private/trace-cmd-private.h > @@ -266,20 +266,25 @@ struct tracecmd_event_list { > struct tracecmd_option; > struct tracecmd_msg_handle; > > -struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, int cpus); > +struct tracecmd_output *tracecmd_create_file_latency(const char *output_file, int cpus, > + unsigned long file_version); > struct tracecmd_output * > -tracecmd_create_init_file_glob(const char *output_file, > - struct tracecmd_event_list *list); > +tracecmd_create_init_file_glob(const char *output_file, struct tracecmd_event_list *list, > + unsigned long file_version); > struct tracecmd_output *tracecmd_create_init_fd(int fd); > struct tracecmd_output * > -tracecmd_create_init_fd_glob(int fd, struct tracecmd_event_list *list); > +tracecmd_create_init_fd_glob(int fd, struct tracecmd_event_list *list, > + unsigned long file_version); > struct tracecmd_output * > tracecmd_create_init_fd_msg(struct tracecmd_msg_handle *msg_handle, > - struct tracecmd_event_list *list); > -struct tracecmd_output *tracecmd_create_init_file(const char *output_file); > + struct tracecmd_event_list *list, > + unsigned long file_version); > +struct tracecmd_output *tracecmd_create_init_file(const char *output_file, > + unsigned long file_version); > struct tracecmd_output *tracecmd_create_init_file_override(const char *output_file, > const char *tracing_dir, > - const char *kallsyms); > + const char *kallsyms, > + unsigned long file_version); > struct tracecmd_option *tracecmd_add_option(struct tracecmd_output *handle, > unsigned short id, int size, > const void *data); I think this is too complex of an API. The callers should not care what version the file is used. It should be automatic. That is, the init function can save the location of where it writes the version number as I described in the other email. When the user calls an API that requires a higher version than is recorded, we update it too. Now this may take some coordination if the versions change the state. But that too can be detected, as we can build an automata diagram to calculate what version the user is using to continue the states. -- Steve