[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 2/5] block-backend: improve blk_root_get_parent_desc()
From: |
Kevin Wolf |
Subject: |
Re: [PATCH v2 2/5] block-backend: improve blk_root_get_parent_desc() |
Date: |
Mon, 31 May 2021 17:45:33 +0200 |
Am 04.05.2021 um 11:45 hat Vladimir Sementsov-Ogievskiy geschrieben:
> We have different types of parents: block nodes, block backends and
> jobs. So, it makes sense to specify type together with name.
>
> While being here also use g_autofree.
>
> iotest 307 output is updated.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> Reviewed-by: Alberto Garcia <berto@igalia.com>
> ---
> block/block-backend.c | 9 ++++-----
> tests/qemu-iotests/307.out | 2 +-
> 2 files changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/block/block-backend.c b/block/block-backend.c
> index 6fca9853e1..2b7e9b5192 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -142,19 +142,18 @@ static void blk_root_set_aio_ctx(BdrvChild *child,
> AioContext *ctx,
> static char *blk_root_get_parent_desc(BdrvChild *child)
> {
> BlockBackend *blk = child->opaque;
> - char *dev_id;
> + g_autofree char *dev_id = NULL;
>
> if (blk->name) {
> - return g_strdup(blk->name);
> + return g_strdup_printf("block device '%s'", blk->name);
> }
>
> dev_id = blk_get_attached_dev_id(blk);
> if (*dev_id) {
> - return dev_id;
> + return g_strdup_printf("block device '%s'", dev_id);
> } else {
> /* TODO Callback into the BB owner for something more detailed */
> - g_free(dev_id);
> - return g_strdup("a block device");
> + return g_strdup("unnamed block device");
We should probably keep the article: "an unnamed block device"
> }
> }
Kevin
- Re: [PATCH v2 3/5] block: improve bdrv_child_get_parent_desc(), (continued)
- [PATCH v2 4/5] block: simplify bdrv_child_user_desc(), Vladimir Sementsov-Ogievskiy, 2021/05/04
- [PATCH v2 5/5] block: improve permission conflict error message, Vladimir Sementsov-Ogievskiy, 2021/05/04
- [PATCH v2 1/5] block: document child argument of bdrv_attach_child_common(), Vladimir Sementsov-Ogievskiy, 2021/05/04
- [PATCH v2 2/5] block-backend: improve blk_root_get_parent_desc(), Vladimir Sementsov-Ogievskiy, 2021/05/04
- Re: [PATCH v2 2/5] block-backend: improve blk_root_get_parent_desc(),
Kevin Wolf <=
- Re: [PATCH v2 0/5] block permission updated follow-up, Vladimir Sementsov-Ogievskiy, 2021/05/24