mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
qobject: Replace qobject_incref/QINCREF qobject_decref/QDECREF
Now that we can safely call QOBJECT() on QObject * as well as its subtypes, we can have macros qobject_ref() / qobject_unref() that work everywhere instead of having to use QINCREF() / QDECREF() for QObject and qobject_incref() / qobject_decref() for its subtypes. The replacement is mechanical, except I broke a long line, and added a cast in monitor_qmp_cleanup_req_queue_locked(). Unlike qobject_decref(), qobject_unref() doesn't accept void *. Note that the new macros evaluate their argument exactly once, thus no need to shout them. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180419150145.24795-4-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [Rebased, semantic conflict resolved, commit message improved] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
committed by
Markus Armbruster
parent
3d3eacaecc
commit
cb3e7f08ae
@@ -1227,9 +1227,9 @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
|
||||
|
||||
ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp);
|
||||
if (ret < 0) {
|
||||
QDECREF(bs->explicit_options);
|
||||
qobject_unref(bs->explicit_options);
|
||||
bs->explicit_options = NULL;
|
||||
QDECREF(bs->options);
|
||||
qobject_unref(bs->options);
|
||||
bs->options = NULL;
|
||||
bdrv_unref(bs);
|
||||
return NULL;
|
||||
@@ -1460,7 +1460,7 @@ static QDict *parse_json_filename(const char *filename, Error **errp)
|
||||
|
||||
options = qobject_to(QDict, options_obj);
|
||||
if (!options) {
|
||||
qobject_decref(options_obj);
|
||||
qobject_unref(options_obj);
|
||||
error_setg(errp, "Invalid JSON object given");
|
||||
return NULL;
|
||||
}
|
||||
@@ -1490,7 +1490,7 @@ static void parse_json_protocol(QDict *options, const char **pfilename,
|
||||
/* Options given in the filename have lower priority than options
|
||||
* specified directly */
|
||||
qdict_join(options, json_options, false);
|
||||
QDECREF(json_options);
|
||||
qobject_unref(json_options);
|
||||
*pfilename = NULL;
|
||||
}
|
||||
|
||||
@@ -2273,7 +2273,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||
if (reference || qdict_haskey(options, "file.filename")) {
|
||||
backing_filename[0] = '\0';
|
||||
} else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) {
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
goto free_exit;
|
||||
} else {
|
||||
bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX,
|
||||
@@ -2281,7 +2281,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||
if (local_err) {
|
||||
ret = -EINVAL;
|
||||
error_propagate(errp, local_err);
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
goto free_exit;
|
||||
}
|
||||
}
|
||||
@@ -2289,7 +2289,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||
if (!bs->drv || !bs->drv->supports_backing) {
|
||||
ret = -EINVAL;
|
||||
error_setg(errp, "Driver doesn't support backing files");
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
goto free_exit;
|
||||
}
|
||||
|
||||
@@ -2323,7 +2323,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *parent_options,
|
||||
|
||||
free_exit:
|
||||
g_free(backing_filename);
|
||||
QDECREF(tmp_parent_options);
|
||||
qobject_unref(tmp_parent_options);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2356,7 +2356,7 @@ bdrv_open_child_bs(const char *filename, QDict *options, const char *bdref_key,
|
||||
error_setg(errp, "A block device must be specified for \"%s\"",
|
||||
bdref_key);
|
||||
}
|
||||
QDECREF(image_options);
|
||||
qobject_unref(image_options);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2449,7 +2449,7 @@ BlockDriverState *bdrv_open_blockdev_ref(BlockdevRef *ref, Error **errp)
|
||||
obj = NULL;
|
||||
|
||||
fail:
|
||||
qobject_decref(obj);
|
||||
qobject_unref(obj);
|
||||
visit_free(v);
|
||||
return bs;
|
||||
}
|
||||
@@ -2519,7 +2519,7 @@ static BlockDriverState *bdrv_append_temp_snapshot(BlockDriverState *bs,
|
||||
}
|
||||
|
||||
out:
|
||||
QDECREF(snapshot_options);
|
||||
qobject_unref(snapshot_options);
|
||||
g_free(tmp_filename);
|
||||
return bs_snapshot;
|
||||
}
|
||||
@@ -2530,7 +2530,7 @@ out:
|
||||
* options is a QDict of options to pass to the block drivers, or NULL for an
|
||||
* empty set of options. The reference to the QDict belongs to the block layer
|
||||
* after the call (even on failure), so if the caller intends to reuse the
|
||||
* dictionary, it needs to use QINCREF() before calling bdrv_open.
|
||||
* dictionary, it needs to use qobject_ref() before calling bdrv_open.
|
||||
*
|
||||
* If *pbs is NULL, a new BDS will be created with a pointer to it stored there.
|
||||
* If it is not NULL, the referenced BDS will be reused.
|
||||
@@ -2561,7 +2561,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
|
||||
|
||||
if (reference) {
|
||||
bool options_non_empty = options ? qdict_size(options) : false;
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
|
||||
if (filename || options_non_empty) {
|
||||
error_setg(errp, "Cannot reference an existing block device with "
|
||||
@@ -2752,7 +2752,7 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
|
||||
|
||||
bdrv_parent_cb_change_media(bs, true);
|
||||
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
|
||||
/* For snapshot=on, create a temporary qcow2 overlay. bs points to the
|
||||
* temporary snapshot afterwards. */
|
||||
@@ -2776,10 +2776,10 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
|
||||
|
||||
fail:
|
||||
blk_unref(file);
|
||||
QDECREF(snapshot_options);
|
||||
QDECREF(bs->explicit_options);
|
||||
QDECREF(bs->options);
|
||||
QDECREF(options);
|
||||
qobject_unref(snapshot_options);
|
||||
qobject_unref(bs->explicit_options);
|
||||
qobject_unref(bs->options);
|
||||
qobject_unref(options);
|
||||
bs->options = NULL;
|
||||
bs->explicit_options = NULL;
|
||||
bdrv_unref(bs);
|
||||
@@ -2788,8 +2788,8 @@ fail:
|
||||
|
||||
close_and_fail:
|
||||
bdrv_unref(bs);
|
||||
QDECREF(snapshot_options);
|
||||
QDECREF(options);
|
||||
qobject_unref(snapshot_options);
|
||||
qobject_unref(options);
|
||||
error_propagate(errp, local_err);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2884,7 +2884,7 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
|
||||
old_options = qdict_clone_shallow(bs->explicit_options);
|
||||
}
|
||||
bdrv_join_options(bs, options, old_options);
|
||||
QDECREF(old_options);
|
||||
qobject_unref(old_options);
|
||||
|
||||
explicit_options = qdict_clone_shallow(options);
|
||||
|
||||
@@ -2899,13 +2899,13 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
|
||||
qemu_opts_absorb_qdict(opts, options_copy, NULL);
|
||||
update_flags_from_options(&flags, opts);
|
||||
qemu_opts_del(opts);
|
||||
QDECREF(options_copy);
|
||||
qobject_unref(options_copy);
|
||||
}
|
||||
|
||||
/* Old values are used for options that aren't set yet */
|
||||
old_options = qdict_clone_shallow(bs->options);
|
||||
bdrv_join_options(bs, options, old_options);
|
||||
QDECREF(old_options);
|
||||
qobject_unref(old_options);
|
||||
|
||||
/* bdrv_open_inherit() sets and clears some additional flags internally */
|
||||
flags &= ~BDRV_O_PROTOCOL;
|
||||
@@ -2917,8 +2917,8 @@ static BlockReopenQueue *bdrv_reopen_queue_child(BlockReopenQueue *bs_queue,
|
||||
bs_entry = g_new0(BlockReopenQueueEntry, 1);
|
||||
QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry);
|
||||
} else {
|
||||
QDECREF(bs_entry->state.options);
|
||||
QDECREF(bs_entry->state.explicit_options);
|
||||
qobject_unref(bs_entry->state.options);
|
||||
qobject_unref(bs_entry->state.explicit_options);
|
||||
}
|
||||
|
||||
bs_entry->state.bs = bs;
|
||||
@@ -3008,9 +3008,9 @@ cleanup:
|
||||
if (ret && bs_entry->prepared) {
|
||||
bdrv_reopen_abort(&bs_entry->state);
|
||||
} else if (ret) {
|
||||
QDECREF(bs_entry->state.explicit_options);
|
||||
qobject_unref(bs_entry->state.explicit_options);
|
||||
}
|
||||
QDECREF(bs_entry->state.options);
|
||||
qobject_unref(bs_entry->state.options);
|
||||
g_free(bs_entry);
|
||||
}
|
||||
g_free(bs_queue);
|
||||
@@ -3253,7 +3253,7 @@ void bdrv_reopen_commit(BDRVReopenState *reopen_state)
|
||||
}
|
||||
|
||||
/* set BDS specific flags now */
|
||||
QDECREF(bs->explicit_options);
|
||||
qobject_unref(bs->explicit_options);
|
||||
|
||||
bs->explicit_options = reopen_state->explicit_options;
|
||||
bs->open_flags = reopen_state->flags;
|
||||
@@ -3296,7 +3296,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
|
||||
drv->bdrv_reopen_abort(reopen_state);
|
||||
}
|
||||
|
||||
QDECREF(reopen_state->explicit_options);
|
||||
qobject_unref(reopen_state->explicit_options);
|
||||
|
||||
bdrv_abort_perm_update(reopen_state->bs);
|
||||
}
|
||||
@@ -3343,11 +3343,11 @@ static void bdrv_close(BlockDriverState *bs)
|
||||
bs->total_sectors = 0;
|
||||
bs->encrypted = false;
|
||||
bs->sg = false;
|
||||
QDECREF(bs->options);
|
||||
QDECREF(bs->explicit_options);
|
||||
qobject_unref(bs->options);
|
||||
qobject_unref(bs->explicit_options);
|
||||
bs->options = NULL;
|
||||
bs->explicit_options = NULL;
|
||||
QDECREF(bs->full_open_options);
|
||||
qobject_unref(bs->full_open_options);
|
||||
bs->full_open_options = NULL;
|
||||
|
||||
bdrv_release_named_dirty_bitmaps(bs);
|
||||
@@ -5134,7 +5134,7 @@ static bool append_open_options(QDict *d, BlockDriverState *bs)
|
||||
continue;
|
||||
}
|
||||
|
||||
qobject_incref(qdict_entry_value(entry));
|
||||
qobject_ref(qdict_entry_value(entry));
|
||||
qdict_put_obj(d, qdict_entry_key(entry), qdict_entry_value(entry));
|
||||
found_any = true;
|
||||
}
|
||||
@@ -5174,21 +5174,21 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
||||
* information before refreshing it */
|
||||
bs->exact_filename[0] = '\0';
|
||||
if (bs->full_open_options) {
|
||||
QDECREF(bs->full_open_options);
|
||||
qobject_unref(bs->full_open_options);
|
||||
bs->full_open_options = NULL;
|
||||
}
|
||||
|
||||
opts = qdict_new();
|
||||
append_open_options(opts, bs);
|
||||
drv->bdrv_refresh_filename(bs, opts);
|
||||
QDECREF(opts);
|
||||
qobject_unref(opts);
|
||||
} else if (bs->file) {
|
||||
/* Try to reconstruct valid information from the underlying file */
|
||||
bool has_open_options;
|
||||
|
||||
bs->exact_filename[0] = '\0';
|
||||
if (bs->full_open_options) {
|
||||
QDECREF(bs->full_open_options);
|
||||
qobject_unref(bs->full_open_options);
|
||||
bs->full_open_options = NULL;
|
||||
}
|
||||
|
||||
@@ -5207,12 +5207,12 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
||||
* suffices without querying the (exact_)filename of this BDS. */
|
||||
if (bs->file->bs->full_open_options) {
|
||||
qdict_put_str(opts, "driver", drv->format_name);
|
||||
QINCREF(bs->file->bs->full_open_options);
|
||||
qobject_ref(bs->file->bs->full_open_options);
|
||||
qdict_put(opts, "file", bs->file->bs->full_open_options);
|
||||
|
||||
bs->full_open_options = opts;
|
||||
} else {
|
||||
QDECREF(opts);
|
||||
qobject_unref(opts);
|
||||
}
|
||||
} else if (!bs->full_open_options && qdict_size(bs->options)) {
|
||||
/* There is no underlying file BDS (at least referenced by BDS.file),
|
||||
@@ -5246,7 +5246,7 @@ void bdrv_refresh_filename(BlockDriverState *bs)
|
||||
QString *json = qobject_to_json(QOBJECT(bs->full_open_options));
|
||||
snprintf(bs->filename, sizeof(bs->filename), "json:%s",
|
||||
qstring_get_str(json));
|
||||
QDECREF(json);
|
||||
qobject_unref(json);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -845,12 +845,12 @@ static void blkdebug_refresh_filename(BlockDriverState *bs, QDict *options)
|
||||
opts = qdict_new();
|
||||
qdict_put_str(opts, "driver", "blkdebug");
|
||||
|
||||
QINCREF(bs->file->bs->full_open_options);
|
||||
qobject_ref(bs->file->bs->full_open_options);
|
||||
qdict_put(opts, "image", bs->file->bs->full_open_options);
|
||||
|
||||
for (e = qdict_first(options); e; e = qdict_next(options, e)) {
|
||||
if (strcmp(qdict_entry_key(e), "x-image")) {
|
||||
qobject_incref(qdict_entry_value(e));
|
||||
qobject_ref(qdict_entry_value(e));
|
||||
qdict_put_obj(opts, qdict_entry_key(e), qdict_entry_value(e));
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -291,9 +291,9 @@ static void blkverify_refresh_filename(BlockDriverState *bs, QDict *options)
|
||||
QDict *opts = qdict_new();
|
||||
qdict_put_str(opts, "driver", "blkverify");
|
||||
|
||||
QINCREF(bs->file->bs->full_open_options);
|
||||
qobject_ref(bs->file->bs->full_open_options);
|
||||
qdict_put(opts, "raw", bs->file->bs->full_open_options);
|
||||
QINCREF(s->test_file->bs->full_open_options);
|
||||
qobject_ref(s->test_file->bs->full_open_options);
|
||||
qdict_put(opts, "test", s->test_file->bs->full_open_options);
|
||||
|
||||
bs->full_open_options = opts;
|
||||
|
||||
+2
-2
@@ -305,7 +305,7 @@ static int block_crypto_open_generic(QCryptoBlockFormat format,
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
QDECREF(cryptoopts);
|
||||
qobject_unref(cryptoopts);
|
||||
qapi_free_QCryptoBlockOpenOptions(open_opts);
|
||||
return ret;
|
||||
}
|
||||
@@ -635,7 +635,7 @@ static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename,
|
||||
fail:
|
||||
bdrv_unref(bs);
|
||||
qapi_free_QCryptoBlockCreateOptions(create_opts);
|
||||
QDECREF(cryptoopts);
|
||||
qobject_unref(cryptoopts);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -650,7 +650,7 @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf,
|
||||
}
|
||||
gsconf = NULL;
|
||||
|
||||
QDECREF(backing_options);
|
||||
qobject_unref(backing_options);
|
||||
backing_options = NULL;
|
||||
g_free(str);
|
||||
str = NULL;
|
||||
@@ -663,7 +663,7 @@ out:
|
||||
qapi_free_SocketAddress(gsconf);
|
||||
qemu_opts_del(opts);
|
||||
g_free(str);
|
||||
QDECREF(backing_options);
|
||||
qobject_unref(backing_options);
|
||||
errno = EINVAL;
|
||||
return -errno;
|
||||
}
|
||||
|
||||
+1
-1
@@ -2143,7 +2143,7 @@ static int coroutine_fn iscsi_co_create_opts(const char *filename, QemuOpts *opt
|
||||
} else {
|
||||
ret = iscsi_open(bs, bs_options, 0, NULL);
|
||||
}
|
||||
QDECREF(bs_options);
|
||||
qobject_unref(bs_options);
|
||||
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
|
||||
+2
-2
@@ -293,8 +293,8 @@ static SocketAddress *nbd_config(BDRVNBDState *s, QDict *options,
|
||||
}
|
||||
|
||||
done:
|
||||
QDECREF(addr);
|
||||
qobject_decref(crumpled_addr);
|
||||
qobject_unref(addr);
|
||||
qobject_unref(crumpled_addr);
|
||||
visit_free(iv);
|
||||
return saddr;
|
||||
}
|
||||
|
||||
+2
-2
@@ -567,7 +567,7 @@ static BlockdevOptionsNfs *nfs_options_qdict_to_qapi(QDict *options,
|
||||
v = qobject_input_visitor_new_keyval(crumpled);
|
||||
visit_type_BlockdevOptionsNfs(v, NULL, &opts, &local_err);
|
||||
visit_free(v);
|
||||
qobject_decref(crumpled);
|
||||
qobject_unref(crumpled);
|
||||
|
||||
if (local_err) {
|
||||
return NULL;
|
||||
@@ -683,7 +683,7 @@ static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts,
|
||||
|
||||
ret = 0;
|
||||
out:
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
}
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ static int coroutine_fn null_co_block_status(BlockDriverState *bs,
|
||||
|
||||
static void null_refresh_filename(BlockDriverState *bs, QDict *opts)
|
||||
{
|
||||
QINCREF(opts);
|
||||
qobject_ref(opts);
|
||||
qdict_del(opts, "filename");
|
||||
|
||||
if (!qdict_size(opts)) {
|
||||
|
||||
+1
-1
@@ -1073,7 +1073,7 @@ static int nvme_reopen_prepare(BDRVReopenState *reopen_state,
|
||||
|
||||
static void nvme_refresh_filename(BlockDriverState *bs, QDict *opts)
|
||||
{
|
||||
QINCREF(opts);
|
||||
qobject_ref(opts);
|
||||
qdict_del(opts, "filename");
|
||||
|
||||
if (!qdict_size(opts)) {
|
||||
|
||||
+2
-2
@@ -651,7 +651,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
|
||||
qdict_put_str(qdict, "file", bs->node_name);
|
||||
|
||||
qobj = qdict_crumple(qdict, errp);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
qdict = qobject_to(QDict, qobj);
|
||||
if (qdict == NULL) {
|
||||
ret = -EINVAL;
|
||||
@@ -682,7 +682,7 @@ static int coroutine_fn parallels_co_create_opts(const char *filename,
|
||||
ret = 0;
|
||||
|
||||
done:
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
bdrv_unref(bs);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -773,7 +773,7 @@ void bdrv_image_info_specific_dump(fprintf_function func_fprintf, void *f,
|
||||
visit_complete(v, &obj);
|
||||
data = qdict_get(qobject_to(QDict, obj), "data");
|
||||
dump_qobject(func_fprintf, f, 1, data);
|
||||
qobject_decref(obj);
|
||||
qobject_unref(obj);
|
||||
visit_free(v);
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -315,7 +315,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
QDECREF(encryptopts);
|
||||
qobject_unref(encryptopts);
|
||||
qapi_free_QCryptoBlockOpenOptions(crypto_opts);
|
||||
qemu_co_mutex_init(&s->lock);
|
||||
return 0;
|
||||
@@ -326,7 +326,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
g_free(s->cluster_cache);
|
||||
g_free(s->cluster_data);
|
||||
qcrypto_block_free(s->crypto);
|
||||
QDECREF(encryptopts);
|
||||
qobject_unref(encryptopts);
|
||||
qapi_free_QCryptoBlockOpenOptions(crypto_opts);
|
||||
return ret;
|
||||
}
|
||||
@@ -995,7 +995,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
|
||||
qdict_put_str(qdict, "file", bs->node_name);
|
||||
|
||||
qobj = qdict_crumple(qdict, errp);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
qdict = qobject_to(QDict, qobj);
|
||||
if (qdict == NULL) {
|
||||
ret = -EINVAL;
|
||||
@@ -1025,7 +1025,7 @@ static int coroutine_fn qcow_co_create_opts(const char *filename,
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
bdrv_unref(bs);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
|
||||
+4
-4
@@ -1063,7 +1063,7 @@ static int qcow2_update_options_prepare(BlockDriverState *bs,
|
||||
|
||||
ret = 0;
|
||||
fail:
|
||||
QDECREF(encryptopts);
|
||||
qobject_unref(encryptopts);
|
||||
qemu_opts_del(opts);
|
||||
opts = NULL;
|
||||
return ret;
|
||||
@@ -2183,7 +2183,7 @@ static void coroutine_fn qcow2_co_invalidate_cache(BlockDriverState *bs,
|
||||
qemu_co_mutex_lock(&s->lock);
|
||||
ret = qcow2_do_open(bs, options, flags, &local_err);
|
||||
qemu_co_mutex_unlock(&s->lock);
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
error_prepend(errp, "Could not reopen qcow2 layer: ");
|
||||
@@ -3139,7 +3139,7 @@ static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opt
|
||||
|
||||
/* Now get the QAPI type BlockdevCreateOptions */
|
||||
qobj = qdict_crumple(qdict, errp);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
qdict = qobject_to(QDict, qobj);
|
||||
if (qdict == NULL) {
|
||||
ret = -EINVAL;
|
||||
@@ -3168,7 +3168,7 @@ static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opt
|
||||
|
||||
ret = 0;
|
||||
finish:
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
bdrv_unref(bs);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
|
||||
+2
-2
@@ -763,7 +763,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
|
||||
qdict_put_str(qdict, "file", bs->node_name);
|
||||
|
||||
qobj = qdict_crumple(qdict, errp);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
qdict = qobject_to(QDict, qobj);
|
||||
if (qdict == NULL) {
|
||||
ret = -EINVAL;
|
||||
@@ -789,7 +789,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(const char *filename,
|
||||
ret = bdrv_qed_co_create(create_options, errp);
|
||||
|
||||
fail:
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
bdrv_unref(bs);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
|
||||
+1
-1
@@ -1082,7 +1082,7 @@ static void quorum_refresh_filename(BlockDriverState *bs, QDict *options)
|
||||
|
||||
children = qlist_new();
|
||||
for (i = 0; i < s->num_children; i++) {
|
||||
QINCREF(s->children[i]->bs->full_open_options);
|
||||
qobject_ref(s->children[i]->bs->full_open_options);
|
||||
qlist_append(children, s->children[i]->bs->full_open_options);
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -226,7 +226,7 @@ static void qemu_rbd_parse_filename(const char *filename, QDict *options,
|
||||
|
||||
done:
|
||||
g_free(buf);
|
||||
QDECREF(keypairs);
|
||||
qobject_unref(keypairs);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -275,17 +275,17 @@ static int qemu_rbd_set_keypairs(rados_t cluster, const char *keypairs_json,
|
||||
key = qstring_get_str(name);
|
||||
|
||||
ret = rados_conf_set(cluster, key, qstring_get_str(value));
|
||||
QDECREF(value);
|
||||
qobject_unref(value);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "invalid conf option %s", key);
|
||||
QDECREF(name);
|
||||
qobject_unref(name);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
QDECREF(name);
|
||||
qobject_unref(name);
|
||||
}
|
||||
|
||||
QDECREF(keypairs);
|
||||
qobject_unref(keypairs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ static int coroutine_fn qemu_rbd_co_create_opts(const char *filename,
|
||||
}
|
||||
|
||||
exit:
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
}
|
||||
@@ -664,7 +664,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
v = qobject_input_visitor_new_keyval(crumpled);
|
||||
visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err);
|
||||
visit_free(v);
|
||||
qobject_decref(crumpled);
|
||||
qobject_unref(crumpled);
|
||||
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
|
||||
+6
-6
@@ -567,8 +567,8 @@ static SocketAddress *sd_server_config(QDict *options, Error **errp)
|
||||
|
||||
done:
|
||||
visit_free(iv);
|
||||
qobject_decref(crumpled_server);
|
||||
QDECREF(server);
|
||||
qobject_unref(crumpled_server);
|
||||
qobject_unref(server);
|
||||
return saddr;
|
||||
}
|
||||
|
||||
@@ -1883,7 +1883,7 @@ static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t size,
|
||||
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
qobject_decref(obj);
|
||||
qobject_unref(obj);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1901,7 +1901,7 @@ static int sd_create_prealloc(BlockdevOptionsSheepdog *location, int64_t size,
|
||||
ret = sd_prealloc(bs, 0, size, errp);
|
||||
fail:
|
||||
bdrv_unref(bs);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2226,7 +2226,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
v = qobject_input_visitor_new_keyval(crumpled);
|
||||
visit_type_BlockdevCreateOptions(v, NULL, &create_options, &local_err);
|
||||
visit_free(v);
|
||||
qobject_decref(crumpled);
|
||||
qobject_unref(crumpled);
|
||||
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
@@ -2252,7 +2252,7 @@ static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
ret = sd_co_create(create_options, errp);
|
||||
fail:
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
QDECREF(qdict);
|
||||
qobject_unref(qdict);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -214,7 +214,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
||||
bdrv_ref(file);
|
||||
|
||||
qdict_extract_subqdict(options, &file_options, "file.");
|
||||
QDECREF(file_options);
|
||||
qobject_unref(file_options);
|
||||
qdict_put_str(options, "file", bdrv_get_node_name(file));
|
||||
|
||||
drv->bdrv_close(bs);
|
||||
@@ -223,7 +223,7 @@ int bdrv_snapshot_goto(BlockDriverState *bs,
|
||||
|
||||
ret = bdrv_snapshot_goto(file, snapshot_id, errp);
|
||||
open_ret = drv->bdrv_open(bs, options, bs->open_flags, &local_err);
|
||||
QDECREF(options);
|
||||
qobject_unref(options);
|
||||
if (open_ret < 0) {
|
||||
bdrv_unref(file);
|
||||
bs->drv = NULL;
|
||||
|
||||
+2
-2
@@ -638,7 +638,7 @@ static BlockdevOptionsSsh *ssh_parse_options(QDict *options, Error **errp)
|
||||
v = qobject_input_visitor_new(crumpled);
|
||||
visit_type_BlockdevOptionsSsh(v, NULL, &result, &local_err);
|
||||
visit_free(v);
|
||||
qobject_decref(crumpled);
|
||||
qobject_unref(crumpled);
|
||||
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
@@ -917,7 +917,7 @@ static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts,
|
||||
ret = ssh_co_create(create_options, errp);
|
||||
|
||||
out:
|
||||
QDECREF(uri_options);
|
||||
qobject_unref(uri_options);
|
||||
qapi_free_BlockdevCreateOptions(create_options);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user