From be848992298b7a64a161487600a4070e52b9d26d Mon Sep 17 00:00:00 2001 From: Timothy Redaelli Date: Wed, 5 Feb 2020 14:47:03 +0100 Subject: [PATCH] examples/vhost_blk: fix build with gcc 10 GCC 10 defaults to -fno-common, this means a linker error will now be reported if the same global variable is defined in more than one compilation unit. Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample") Cc: stable@dpdk.org Signed-off-by: Timothy Redaelli Reviewed-by: Maxime Coquelin Acked-by: David Marchand --- examples/vhost_blk/vhost_blk.c | 2 ++ examples/vhost_blk/vhost_blk.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/vhost_blk/vhost_blk.c b/examples/vhost_blk/vhost_blk.c index 74c82a900b..b757c9228b 100644 --- a/examples/vhost_blk/vhost_blk.c +++ b/examples/vhost_blk/vhost_blk.c @@ -31,6 +31,8 @@ (1ULL << VIRTIO_F_NOTIFY_ON_EMPTY) | \ (1ULL << VHOST_USER_F_PROTOCOL_FEATURES)) +struct vhost_blk_ctrlr *g_vhost_ctrlr; + /* Path to folder where character device will be created. Can be set by user. */ static char dev_pathname[PATH_MAX] = ""; static sem_t exit_sem; diff --git a/examples/vhost_blk/vhost_blk.h b/examples/vhost_blk/vhost_blk.h index 933e2b7c57..17258d284b 100644 --- a/examples/vhost_blk/vhost_blk.h +++ b/examples/vhost_blk/vhost_blk.h @@ -112,8 +112,8 @@ struct inflight_blk_task { struct rte_vhost_inflight_info_packed *inflight_packed; }; -struct vhost_blk_ctrlr *g_vhost_ctrlr; -struct vhost_device_ops vhost_blk_device_ops; +extern struct vhost_blk_ctrlr *g_vhost_ctrlr; +extern struct vhost_device_ops vhost_blk_device_ops; int vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev, struct vhost_blk_task *task); -- 2.20.1