From e59a0cf17b1b9932b65e6fc25d6856976f5e4831 Mon Sep 17 00:00:00 2001 From: Max Reitz Date: Sat, 24 Feb 2018 16:40:32 +0100 Subject: 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 Reviewed-by: Alberto Garcia Message-Id: <20180224154033.29559-7-mreitz@redhat.com> Reviewed-by: Eric Blake [eblake: rebase to qobject_to() parameter order and qapi headers split] Signed-off-by: Eric Blake --- block.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'block.c') diff --git a/block.c b/block.c index fd33d5ec43..ab77ba0233 100644 --- a/block.c +++ b/block.c @@ -33,6 +33,7 @@ #include "qapi/error.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qjson.h" +#include "qapi/qmp/qnull.h" #include "qapi/qmp/qstring.h" #include "qapi/qobject-output-visitor.h" #include "qapi/qapi-visit-block-core.h" @@ -2645,7 +2646,9 @@ static BlockDriverState *bdrv_open_inherit(const char *filename, /* See cautionary note on accessing @options above */ backing = qdict_get_try_str(options, "backing"); - if (backing && *backing == '\0') { + if (qobject_to(QNull, qdict_get(options, "backing")) != NULL || + (backing && *backing == '\0')) + { flags |= BDRV_O_NO_BACKING; qdict_del(options, "backing"); } -- cgit v1.2.1