From: Stefano Garzarella <[email protected]> The vhost-user protocol is not really Linux-specific so let's enable vhost-user frontends for any POSIX system.
In vhost_net.c we use VHOST_FILE_UNBIND which is defined in a Linux specific header, let's define it for other systems as well. Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Tested-by: Philippe Mathieu-Daudé <[email protected]> Acked-by: Stefan Hajnoczi <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Signed-off-by: Stefano Garzarella <[email protected]> Signed-off-by: Tim Pambor <[email protected]> --- hw/block/Kconfig | 2 +- hw/net/vhost_net.c | 6 ++++++ meson.build | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/block/Kconfig b/hw/block/Kconfig index 737dbcdb3e..7edcd7a8f6 100644 --- a/hw/block/Kconfig +++ b/hw/block/Kconfig @@ -28,7 +28,7 @@ config VHOST_USER_BLK bool # Only PCI devices are provided for now default y if VIRTIO_PCI - depends on VIRTIO && VHOST_USER && LINUX + depends on VIRTIO && VHOST_USER config SWIM bool diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 6e05c995f1..788913953d 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -33,7 +33,13 @@ #include "standard-headers/linux/virtio_ring.h" #include "hw/virtio/vhost.h" #include "hw/virtio/virtio-bus.h" +#if defined(__linux__) #include "linux-headers/linux/vhost.h" +#endif + +#ifndef VHOST_FILE_UNBIND +#define VHOST_FILE_UNBIND -1 +#endif void vhost_net_get_features_ex(struct vhost_net *net, uint64_t *features) { diff --git a/meson.build b/meson.build index b67a97ab45..eb296346a8 100644 --- a/meson.build +++ b/meson.build @@ -221,7 +221,6 @@ have_tpm = get_option('tpm') \ # vhost have_vhost_user = get_option('vhost_user') \ - .disable_auto_if(host_os != 'linux') \ .require(host_os != 'windows', error_message: 'vhost-user is not available on Windows').allowed() have_vhost_vdpa = get_option('vhost_vdpa') \ -- 2.55.0
