diff mbox series

[v4,2/5] trace-cmd: Update long size in the tep handler right after it is read from the trace file

Message ID 20210226121306.216757-3-tz.stoyanov@gmail.com (mailing list archive)
State Accepted
Commit 89f6e246450c0defd05388e02cd9b539f7ef01f8
Headers show
Series Fix listener and add trace file validation | expand

Commit Message

Tzvetomir Stoyanov (VMware) Feb. 26, 2021, 12:13 p.m. UTC
The tracecmd_read_headers() API reads available headers from a trace
file. When a header is successfully read, the information gathered from it
should be applied in the internal structures, before continuing with the
next header. This will hek not to loose the information, in case not all
of the headers are in the file. This is useful for reading partial trace
file, used in trace-cmd listener and agent logic.

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 mbox series

Patch

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index 76bcb215..2004114d 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -782,6 +782,7 @@  int tracecmd_read_headers(struct tracecmd_input *handle)
 	ret = read_header_files(handle);
 	if (ret < 0)
 		return -1;
+	tep_set_long_size(handle->pevent, handle->long_size);
 
 	ret = read_ftrace_files(handle, NULL);
 	if (ret < 0)
@@ -808,8 +809,6 @@  int tracecmd_read_headers(struct tracecmd_input *handle)
 	if (read_options_type(handle) < 0)
 		return -1;
 
-	tep_set_long_size(handle->pevent, handle->long_size);
-
 	return 0;
 }