diff mbox series

[v2,37/87] trace-cmd library: Set log size to the input tep handler when it is read from the file

Message ID 20210729050959.12263-38-tz.stoyanov@gmail.com (mailing list archive)
State Superseded
Headers show
Series Trace file version 7 | expand

Commit Message

Tzvetomir Stoyanov (VMware) July 29, 2021, 5:09 a.m. UTC
Setting the long size to the input tep handler in tracecmd_read_headers()
API may be too late, as this tep handler is used to read and parse data
from the file before that. The most suitable place for that is
tracecmd_alloc_fd() API, right after reading the long size from the
file.

Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
---
 lib/trace-cmd/trace-input.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Steven Rostedt Aug. 19, 2021, 6:01 p.m. UTC | #1
On Thu, 29 Jul 2021 08:09:09 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:

> Setting the long size to the input tep handler in tracecmd_read_headers()
> API may be too late, as this tep handler is used to read and parse data
> from the file before that. The most suitable place for that is
> tracecmd_alloc_fd() API, right after reading the long size from the
> file.
> 

Typo in subject. I was expecting to see some log size get set ;-)

-- Steve

> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
> ---
>  lib/trace-cmd/trace-input.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
> index bf56c92a..0ced15a8 100644
> --- a/lib/trace-cmd/trace-input.c
> +++ b/lib/trace-cmd/trace-input.c
> @@ -976,8 +976,6 @@ int tracecmd_read_headers(struct tracecmd_input *handle,
>  	if (ret < 0)
>  		return -1;
>  
> -	tep_set_long_size(handle->pevent, handle->long_size);
> -
>  	if (state <= handle->file_state)
>  		return 0;
>  
> @@ -3473,6 +3471,7 @@ struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags)
>  
>  	do_read_check(handle, buf, 1);
>  	handle->long_size = buf[0];
> +	tep_set_long_size(handle->pevent, handle->long_size);
>  
>  	read4(handle, &page_size);
>  	handle->page_size = page_size;
diff mbox series

Patch

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index bf56c92a..0ced15a8 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -976,8 +976,6 @@  int tracecmd_read_headers(struct tracecmd_input *handle,
 	if (ret < 0)
 		return -1;
 
-	tep_set_long_size(handle->pevent, handle->long_size);
-
 	if (state <= handle->file_state)
 		return 0;
 
@@ -3473,6 +3471,7 @@  struct tracecmd_input *tracecmd_alloc_fd(int fd, int flags)
 
 	do_read_check(handle, buf, 1);
 	handle->long_size = buf[0];
+	tep_set_long_size(handle->pevent, handle->long_size);
 
 	read4(handle, &page_size);
 	handle->page_size = page_size;