diff mbox series

[2/3] trace-cmd msg: Set the min size of a message on init

Message ID 20180112180930.472825624@goodmis.org (mailing list archive)
State Superseded, archived
Headers show
Series trace-cmd: A few fixes | expand

Commit Message

Steven Rostedt Jan. 12, 2018, 6:08 p.m. UTC
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 mbox series

Patch

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)