From: "Steven Rostedt (Red Hat)" We will eventually be getting rid of tracecmd_msg_create() multiplexer and having separate functions for creating different msg types. This will require having a generic tracecmd_msg_init() to initialize the msg to a default state. Signed-off-by: Steven Rostedt --- trace-msg.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/trace-msg.c b/trace-msg.c index 406f44105470..5c55eae8f4b3 100644 --- a/trace-msg.c +++ b/trace-msg.c @@ -219,6 +219,13 @@ static int make_rinit(struct tracecmd_msg *msg) return 0; } +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); +} + static int tracecmd_msg_create(u32 cmd, struct tracecmd_msg *msg) { int ret = 0; @@ -228,8 +235,7 @@ static int tracecmd_msg_create(u32 cmd, struct tracecmd_msg *msg) return -EINVAL; } - memset(msg, 0, sizeof(*msg)); - msg->hdr.cmd = htonl(cmd); + tracecmd_msg_init(cmd, msg); switch (cmd) { case MSG_TINIT: @@ -242,8 +248,6 @@ static int tracecmd_msg_create(u32 cmd, struct tracecmd_msg *msg) break; } - msg->hdr.size = htonl(MSG_HDR_LEN); - return ret; } -- 2.13.2