提交 579cf1d1 编写于 作者: E Eric Blake 提交者: Markus Armbruster

block: Use QDict helpers for --force-share

Fam's addition of --force-share in commits 459571f7 and 335e9937
were developed prior to the addition of QDict scalar insertion
macros, but merged after the general cleanup in commit 46f5ac20.
Patch created mechanically by rerunning:

 spatch --sp-file scripts/coccinelle/qobject.cocci \
        --macro-file scripts/cocci-macro-file.h --dir . --in-place
Signed-off-by: NEric Blake <eblake@redhat.com>
Message-Id: <20170515195439.17677-1-eblake@redhat.com>
Reviewed-by: NFam Zheng <famz@redhat.com>
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 08fba7ac
...@@ -296,7 +296,7 @@ static BlockBackend *img_open_opts(const char *optstr, ...@@ -296,7 +296,7 @@ static BlockBackend *img_open_opts(const char *optstr,
error_report("--force-share/-U conflicts with image options"); error_report("--force-share/-U conflicts with image options");
return NULL; return NULL;
} }
qdict_put(options, BDRV_OPT_FORCE_SHARE, qbool_from_bool(true)); qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true);
} }
blk = blk_new_open(NULL, NULL, options, flags, &local_err); blk = blk_new_open(NULL, NULL, options, flags, &local_err);
if (!blk) { if (!blk) {
...@@ -326,7 +326,7 @@ static BlockBackend *img_open_file(const char *filename, ...@@ -326,7 +326,7 @@ static BlockBackend *img_open_file(const char *filename,
} }
if (force_share) { if (force_share) {
qdict_put(options, BDRV_OPT_FORCE_SHARE, qbool_from_bool(true)); qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true);
} }
blk = blk_new_open(filename, NULL, options, flags, &local_err); blk = blk_new_open(filename, NULL, options, flags, &local_err);
if (!blk) { if (!blk) {
...@@ -3156,8 +3156,7 @@ static int img_rebase(int argc, char **argv) ...@@ -3156,8 +3156,7 @@ static int img_rebase(int argc, char **argv)
if (!options) { if (!options) {
options = qdict_new(); options = qdict_new();
} }
qdict_put(options, BDRV_OPT_FORCE_SHARE, qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true);
qbool_from_bool(true));
} }
bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name)); bdrv_get_backing_filename(bs, backing_name, sizeof(backing_name));
blk_old_backing = blk_new_open(backing_name, NULL, blk_old_backing = blk_new_open(backing_name, NULL,
......
...@@ -76,7 +76,7 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share, ...@@ -76,7 +76,7 @@ static int openfile(char *name, int flags, bool writethrough, bool force_share,
QDECREF(opts); QDECREF(opts);
return 1; return 1;
} }
qdict_put(opts, BDRV_OPT_FORCE_SHARE, qbool_from_bool(true)); qdict_put_bool(opts, BDRV_OPT_FORCE_SHARE, true);
} }
qemuio_blk = blk_new_open(name, NULL, opts, flags, &local_err); qemuio_blk = blk_new_open(name, NULL, opts, flags, &local_err);
if (!qemuio_blk) { if (!qemuio_blk) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册