Re: [PATCH v2 5/7] trace-cmd library: Select the file version when writing trace file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 29 Apr 2021 07:01:17 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx> wrote:

> index 9231c319..f36718f1 100644
> --- a/lib/trace-cmd/trace-output.c
> +++ b/lib/trace-cmd/trace-output.c
> @@ -57,6 +57,7 @@ struct tracecmd_output {
>  	int			nr_options;
>  	bool			quiet;
>  	unsigned long		file_state;
> +	unsigned long		file_version;
>  	struct list_head	options;
>  	struct tracecmd_msg_handle *msg_handle;
>  	char			*trace_clock;
> @@ -907,6 +908,17 @@ out_free:
>  	return ret;
>  }
>  
> +static int select_file_version(struct tracecmd_output *handle,
> +				struct tracecmd_input *ihandle)
> +{
> +	if (ihandle)
> +		handle->file_version = tracecmd_get_file_version(ihandle);
> +	else
> +		handle->file_version = FILE_VERSION;
> +
> +	return 0;
> +}
> +

This is where we should have the logic for what we write.

We save a string where the version is going to be located. We default it to
the lowest level (6), and then if a feature is recorded that is of a higher
version, we up it, and change the number of disk as well.

If there's a case where we get to two digit strings, we should have it be:

  "6 \0"

which should still work. Then if we use a feature that requires version 10,
it would be updated to:

  "10\0"

We can do this at the end of recording.

-- Steve



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux