From: Steven Rostedt <rostedt@goodmis.org>
To: "MOESSBAUER, Felix" <felix.moessbauer@siemens.com>
Cc: "linux-trace-devel@vger.kernel.org" <linux-trace-devel@vger.kernel.org>
Subject: Re: [PATCH] libtracecmd: Fix continuing in tracecmd_iterate_events_reverse()
Date: Mon, 24 Nov 2025 11:49:25 -0500 [thread overview]
Message-ID: <20251124114925.140f62b8@gandalf.local.home> (raw)
In-Reply-To: <6418211fd4d5673020b94a75b1ce8e7781b80d9d.camel@siemens.com>
On Mon, 24 Nov 2025 09:10:06 +0000
"MOESSBAUER, Felix" <felix.moessbauer@siemens.com> wrote:
> > + /*
> > + * If the callback exited out early, then set the cursor back
> > + * to the location of that record so that if this gets called
> > + * again with cont = true, it will continue where it left off.
> > + */
> > + if (page_offset) {
> > + /* Set the record to the previous record that was read */
> > + record = tracecmd_read_at(handle, page_offset - 4, NULL);
>
> Hi,
>
> where does the magic "- 4" come from?
It's just to get to the previous record. - 1 would likely work, but as I
know all events are aligned by a minimum of 4 bytes I used that. I probably
should add a comment about that.
>
> > + tracecmd_free_record(record);
>
> I still don't get why this fixes the issue. Does tracecmd_read_at has a
> side-effect to set the the internal cursor? If so, it IMHO would help
> to document this side effect in tracecmd_read_at().
Hmm, I guess I should. Yes, that's one of the things I consider "obvious",
but "obvious" is seldom obvious ;-)
Pretty much all tracecmd_read* functions set the internal cursor unless
stated otherwise.
-- Steve
prev parent reply other threads:[~2025-11-24 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 17:09 [PATCH] libtracecmd: Fix continuing in tracecmd_iterate_events_reverse() Steven Rostedt
2025-11-24 9:10 ` MOESSBAUER, Felix
2025-11-24 16:49 ` Steven Rostedt [this message]
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=20251124114925.140f62b8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=felix.moessbauer@siemens.com \
--cc=linux-trace-devel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).