[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 38/56] rbd: Assign s->snap/image_name in qemu_rbd_ope
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 38/56] rbd: Assign s->snap/image_name in qemu_rbd_open() |
Date: |
Fri, 9 Mar 2018 17:19:15 +0100 |
Now that the options are already available in qemu_rbd_open() and not
only parsed in qemu_rbd_connect(), we can assign s->snap and
s->image_name there instead of passing the fields by reference to
qemu_rbd_connect().
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
---
block/rbd.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/block/rbd.c b/block/rbd.c
index 1cd526bcea..2ac7ffca42 100644
--- a/block/rbd.c
+++ b/block/rbd.c
@@ -571,7 +571,6 @@ static char *qemu_rbd_mon_host(BlockdevOptionsRbd *opts,
Error **errp)
}
static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t *io_ctx,
- char **s_snap, char **s_image_name,
BlockdevOptionsRbd *opts, bool cache,
const char *keypairs, const char *secretid,
Error **errp)
@@ -593,9 +592,6 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t
*io_ctx,
goto failed_opts;
}
- *s_snap = g_strdup(opts->snapshot);
- *s_image_name = g_strdup(opts->image);
-
/* try default location when conf=NULL, but ignore failure */
r = rados_conf_read_file(*cluster, opts->conf);
if (opts->has_conf && r < 0) {
@@ -649,8 +645,6 @@ static int qemu_rbd_connect(rados_t *cluster, rados_ioctx_t
*io_ctx,
failed_shutdown:
rados_shutdown(*cluster);
- g_free(*s_snap);
- g_free(*s_image_name);
failed_opts:
g_free(mon_host);
return r;
@@ -711,13 +705,15 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict
*options, int flags,
goto out;
}
- r = qemu_rbd_connect(&s->cluster, &s->io_ctx, &s->snap, &s->image_name,
- opts, !(flags & BDRV_O_NOCACHE), keypairs, secretid,
- errp);
+ r = qemu_rbd_connect(&s->cluster, &s->io_ctx, opts,
+ !(flags & BDRV_O_NOCACHE), keypairs, secretid, errp);
if (r < 0) {
goto out;
}
+ s->snap = g_strdup(opts->snapshot);
+ s->image_name = g_strdup(opts->image);
+
/* rbd_open is always r/w */
r = rbd_open(s->io_ctx, s->image_name, &s->image, s->snap);
if (r < 0) {
--
2.13.6
- [Qemu-devel] [PULL 40/56] nfs: Use QAPI options in nfs_client_open(), (continued)
- [Qemu-devel] [PULL 40/56] nfs: Use QAPI options in nfs_client_open(), Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 48/56] file-posix: Fix no-op bdrv_truncate() with falloc preallocation, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 41/56] nfs: Support .bdrv_co_create, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 46/56] ssh: Pass BlockdevOptionsSsh to connect_to_ssh(), Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 49/56] block: Fail bdrv_truncate() with negative size, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 44/56] ssh: Use QAPI BlockdevOptionsSsh object, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 39/56] rbd: Use qemu_rbd_connect() in qemu_rbd_do_create(), Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 35/56] rbd: Remove non-schema options from runtime_opts, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 43/56] sheepdog: Support .bdrv_co_create, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 51/56] qemu-iotests: Test ssh image creation over QMP, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 38/56] rbd: Assign s->snap/image_name in qemu_rbd_open(),
Kevin Wolf <=
- [Qemu-devel] [PULL 42/56] sheepdog: QAPIfy "redundancy" create option, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 47/56] ssh: Support .bdrv_co_create, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 45/56] ssh: QAPIfy host-key-check option, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 52/56] iotests: Test creating overlay when guest running, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 54/56] iotests: Skip test for ENOMEM error, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 53/56] iotests: Mark all tests executable, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 56/56] qemu-iotests: fix 203 migration completion race, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 55/56] iotests: Tweak 030 in order to trigger a race condition with parallel jobs, Kevin Wolf, 2018/03/09
- [Qemu-devel] [PULL 50/56] qemu-iotests: Test qcow2 over file image creation with QMP, Kevin Wolf, 2018/03/09
- Re: [Qemu-devel] [PULL 00/56] Block layer patches, Peter Maydell, 2018/03/12