aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2018-02-24 16:40:32 +0100
committerEric Blake <eblake@redhat.com>2018-03-19 14:58:36 -0500
commite59a0cf17b1b9932b65e6fc25d6856976f5e4831 (patch)
treef303124257a396e0705ad0231d29c1d428adcbb3 /blockdev.c
parent532fb532847365f61a9c6e1291b6588a43bc1cc4 (diff)
block: Handle null backing link
Instead of converting all "backing": null instances into "backing": "", handle a null value directly in bdrv_open_inherit(). This enables explicitly null backing links for json:{} filenames. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Message-Id: <20180224154033.29559-7-mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [eblake: rebase to qobject_to() parameter order and qapi headers split] Signed-off-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/blockdev.c b/blockdev.c
index 6067792e41..5048e73aba 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -4045,7 +4045,6 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
QObject *obj;
Visitor *v = qobject_output_visitor_new(&obj);
QDict *qdict;
- const QDictEntry *ent;
Error *local_err = NULL;
visit_type_BlockdevOptions(v, NULL, &options, &local_err);
@@ -4059,19 +4058,6 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
qdict_flatten(qdict);
- /*
- * Rewrite "backing": null to "backing": ""
- * TODO Rewrite "" to null instead, and perhaps not even here
- */
- for (ent = qdict_first(qdict); ent; ent = qdict_next(qdict, ent)) {
- char *dot = strrchr(ent->key, '.');
-
- if (!strcmp(dot ? dot + 1 : ent->key, "backing")
- && qobject_type(ent->value) == QTYPE_QNULL) {
- qdict_put(qdict, ent->key, qstring_new());
- }
- }
-
if (!qdict_get_try_str(qdict, "node-name")) {
error_setg(errp, "'node-name' must be specified for the root node");
goto fail;