diff mbox

[v22,24/25] vvfat.c: replace QEMUOptionParameter with QemuOpts

Message ID 1394436721-21812-25-git-send-email-cyliu@suse.com
State New
Headers show

Commit Message

Chunyan Liu March 10, 2014, 7:32 a.m. UTC
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Chunyan Liu <cyliu@suse.com>
---
 block/vvfat.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Eric Blake March 11, 2014, 5:06 p.m. UTC | #1
On 03/10/2014 01:32 AM, Chunyan Liu wrote:
> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
> Signed-off-by: Chunyan Liu <cyliu@suse.com>
> ---
>  block/vvfat.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 

>      bdrv_qcow = bdrv_find_format("qcow");
> -    options = parse_option_parameters("", bdrv_qcow->create_options, NULL);

Problem.  This code is broken from the time that patch 11/25 is applied
until now.  That's because commit 11 changed bdrv_qcow from having
create_options over to having create_opts.  Do any of the other drivers
do cross-driver option sharing?  It would be nice to fix that to quit
happening, preferably earlier in the series than where you start doing
per-driver conversions.

> -    set_option_parameter_int(options, BLOCK_OPT_SIZE, s->sector_count * 512);
> -    set_option_parameter(options, BLOCK_OPT_BACKING_FILE, "fat:");
> +    opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);
> +    qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512);
> +    qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:");
>  
> -    ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, NULL, &local_err);
> +    ret = bdrv_create(bdrv_qcow, s->qcow_filename, NULL, opts, &local_err);
>      if (ret < 0) {
>          qerror_report_err(local_err);
>          error_free(local_err);
>
Stefan Hajnoczi March 11, 2014, 6:01 p.m. UTC | #2
On Mon, Mar 10, 2014 at 03:32:00PM +0800, Chunyan Liu wrote:
> -    ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, NULL, &local_err);
> +    ret = bdrv_create(bdrv_qcow, s->qcow_filename, NULL, opts, &local_err);
>      if (ret < 0) {
>          qerror_report_err(local_err);
>          error_free(local_err);

Who frees opts?
diff mbox

Patch

diff --git a/block/vvfat.c b/block/vvfat.c
index ee32b3c..03be65d 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2907,7 +2907,7 @@  static BlockDriver vvfat_write_target = {
 static int enable_write_target(BDRVVVFATState *s)
 {
     BlockDriver *bdrv_qcow;
-    QEMUOptionParameter *options;
+    QemuOpts *opts;
     Error *local_err = NULL;
     int ret;
     int size = sector2cluster(s, s->sector_count);
@@ -2922,11 +2922,11 @@  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:");
+    opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);
+    qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512);
+    qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:");
 
-    ret = bdrv_create(bdrv_qcow, s->qcow_filename, options, NULL, &local_err);
+    ret = bdrv_create(bdrv_qcow, s->qcow_filename, NULL, opts, &local_err);
     if (ret < 0) {
         qerror_report_err(local_err);
         error_free(local_err);