All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
To: rostedt@goodmis.org
Cc: linux-trace-devel@vger.kernel.org
Subject: [PATCH 06/21] trace-cmd library: Set long size to the input tep handler when it is read from the file
Date: Fri, 10 Sep 2021 16:47:42 +0300	[thread overview]
Message-ID: <20210910134757.2863982-7-tz.stoyanov@gmail.com> (raw)
In-Reply-To: <20210910134757.2863982-1-tz.stoyanov@gmail.com>

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(-)

diff --git a/lib/trace-cmd/trace-input.c b/lib/trace-cmd/trace-input.c
index e5c8c332..3d7f1c48 100644
--- a/lib/trace-cmd/trace-input.c
+++ b/lib/trace-cmd/trace-input.c
@@ -860,8 +860,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;
 
@@ -3337,6 +3335,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;
-- 
2.31.1


  parent reply	other threads:[~2021-09-10 13:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-10 13:47 [PATCH 00/21] trace-cmd fixes and clean-ups Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 01/21] trace-cmd library: Read option id with correct endian Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 02/21] trace-cmd report: Fix typos in error messages Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 03/21] trace-cmd library: Fix version string memory leak Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 04/21] trace-cmd library: Fixed a memory leak on input handler close Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 05/21] trace-cmd library: Do not pass guests list to a buffer instance Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` Tzvetomir Stoyanov (VMware) [this message]
2021-09-10 13:47 ` [PATCH 07/21] trace-cmd library: Do not use local variables when reading CPU stat option Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 08/21] trace-cmd library: Reuse within the library the function that checks file state Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 09/21] trace-cmd library: Fix possible memory leak in read_ftrace_files() Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 10/21] trace-cmd library: Fix possible memory leak in read_event_files() Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 11/21] trace-cmd library: Fix possible memory leak in read_proc_kallsyms() Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 12/21] trace-cmd library: Fix possible memory leak in read_ftrace_printk() Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 13/21] trace-cmd library: Fix possible memory leak in read_and_parse_cmdlines() Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 14/21] trace-cmd library: Set input handler default values in allocation function Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 15/21] trace-cmd library: Track maximum CPUs count in input handler Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 16/21] trace-cmd report: Close input file handlers on exit Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 17/21] trace-cmd report: Do not print empty buffer name Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 18/21] trace-cmd library: Set correct CPU to the record, retrieved with tracecmd_peek_data Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 19/21] trace-cmd library: Refactor APIs for creating output handler Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 20/21] trace-cmd library: Refactor the logic for writing trace data in the file Tzvetomir Stoyanov (VMware)
2021-09-10 13:47 ` [PATCH 21/21] trace-cmd report: Init the top trace instance earlier Tzvetomir Stoyanov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210910134757.2863982-7-tz.stoyanov@gmail.com \
    --to=tz.stoyanov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.