diff mbox series

[2/6] trace-cmd library: Add new API to get file version of input handler

Message ID 20210422071718.483383-3-tz.stoyanov@gmail.com (mailing list archive)
State Superseded
Headers show
Series Bump trace file version | expand

Commit Message

Tzvetomir Stoyanov (VMware) April 22, 2021, 7:17 a.m. UTC
Added an API to get the version of the trace file, associated with given
input file handler.
  tracecmd_get_file_version()

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 lib/trace-cmd/include/private/trace-cmd-private.h | 2 ++
 lib/trace-cmd/trace-input.c                       | 9 +++++++++
 2 files changed, 11 insertions(+)

Comments

Steven Rostedt April 29, 2021, 1:20 a.m. UTC | #1
On Thu, 22 Apr 2021 10:17:14 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> Added an API to get the version of the trace file, associated with given
> input file handler.
>   tracecmd_get_file_version()
> 
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  lib/trace-cmd/include/private/trace-cmd-private.h | 2 ++
>  lib/trace-cmd/trace-input.c                       | 9 +++++++++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
> index dccd8ae5..fa5b8880 100644
> --- a/lib/trace-cmd/include/private/trace-cmd-private.h
> +++ b/lib/trace-cmd/include/private/trace-cmd-private.h
> @@ -232,6 +232,8 @@ int tracecmd_set_cursor(struct tracecmd_input *handle,
>  unsigned long long
>  tracecmd_get_cursor(struct tracecmd_input *handle, int cpu);
>  
> +unsigned long tracecmd_get_file_version(struct tracecmd_input *handle);
> +
>  int tracecmd_ftrace_overrides(struct tracecmd_input *handle, struct tracecmd_ftrace *finfo);
>  bool tracecmd_get_use_trace_clock(struct tracecmd_input *handle);
>  tracecmd_show_data_func
> diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> index a00fa982..b2a03ab8 100644
> --- a/lib/trace-cmd/trace-input.c
> +++ b/lib/trace-cmd/trace-input.c
> @@ -4034,6 +4034,15 @@ struct tep_handle *tracecmd_get_tep(struct tracecmd_input *handle)
>  	return handle->pevent;
>  }
>  
> +/**
> + * tracecmd_get_file_version - return the trace.dat file version
> + * @handle: input handle for the trace.dat file
> + */
> +unsigned long tracecmd_get_file_version(struct tracecmd_input *handle)
> +{
> +	return handle->file_version;
> +}

This patch doesn't build:

trace-input.c: In function ‘tracecmd_get_file_version’:
trace-input.c:4033:15: error: ‘struct tracecmd_input’ has no member named ‘file_version’
 4033 |  return handle->file_version;
      |               ^~
trace-input.c:4034:1: warning: control reaches end of non-void function [-Wreturn-type]
 4034 | }
      | ^


-- Steve

> +
>  /**
>   * tracecmd_get_use_trace_clock - return use_trace_clock
>   * @handle: input handle for the trace.dat file
diff mbox series

Patch

diff --git a/lib/trace-cmd/include/private/trace-cmd-private.h b/lib/trace-cmd/include/private/trace-cmd-private.h
index dccd8ae5..fa5b8880 100644
--- a/lib/trace-cmd/include/private/trace-cmd-private.h
+++ b/lib/trace-cmd/include/private/trace-cmd-private.h
@@ -232,6 +232,8 @@  int tracecmd_set_cursor(struct tracecmd_input *handle,
 unsigned long long
 tracecmd_get_cursor(struct tracecmd_input *handle, int cpu);
 
+unsigned long tracecmd_get_file_version(struct tracecmd_input *handle);
+
 int tracecmd_ftrace_overrides(struct tracecmd_input *handle, struct tracecmd_ftrace *finfo);
 bool tracecmd_get_use_trace_clock(struct tracecmd_input *handle);
 tracecmd_show_data_func
diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index a00fa982..b2a03ab8 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -4034,6 +4034,15 @@  struct tep_handle *tracecmd_get_tep(struct tracecmd_input *handle)
 	return handle->pevent;
 }
 
+/**
+ * tracecmd_get_file_version - return the trace.dat file version
+ * @handle: input handle for the trace.dat file
+ */
+unsigned long tracecmd_get_file_version(struct tracecmd_input *handle)
+{
+	return handle->file_version;
+}
+
 /**
  * tracecmd_get_use_trace_clock - return use_trace_clock
  * @handle: input handle for the trace.dat file