lttng-dev.lists.lttng.org archive mirror
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: jgalar@efficios.com
Cc: lttng-dev@lists.lttng.org
Subject: [RFC PATCH lttng-tools] Fix: relayd: Swap endianness of packet index
Date: Fri,  8 Nov 2019 11:32:47 -0500	[thread overview]
Message-ID: <20191108163247.6821-1-mathieu.desnoyers__15559.2538112373$1573230787$gmane$org@efficios.com> (raw)

The packet index in stream_update_index() is meant to be stored
to disk, and therefore is kept in big endian.

Swap its endianness to host endian before using it internally.

Fixes "Fix: relayd: use packet sequence number for rotation position".

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
---
 src/bin/lttng-relayd/stream.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bin/lttng-relayd/stream.c b/src/bin/lttng-relayd/stream.c
index c5bf3759..f9ff5e9a 100644
--- a/src/bin/lttng-relayd/stream.c
+++ b/src/bin/lttng-relayd/stream.c
@@ -1142,7 +1142,8 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
 		tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
 		tracefile_array_commit_seq(stream->tfa);
 		stream->index_received_seqcount++;
-		stream->received_packet_seq_num = index->index_data.packet_seq_num;
+		stream->received_packet_seq_num =
+				be64toh(index->index_data.packet_seq_num);
 		*flushed = true;
 	} else if (ret > 0) {
 		index->total_size = total_size;
-- 
2.17.1

                 reply	other threads:[~2019-11-08 16:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='20191108163247.6821-1-mathieu.desnoyers__15559.2538112373$1573230787$gmane$org@efficios.com' \
    --to=mathieu.desnoyers@efficios.com \
    --cc=jgalar@efficios.com \
    --cc=lttng-dev@lists.lttng.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).