All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Vladislav Valtchev <vladislav.valtchev@gmail.com>,
	Yordan Karadzhov <y.karadz@gmail.com>
Subject: [PATCH 2/3] trace-cmd msg: Set the min size of a message on init
Date: Fri, 12 Jan 2018 13:08:49 -0500	[thread overview]
Message-ID: <20180112180930.472825624@goodmis.org> (raw)
In-Reply-To: 20180112180847.372748598@goodmis.org

[-- Attachment #1: 0002-trace-cmd-msg-Set-the-min-size-of-a-message-on-init.patch --]
[-- Type: text/plain, Size: 821 bytes --]

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

As there exist a map for the minimum sizes of messages, we can use that to
set up the minimum size of messages during init of the msg_handle.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 trace-msg.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/trace-msg.c b/trace-msg.c
index 6f3d878a067f..8b87858f3f2b 100644
--- a/trace-msg.c
+++ b/trace-msg.c
@@ -255,7 +255,10 @@ static void tracecmd_msg_init(u32 cmd, struct tracecmd_msg *msg)
 {
 	memset(msg, 0, sizeof(*msg));
 	msg->hdr.cmd = htonl(cmd);
-	msg->hdr.size = htonl(MSG_HDR_LEN);
+	if (!msg_min_sizes[cmd])
+		msg->hdr.size = htonl(MSG_HDR_LEN);
+	else
+		msg->hdr.size = htonl(msg_min_sizes[cmd]);
 }
 
 static void msg_free(struct tracecmd_msg *msg)
-- 
2.13.2

  parent reply	other threads:[~2018-01-12 18:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-12 18:08 [PATCH 0/3] trace-cmd: A few fixes Steven Rostedt
2018-01-12 18:08 ` [PATCH 1/3] trace-cmd: Fix leaking of port_array memory Steven Rostedt
2018-01-12 18:08 ` Steven Rostedt [this message]
2018-01-12 18:08 ` [PATCH 3/3] trace-cmd TAGS: Fix tags to not parse .pc directory of patch Steven Rostedt

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=20180112180930.472825624@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=vladislav.valtchev@gmail.com \
    --cc=y.karadz@gmail.com \
    /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.