diff options
author | Max Reitz <mreitz@redhat.com> | 2014-02-18 18:33:05 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-02-21 21:02:21 +0100 |
commit | f67503e5bd8997ea7ec3f4bfa0af0e06321771a6 (patch) | |
tree | 1b564ea3c13e76166a7e866995eb9c7f4055ae5c /qemu-img.c | |
parent | e6dc8a1f83835054fcaf1dcb41af7c868688c068 (diff) |
block: Change BDS parameter of bdrv_open() to **
Make bdrv_open() take a pointer to a BDS pointer, similarly to
bdrv_file_open(). If a pointer to a NULL pointer is given, bdrv_open()
will create a new BDS with an empty name; if the BDS pointer is not
NULL, that existing BDS will be reused (in the same way as bdrv_open()
already did).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'qemu-img.c')
-rw-r--r-- | qemu-img.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/qemu-img.c b/qemu-img.c index 0927b090de..59b101347c 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -289,7 +289,7 @@ static BlockDriverState *bdrv_new_open(const char *filename, drv = NULL; } - ret = bdrv_open(bs, filename, NULL, flags, drv, &local_err); + ret = bdrv_open(&bs, filename, NULL, flags, drv, &local_err); if (ret < 0) { error_report("Could not open '%s': %s", filename, error_get_pretty(local_err)); @@ -310,9 +310,7 @@ static BlockDriverState *bdrv_new_open(const char *filename, } return bs; fail: - if (bs) { - bdrv_unref(bs); - } + bdrv_unref(bs); return NULL; } @@ -2314,7 +2312,7 @@ static int img_rebase(int argc, char **argv) bs_old_backing = bdrv_new("old_backing"); bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); - ret = bdrv_open(bs_old_backing, backing_name, NULL, BDRV_O_FLAGS, + ret = bdrv_open(&bs_old_backing, backing_name, NULL, BDRV_O_FLAGS, old_backing_drv, &local_err); if (ret) { error_report("Could not open old backing file '%s': %s", @@ -2324,7 +2322,7 @@ static int img_rebase(int argc, char **argv) } if (out_baseimg[0]) { bs_new_backing = bdrv_new("new_backing"); - ret = bdrv_open(bs_new_backing, out_baseimg, NULL, BDRV_O_FLAGS, + ret = bdrv_open(&bs_new_backing, out_baseimg, NULL, BDRV_O_FLAGS, new_backing_drv, &local_err); if (ret) { error_report("Could not open new backing file '%s': %s", |