[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2] vduse-blk: Add name option
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v2] vduse-blk: Add name option |
Date: |
Wed, 1 Jun 2022 14:03:43 +0100 |
On Tue, May 31, 2022 at 05:52:21PM +0800, Xie Yongji wrote:
> 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 <xieyongji@bytedance.com>
> ---
> block/export/vduse-blk.c | 9 ++++++---
> docs/tools/qemu-storage-daemon.rst | 5 +++--
> qapi/block-export.json | 7 ++++---
> storage-daemon/qemu-storage-daemon.c | 8 ++++----
> 4 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/block/export/vduse-blk.c b/block/export/vduse-blk.c
> index 3b10349173..d96993bdf5 100644
> --- a/block/export/vduse-blk.c
> +++ b/block/export/vduse-blk.c
> @@ -245,7 +245,7 @@ static int vduse_blk_exp_create(BlockExport *exp,
> BlockExportOptions *opts,
> }
> vblk_exp->num_queues = num_queues;
> vblk_exp->handler.blk = exp->blk;
> - vblk_exp->handler.serial = exp->id;
> + vblk_exp->handler.serial = g_strdup(vblk_opts->name);
Do we want to expose the VDUSE device name to the guest? Maybe the
serial string should be a separate parameter.
> vblk_exp->handler.logical_block_size = logical_block_size;
> vblk_exp->handler.writable = opts->writable;
>
> @@ -279,22 +279,24 @@ 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,
> vblk_exp);
> if (!vblk_exp->dev) {
> error_setg(errp, "failed to create vduse device");
> + g_free((void *)vblk_exp->handler.serial);
serial isn't const char * anymore, it's char *. Please update the struct
field and then these casts won't be necessary anymore.
signature.asc
Description: PGP signature
- Re: [PATCH v2] vduse-blk: Add name option,
Stefan Hajnoczi <=