[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 27/28] vhost-user: add error report in vhost_user
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v3 27/28] vhost-user: add error report in vhost_user_write() |
Date: |
Wed, 6 Jul 2016 20:47:20 +0200 |
From: Marc-André Lureau <address@hidden>
Similar to vhost_user_read() error report, it is useful to have early
error report.
Signed-off-by: Marc-André Lureau <address@hidden>
---
hw/virtio/vhost-user.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 819481d..1995fd2 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -176,7 +176,7 @@ static int vhost_user_write(struct vhost_dev *dev,
VhostUserMsg *msg,
int *fds, int fd_num)
{
CharDriverState *chr = dev->opaque;
- int size = VHOST_USER_HDR_SIZE + msg->size;
+ int ret, size = VHOST_USER_HDR_SIZE + msg->size;
/*
* For non-vring specific requests, like VHOST_USER_SET_MEM_TABLE,
@@ -188,11 +188,18 @@ static int vhost_user_write(struct vhost_dev *dev,
VhostUserMsg *msg,
}
if (qemu_chr_fe_set_msgfds(chr, fds, fd_num) < 0) {
+ error_report("Failed to set msg fds.");
return -1;
}
- return qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size) == size ?
- 0 : -1;
+ ret = qemu_chr_fe_write_all(chr, (const uint8_t *) msg, size);
+ if (ret != size) {
+ error_report("Failed to write msg."
+ " Wrote %d instead of %d.", ret, size);
+ return -1;
+ }
+
+ return 0;
}
static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
--
2.9.0
- [Qemu-devel] [PATCH v3 16/28] Revert "vhost-net: do not crash if backend is not present", (continued)
- [Qemu-devel] [PATCH v3 16/28] Revert "vhost-net: do not crash if backend is not present", marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 17/28] get_vhost_net() should be != null after vhost_user_init, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 18/28] vhost-net: success if backend has no ops->vhost_migration_done, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 19/28] vhost: add assert() to check runtime behaviour, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 20/28] char: add chr_wait_connected callback, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 21/28] char: add and use tcp_chr_wait_connected, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 22/28] vhost-user: wait until backend init is completed, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 23/28] tests: plug some leaks in virtio-net-test, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 25/28] tests: add /vhost-user/connect-fail test, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 24/28] tests: fix vhost-user-test leak, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 27/28] vhost-user: add error report in vhost_user_write(),
marcandre . lureau <=
- [Qemu-devel] [PATCH v3 26/28] tests: add a simple /vhost-user/multiqueue test, marcandre . lureau, 2016/07/06
- [Qemu-devel] [PATCH v3 28/28] vhost: add vhost_net_set_backend(), marcandre . lureau, 2016/07/06