From: Fam Zheng <famz@redhat.com>
To: Max Reitz <mreitz@redhat.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 08/21] block: Allow reference for bdrv_file_open()
Date: Thu, 12 Dec 2013 16:01:23 +0800 [thread overview]
Message-ID: <52A96D53.9030508@redhat.com> (raw)
In-Reply-To: <1386785473-26157-9-git-send-email-mreitz@redhat.com>
On 2013年12月12日 02:11, Max Reitz wrote:
> Allow specifying a reference to an existing block device (by name) for
> bdrv_file_open() instead of a filename and/or options.
>
> Signed-off-by: Max Reitz <mreitz@redhat.com>
> ---
> block.c | 27 ++++++++++++++++++++++++---
> block/blkdebug.c | 2 +-
> block/blkverify.c | 2 +-
> block/cow.c | 3 ++-
> block/qcow.c | 3 ++-
> block/qcow2.c | 2 +-
> block/qed.c | 4 ++--
> block/sheepdog.c | 4 ++--
> block/vhdx.c | 2 +-
> block/vmdk.c | 4 ++--
> include/block/block.h | 3 ++-
> qemu-io.c | 2 +-
> 12 files changed, 41 insertions(+), 17 deletions(-)
>
> diff --git a/block.c b/block.c
> index 13f001a..9e197b3 100644
> --- a/block.c
> +++ b/block.c
> @@ -858,9 +858,10 @@ free_and_fail:
> * dictionary, it needs to use QINCREF() before calling bdrv_file_open.
> */
> int bdrv_file_open(BlockDriverState **pbs, const char *filename,
> - QDict *options, int flags, Error **errp)
> + const char *reference, QDict *options, int flags,
> + Error **errp)
> {
> - BlockDriverState *bs;
> + BlockDriverState *bs = NULL;
> BlockDriver *drv;
> const char *drvname;
> bool allow_protocol_prefix = false;
> @@ -872,6 +873,26 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
> options = qdict_new();
> }
>
> + if (reference) {
> + if (filename || qdict_size(options)) {
> + error_setg(errp, "Cannot reference an existing block device with "
> + "additional options or a new filename");
> + ret = -EINVAL;
> + goto fail;
> + }
> + QDECREF(options);
QDECREF called...
> +
> + bs = bdrv_find(reference);
> + if (!bs) {
> + error_setg(errp, "Cannot find block device '%s'", reference);
> + ret = -ENODEV;
> + goto fail;
Jump to fail for QDECREF again. Duplicated?
Fam
next prev parent reply other threads:[~2013-12-12 8:01 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-11 18:10 [Qemu-devel] [PATCH v3 00/21] blkdebug/blkverify: Allow QMP configuration Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 01/21] blkdebug: Use errp for read_config() Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 02/21] blkdebug: Don't require sophisticated filename Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 03/21] qdict: Add qdict_array_split() Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 04/21] qapi: extend qdict_flatten() for QLists Max Reitz
2013-12-11 18:23 ` [Qemu-devel] [PATCH v4 " Max Reitz
2013-12-12 6:17 ` [Qemu-devel] [PATCH v3 " Fam Zheng
2013-12-13 15:52 ` Max Reitz
2013-12-12 6:21 ` Fam Zheng
2013-12-13 15:53 ` Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 05/21] qemu-option: Add qemu_config_parse_qdict() Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 06/21] blkdebug: Always call read_config() Max Reitz
2013-12-11 18:10 ` [Qemu-devel] [PATCH v3 07/21] blkdebug: Use command-line in read_config() Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 08/21] block: Allow reference for bdrv_file_open() Max Reitz
2013-12-12 8:01 ` Fam Zheng [this message]
2013-12-13 15:55 ` Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 09/21] block: Pass reference to bdrv_file_open() Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 10/21] block: Allow block devices without files Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 11/21] block: Allow recursive "file"s Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 12/21] qemu-iotests: Fix output of test 051 Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 13/21] blockdev: Move "file" to legacy_opts Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 14/21] blkdebug: Allow command-line file configuration Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 15/21] blkdebug: Make filename optional Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 16/21] blkverify: Allow command-line configuration Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 17/21] blkverify: Don't require protocol filename Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 18/21] blkdebug: Alias "errno" as "error" Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 19/21] qapi: QMP interface for blkdebug and blkverify Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 20/21] qemu-io: Make filename optional Max Reitz
2013-12-11 18:11 ` [Qemu-devel] [PATCH v3 21/21] iotests: Test new blkdebug/blkverify interface Max Reitz
2013-12-12 10:41 ` Fam Zheng
2013-12-13 15:59 ` Max Reitz
2013-12-12 10:45 ` [Qemu-devel] [PATCH v3 00/21] blkdebug/blkverify: Allow QMP configuration Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52A96D53.9030508@redhat.com \
--to=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.