Skip to content

Commit

Permalink
configure: introduce --enable-vhost-user-blk-server
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stefanhaRH authored and mstsirkin committed Nov 3, 2020
1 parent de65d49 commit bc15e44
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
4 changes: 2 additions & 2 deletions block/export/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion block/export/meson.build
Original file line number Diff line number Diff line change
@@ -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 changes: 15 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ vhost_crypto=""
vhost_scsi=""
vhost_vsock=""
vhost_user=""
vhost_user_blk_server=""
vhost_user_fs=""
kvm="auto"
hax="auto"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion util/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit bc15e44

Please sign in to comment.