diff options
author | Kevin Wolf <kwolf@redhat.com> | 2021-06-09 08:46:53 -0700 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2021-06-30 13:16:03 +0200 |
commit | 28770ff935bce723c5799d292bc788770b69a733 (patch) | |
tree | 7cace1f0832556f6bc7c1bde6d57dcf6ded918a5 /hw/virtio/vhost-backend.c | |
parent | a6945f2287aa7f048b263d7187364cbf1dd5d94d (diff) | |
download | qemu-28770ff935bce723c5799d292bc788770b69a733.zip qemu-28770ff935bce723c5799d292bc788770b69a733.tar.gz qemu-28770ff935bce723c5799d292bc788770b69a733.tar.bz2 |
vhost: Distinguish errors in vhost_backend_init()
Instead of just returning 0/-1 and letting the caller make up a
meaningless error message, add an Error parameter to allow reporting the
real error and switch to 0/-errno so that different kind of errors can
be distinguished in the caller.
Specifically, in vhost-user, EPROTO is used for all errors that relate
to the connection itself, whereas other error codes are used for errors
relating to the content of the connection. This will allow us later to
automatically reconnect when the connection goes away, without ending up
in an endless loop if it's a permanent error in the configuration.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210609154658.350308-3-kwolf@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-backend.c')
-rw-r--r-- | hw/virtio/vhost-backend.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 31b33bd..f4f71cf 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -30,7 +30,7 @@ static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request, return ioctl(fd, request, arg); } -static int vhost_kernel_init(struct vhost_dev *dev, void *opaque) +static int vhost_kernel_init(struct vhost_dev *dev, void *opaque, Error **errp) { assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_KERNEL); |