qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Chunyan Liu <cyliu@suse.com>, qemu-devel@nongnu.org
Cc: stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH V26 13/32] vvfat.c: handle cross_driver's create_options and create_opts
Date: Thu, 01 May 2014 13:18:02 -0600	[thread overview]
Message-ID: <53629DEA.8090905@redhat.com> (raw)
In-Reply-To: <1398762656-26079-14-git-send-email-cyliu@suse.com>

[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]

On 04/29/2014 03:10 AM, Chunyan Liu wrote:
> vvfat shares create options of qcow driver. To avoid vvfat broken when

s/broken/breaking/

> qcow driver changes from QEMUOptionParameter to QemuOpts, let it able
> to handle both cases.
> 
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
>  block/vvfat.c | 19 ++++++++++++++-----
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/block/vvfat.c b/block/vvfat.c
> index 155fc9b..b49ec96 100644
> --- a/block/vvfat.c
> +++ b/block/vvfat.c
> @@ -2907,7 +2907,8 @@ static BlockDriver vvfat_write_target = {
>  static int enable_write_target(BDRVVVFATState *s)
>  {
>      BlockDriver *bdrv_qcow;
> -    QEMUOptionParameter *options;
> +    QemuOptsList *create_opts = NULL;
> +    QemuOpts *opts = NULL;
>      Error *local_err = NULL;
>      int ret;
>      int size = sector2cluster(s, s->sector_count);
> @@ -2922,11 +2923,17 @@ static int enable_write_target(BDRVVVFATState *s)
>      }
>  
>      bdrv_qcow = bdrv_find_format("qcow");
> -    options = parse_option_parameters("", bdrv_qcow->create_options, NULL);
> -    set_option_parameter_int(options, BLOCK_OPT_SIZE, s->sector_count * 512);
> -    set_option_parameter(options, BLOCK_OPT_BACKING_FILE, "fat:");
> +    assert(!(bdrv_qcow->create_opts && bdrv_qcow->create_options));
> +    if (bdrv_qcow->create_options) {
> +        create_opts = params_to_opts(bdrv_qcow->create_options);

allocated...

> +    } else {
> +        create_opts = bdrv_qcow->create_opts;

vs. reference...

>  err:
> +    qemu_opts_del(opts);
> +    qemu_opts_free(create_opts);

but unconditionally freed on either path.  Calling
g_free(bdrv_qcow->create_opts) is not nice.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

       reply	other threads:[~2014-05-01 19:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1398762656-26079-1-git-send-email-cyliu@suse.com>
     [not found] ` <1398762656-26079-14-git-send-email-cyliu@suse.com>
2014-05-01 19:18   ` Eric Blake [this message]
2014-05-01 19:22     ` [Qemu-devel] [PATCH V26 13/32] vvfat.c: handle cross_driver's create_options and create_opts Eric Blake
     [not found] ` <1398762656-26079-16-git-send-email-cyliu@suse.com>
2014-05-01 19:25   ` [Qemu-devel] [PATCH V26 15/32] gluster.c: replace QEMUOptionParameter with QemuOpts Eric Blake
2014-05-06 13:18   ` Stefan Hajnoczi
     [not found] ` <1398762656-26079-20-git-send-email-cyliu@suse.com>
2014-05-01 21:50   ` [Qemu-devel] [PATCH V26 19/32] qcow2.c: " Eric Blake
     [not found] ` <1398762656-26079-18-git-send-email-cyliu@suse.com>
2014-05-01 21:57   ` [Qemu-devel] [PATCH V26 17/32] nfs.c: " Eric Blake
2014-05-06 13:20   ` Stefan Hajnoczi
     [not found] ` <1398762656-26079-13-git-send-email-cyliu@suse.com>
2014-05-01 22:14   ` [Qemu-devel] [PATCH V26 12/32] change block layer to support both QemuOpts and QEMUOptionParamter Leandro Dorileo
     [not found]   ` <5360587E.5050409@redhat.com>
2014-05-04  3:51     ` Chun Yan Liu
     [not found] ` <1398762656-26079-21-git-send-email-cyliu@suse.com>
2014-05-05 23:08   ` [Qemu-devel] [PATCH V26 20/32] qed.c: replace QEMUOptionParameter with QemuOpts Eric Blake
2014-05-06 13:22   ` Stefan Hajnoczi
     [not found] ` <1398762656-26079-3-git-send-email-cyliu@suse.com>
2014-05-06 13:14   ` [Qemu-devel] [PATCH V26 02/32] QemuOpts: add def_value_str to QemuOptDesc Stefan Hajnoczi
     [not found] ` <1398762656-26079-4-git-send-email-cyliu@suse.com>
     [not found]   ` <535FD3B6.6020701@redhat.com>
2014-05-04  3:20     ` [Qemu-devel] [PATCH V26 03/32] QemuOpts: repurpose qemu_opts_print to replace print_option_parameters Chun Yan Liu
2014-05-06 13:14   ` Stefan Hajnoczi
     [not found] ` <1398762656-26079-5-git-send-email-cyliu@suse.com>
2014-05-06 13:15   ` [Qemu-devel] [PATCH V26 04/32] qapi: output def_value_str when query command line options Stefan Hajnoczi
     [not found] ` <1398762656-26079-28-git-send-email-cyliu@suse.com>
2014-05-06 13:24   ` [Qemu-devel] [PATCH V26 27/32] vdi.c: replace QEMUOptionParameter with QemuOpts Stefan Hajnoczi
2014-05-06 13:26 ` [Qemu-devel] [PATCH V26 00/32] " Stefan Hajnoczi
2014-05-19  3:02   ` Chun Yan Liu
2014-05-19 21:11     ` Leandro Dorileo
2014-06-03  5:34       ` Chun Yan Liu

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=53629DEA.8090905@redhat.com \
    --to=eblake@redhat.com \
    --cc=cyliu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).