From nobody Mon Feb 9 19:08:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1496017638487900.8690403622724; Sun, 28 May 2017 17:27:18 -0700 (PDT) Received: from localhost ([::1]:46246 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF8Wj-0006Oa-3I for importer@patchew.org; Sun, 28 May 2017 20:27:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dF8On-0000Jz-L5 for qemu-devel@nongnu.org; Sun, 28 May 2017 20:19:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dF8Om-0006N8-KT for qemu-devel@nongnu.org; Sun, 28 May 2017 20:19:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59568) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dF8Om-0006N4-Bg for qemu-devel@nongnu.org; Sun, 28 May 2017 20:19:04 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 56337C057FAD; Mon, 29 May 2017 00:19:03 +0000 (UTC) Received: from redhat.com (ovpn-120-144.rdu2.redhat.com [10.10.120.144]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EB2B91745; Mon, 29 May 2017 00:18:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 56337C057FAD Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=mst@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 56337C057FAD Date: Mon, 29 May 2017 03:18:59 +0300 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Message-ID: <1496017081-24032-12-git-send-email-mst@redhat.com> References: <1496017081-24032-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1496017081-24032-1-git-send-email-mst@redhat.com> X-Mutt-Fcc: =sent X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 29 May 2017 00:19:03 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 11/13] vhost-user: pass message as a pointer to process_message_reply() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Zhiyong Yang , Peter Maydell , Maxime Coquelin , Jens Freimann , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Maxime Coquelin process_message_reply() was recently updated to get full message content instead of only its request field. There is no need to copy all the struct content into the stack, so just pass its pointer as const. Reviewed-by: Jens Freimann Reviewed-by: Zhiyong Yang Signed-off-by: Maxime Coquelin Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/virtio/vhost-user.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index b87a176..dde094a 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -162,11 +162,11 @@ fail: } =20 static int process_message_reply(struct vhost_dev *dev, - VhostUserMsg msg) + const VhostUserMsg *msg) { VhostUserMsg msg_reply; =20 - if ((msg.flags & VHOST_USER_NEED_REPLY_MASK) =3D=3D 0) { + if ((msg->flags & VHOST_USER_NEED_REPLY_MASK) =3D=3D 0) { return 0; } =20 @@ -174,10 +174,10 @@ static int process_message_reply(struct vhost_dev *de= v, return -1; } =20 - if (msg_reply.request !=3D msg.request) { + if (msg_reply.request !=3D msg->request) { error_report("Received unexpected msg type." "Expected %d received %d", - msg.request, msg_reply.request); + msg->request, msg_reply.request); return -1; } =20 @@ -324,7 +324,7 @@ static int vhost_user_set_mem_table(struct vhost_dev *d= ev, } =20 if (reply_supported) { - return process_message_reply(dev, msg); + return process_message_reply(dev, &msg); } =20 return 0; @@ -716,7 +716,7 @@ static int vhost_user_net_set_mtu(struct vhost_dev *dev= , uint16_t mtu) =20 /* If reply_ack supported, slave has to ack specified MTU is valid */ if (reply_supported) { - return process_message_reply(dev, msg); + return process_message_reply(dev, &msg); } =20 return 0; --=20 MST