examples/vhost_blk: fix build with gcc 10
authorTimothy Redaelli <tredaelli@redhat.com>
Wed, 5 Feb 2020 13:47:03 +0000 (14:47 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 4 Mar 2020 09:24:42 +0000 (10:24 +0100)
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 <tredaelli@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: David Marchand <david.marchand@redhat.com>
examples/vhost_blk/vhost_blk.c
examples/vhost_blk/vhost_blk.h

index 74c82a9..b757c92 100644 (file)
@@ -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;
index 933e2b7..17258d2 100644 (file)
@@ -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);