configure: introduce --enable-vhost-user-blk-server

Make it possible to compile out the vhost-user-blk server. It is enabled
by default on Linux.

Note that vhost-user-server.c depends on libvhost-user, which requires
CONFIG_LINUX. The CONFIG_VHOST_USER dependency was erroneous since that
option controls vhost-user frontends (previously known as "master") and
not device backends (previously known as "slave").

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20201027173528.213464-3-stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2020-10-27 17:35:18 +00:00 committed by Michael S. Tsirkin
parent de65d49785
commit bc15e44cb2
4 changed files with 19 additions and 4 deletions

View file

@ -22,13 +22,13 @@
#include "qapi/qapi-commands-block-export.h"
#include "qapi/qapi-events-block-export.h"
#include "qemu/id.h"
#if defined(CONFIG_LINUX) && defined(CONFIG_VHOST_USER)
#ifdef CONFIG_VHOST_USER_BLK_SERVER
#include "vhost-user-blk-server.h"
#endif
static const BlockExportDriver *blk_exp_drivers[] = {
&blk_exp_nbd,
#if defined(CONFIG_LINUX) && defined(CONFIG_VHOST_USER)
#ifdef CONFIG_VHOST_USER_BLK_SERVER
&blk_exp_vhost_user_blk,
#endif
};

View file

@ -1,2 +1,2 @@
blockdev_ss.add(files('export.c'))
blockdev_ss.add(when: ['CONFIG_LINUX', 'CONFIG_VHOST_USER'], if_true: files('vhost-user-blk-server.c'))
blockdev_ss.add(when: 'CONFIG_VHOST_USER_BLK_SERVER', if_true: files('vhost-user-blk-server.c'))

15
configure vendored
View file

@ -329,6 +329,7 @@ vhost_crypto=""
vhost_scsi=""
vhost_vsock=""
vhost_user=""
vhost_user_blk_server=""
vhost_user_fs=""
kvm="auto"
hax="auto"
@ -1246,6 +1247,10 @@ for opt do
;;
--enable-vhost-vsock) vhost_vsock="yes"
;;
--disable-vhost-user-blk-server) vhost_user_blk_server="no"
;;
--enable-vhost-user-blk-server) vhost_user_blk_server="yes"
;;
--disable-vhost-user-fs) vhost_user_fs="no"
;;
--enable-vhost-user-fs) vhost_user_fs="yes"
@ -1791,6 +1796,7 @@ disabled with --disable-FEATURE, default is enabled if available:
vhost-crypto vhost-user-crypto backend support
vhost-kernel vhost kernel backend support
vhost-user vhost-user backend support
vhost-user-blk-server vhost-user-blk server support
vhost-vdpa vhost-vdpa kernel backend support
spice spice
rbd rados block device (rbd)
@ -2382,6 +2388,12 @@ if test "$vhost_net" = ""; then
test "$vhost_kernel" = "yes" && vhost_net=yes
fi
# libvhost-user is Linux-only
test "$vhost_user_blk_server" = "" && vhost_user_blk_server=$linux
if test "$vhost_user_blk_server" = "yes" && test "$linux" = "no"; then
error_exit "--enable-vhost-user-blk-server is only available on Linux"
fi
##########################################
# pkg-config probe
@ -6275,6 +6287,9 @@ fi
if test "$vhost_vdpa" = "yes" ; then
echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak
fi
if test "$vhost_user_blk_server" = "yes" ; then
echo "CONFIG_VHOST_USER_BLK_SERVER=y" >> $config_host_mak
fi
if test "$vhost_user_fs" = "yes" ; then
echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
fi

View file

@ -66,7 +66,7 @@ if have_block
util_ss.add(files('main-loop.c'))
util_ss.add(files('nvdimm-utils.c'))
util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-coroutine-io.c'))
util_ss.add(when: ['CONFIG_LINUX', 'CONFIG_VHOST_USER'], if_true: [
util_ss.add(when: 'CONFIG_LINUX', if_true: [
files('vhost-user-server.c'), vhost_user
])
util_ss.add(files('block-helpers.c'))