Revision f67503e5 blockdev.c

b/blockdev.c
504 504
    bdrv_flags |= ro ? 0 : BDRV_O_RDWR;
505 505

  
506 506
    QINCREF(bs_opts);
507
    ret = bdrv_open(dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error);
507
    ret = bdrv_open(&dinfo->bdrv, file, bs_opts, bdrv_flags, drv, &error);
508 508

  
509 509
    if (ret < 0) {
510 510
        error_setg(errp, "could not open disk image %s: %s",
......
1330 1330
                  qstring_from_str(snapshot_node_name));
1331 1331
    }
1332 1332

  
1333
    /* We will manually add the backing_hd field to the bs later */
1334
    state->new_bs = bdrv_new("");
1335 1333
    /* TODO Inherit bs->options or only take explicit options with an
1336 1334
     * extended QMP command? */
1337
    ret = bdrv_open(state->new_bs, new_image_file, options,
1335
    assert(state->new_bs == NULL);
1336
    ret = bdrv_open(&state->new_bs, new_image_file, options,
1338 1337
                    flags | BDRV_O_NO_BACKING, drv, &local_err);
1338
    /* We will manually add the backing_hd field to the bs later */
1339 1339
    if (ret != 0) {
1340 1340
        error_propagate(errp, local_err);
1341 1341
    }
......
1582 1582
    Error *local_err = NULL;
1583 1583
    int ret;
1584 1584

  
1585
    ret = bdrv_open(bs, filename, NULL, bdrv_flags, drv, &local_err);
1585
    ret = bdrv_open(&bs, filename, NULL, bdrv_flags, drv, &local_err);
1586 1586
    if (ret < 0) {
1587 1587
        error_propagate(errp, local_err);
1588 1588
        return;
......
2018 2018
        return;
2019 2019
    }
2020 2020

  
2021
    target_bs = bdrv_new("");
2022
    ret = bdrv_open(target_bs, target, NULL, flags, drv, &local_err);
2021
    target_bs = NULL;
2022
    ret = bdrv_open(&target_bs, target, NULL, flags, drv, &local_err);
2023 2023
    if (ret < 0) {
2024
        bdrv_unref(target_bs);
2025 2024
        error_propagate(errp, local_err);
2026 2025
        return;
2027 2026
    }
......
2162 2161
    /* Mirroring takes care of copy-on-write using the source's backing
2163 2162
     * file.
2164 2163
     */
2165
    target_bs = bdrv_new("");
2166
    ret = bdrv_open(target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv,
2164
    target_bs = NULL;
2165
    ret = bdrv_open(&target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv,
2167 2166
                    &local_err);
2168 2167
    if (ret < 0) {
2169
        bdrv_unref(target_bs);
2170 2168
        error_propagate(errp, local_err);
2171 2169
        return;
2172 2170
    }

Also available in: Unified diff