From 779d82e1d305f2a9cbd7f48cf6555ad58145e04a Mon Sep 17 00:00:00 2001 From: Xie Yongji Date: Tue, 14 Jun 2022 13:15:32 +0800 Subject: vduse-blk: Add name option Currently we use 'id' option as the name of VDUSE device. It's a bit confusing since we use one value for two different purposes: the ID to identfy the export within QEMU (must be distinct from any other exports in the same QEMU process, but can overlap with names used by other processes), and the VDUSE name to uniquely identify it on the host (must be distinct from other VDUSE devices on the same host, but can overlap with other export types like NBD in the same process). To make it clear, this patch adds a separate 'name' option to specify the VDUSE name for the vduse-blk export instead. Signed-off-by: Xie Yongji Message-Id: <20220614051532.92-7-xieyongji@bytedance.com> Signed-off-by: Kevin Wolf --- block/export/vduse-blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'block') diff --git a/block/export/vduse-blk.c b/block/export/vduse-blk.c index 066e088..f101c24 100644 --- a/block/export/vduse-blk.c +++ b/block/export/vduse-blk.c @@ -300,7 +300,7 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts, features |= 1ULL << VIRTIO_BLK_F_RO; } - vblk_exp->dev = vduse_dev_create(exp->id, VIRTIO_ID_BLOCK, 0, + vblk_exp->dev = vduse_dev_create(vblk_opts->name, VIRTIO_ID_BLOCK, 0, features, num_queues, sizeof(struct virtio_blk_config), (char *)&config, &vduse_blk_ops, @@ -312,7 +312,7 @@ static int vduse_blk_exp_create(BlockExport *exp, BlockExportOptions *opts, } vblk_exp->recon_file = g_strdup_printf("%s/vduse-blk-%s", - g_get_tmp_dir(), exp->id); + g_get_tmp_dir(), vblk_opts->name); if (vduse_set_reconnect_log_file(vblk_exp->dev, vblk_exp->recon_file)) { error_setg(errp, "failed to set reconnect log file"); ret = -EINVAL; -- cgit v1.1