On Sun, Aug 27, 2023 at 08:29:33PM +0200, Laszlo Ersek wrote:
The tails of the "vhost_user_set_vring_addr" and "vhost_user_set_u64"
functions are now byte-for-byte identical. Factor the common tail out to a
new function called "vhost_user_write_msg".

This is purely refactoring -- no observable change.

Cc: "Michael S. Tsirkin" <[email protected]> (supporter:vhost)
Cc: Eugenio Perez Martin <[email protected]>
Cc: German Maglione <[email protected]>
Cc: Liu Jiang <[email protected]>
Cc: Sergio Lopez Pascual <[email protected]>
Cc: Stefano Garzarella <[email protected]>
Signed-off-by: Laszlo Ersek <[email protected]>
---
hw/virtio/vhost-user.c | 66 +++++++++-----------
1 file changed, 28 insertions(+), 38 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 64eac317bfb2..36f99b66a644 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -1320,10 +1320,35 @@ static int enforce_reply(struct vhost_dev *dev,
    return vhost_user_get_features(dev, &dummy);
}

+/* Note: "msg->hdr.flags" may be modified. */
+static int vhost_user_write_msg(struct vhost_dev *dev, VhostUserMsg *msg,
+                                bool wait_for_reply)

The difference between vhost_user_write() and vhost_user_write_msg() is
not immediately obvious from the function name, so I would propose
something different, like vhost_user_write_sync() or
vhost_user_write_wait().

Anyway, I'm not good with names and don't have a strong opinion, so this version is fine with me as well :-)

Reviewed-by: Stefano Garzarella <[email protected]>


Reply via email to