[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/3] block: do not check bdrv_file_open
From: |
Kevin Wolf |
Subject: |
Re: [PATCH 2/3] block: do not check bdrv_file_open |
Date: |
Thu, 19 Jan 2023 14:17:37 +0100 |
Am 12.12.2022 um 14:16 hat Paolo Bonzini geschrieben:
> The set of BlockDrivers that have .bdrv_file_open coincides with those
> that have .protocol_name and guess what---checking drv->bdrv_file_open
> is done to see if the driver is a protocol. So check drv->protocol_name
> instead.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> block.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/block.c b/block.c
> index 0a625a489a6e..7a66cc2ea23a 100644
> --- a/block.c
> +++ b/block.c
> @@ -911,7 +911,6 @@ BlockDriver *bdrv_find_protocol(const char *filename,
> int i;
>
> GLOBAL_STATE_CODE();
> - /* TODO Drivers without bdrv_file_open must be specified explicitly */
>
> /*
> * XXX(hch): we really should not let host device detection
> @@ -1618,7 +1617,7 @@ static int bdrv_open_driver(BlockDriverState *bs,
> BlockDriver *drv,
> bs->opaque = g_malloc0(drv->instance_size);
>
> assert(!drv->bdrv_needs_filename || bs->filename[0]);
> - if (drv->bdrv_file_open) {
> + if (drv->bdrv_open) {
> ret = drv->bdrv_file_open(bs, options, open_flags, &local_err);
> } else if (drv->bdrv_open) {
> ret = drv->bdrv_open(bs, options, open_flags, &local_err);
I suppose you mean drv->protocol_name for the first if condition?
The bug will disappear again after patch 3, but this intermediate state
is very broken.
Kevin
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 2/3] block: do not check bdrv_file_open,
Kevin Wolf <=