[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 7/8] block: Reuse success path from bdrv_open
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v2 7/8] block: Reuse success path from bdrv_open() |
Date: |
Mon, 10 Feb 2014 15:56:29 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Am 08.02.2014 um 18:39 hat Max Reitz geschrieben:
> The fail and success paths of bdrv_file_open() may be further shortened
> by reusing code already existent in bdrv_open(). This includes
> bdrv_file_open() not taking the reference to options which allows the
> removal of QDECREF(options) in that function.
>
> Signed-off-by: Max Reitz <address@hidden>
> @@ -1001,41 +1003,35 @@ static int bdrv_file_open(BlockDriverState *bs, const
> char *filename,
>
> /* Parse the filename and open it */
> if (drv->bdrv_parse_filename && filename) {
> - drv->bdrv_parse_filename(filename, options, &local_err);
> + drv->bdrv_parse_filename(filename, *options, &local_err);
> if (error_is_set(&local_err)) {
> error_propagate(errp, local_err);
> ret = -EINVAL;
> goto fail;
> }
> - qdict_del(options, "filename");
> + qdict_del(*options, "filename");
> + } else if (drv->bdrv_needs_filename && !filename) {
> + error_setg(errp, "The '%s' block driver requires a file name",
> + drv->format_name);
> + ret = -EINVAL;
> + goto fail;
> }
How did this part end up in this patch? It doesn't look wrong, though I
think bdrv_open_common() should already catch it. In any case it's an
addition that the commit message didn't mention.
Kevin
- [Qemu-devel] [PATCH v2 3/8] block: Make bdrv_file_open() static, (continued)
- [Qemu-devel] [PATCH v2 3/8] block: Make bdrv_file_open() static, Max Reitz, 2014/02/08
- [Qemu-devel] [PATCH v2 4/8] block: Reuse reference handling from bdrv_open(), Max Reitz, 2014/02/08
- [Qemu-devel] [PATCH v2 5/8] block: Remove bdrv_new() from bdrv_file_open(), Max Reitz, 2014/02/08
- [Qemu-devel] [PATCH v2 6/8] block: Handle bs->options in bdrv_open() only, Max Reitz, 2014/02/08
- [Qemu-devel] [PATCH v2 7/8] block: Reuse success path from bdrv_open(), Max Reitz, 2014/02/08
- [Qemu-devel] [PATCH v2 8/8] block: Remove bdrv_open_image()'s force_raw option, Max Reitz, 2014/02/08
- Re: [Qemu-devel] [PATCH v2 0/8] block: Integrate bdrv_file_open() into bdrv_open(), Kevin Wolf, 2014/02/10