[Qemu-block] [PATCH v2 3/6] qapi: Remove qobject_to_X() functions

2018-01-20 Thread Max Reitz
They are no longer needed now. Signed-off-by: Max Reitz --- include/qapi/qmp/qbool.h | 1 - include/qapi/qmp/qdict.h | 1 - include/qapi/qmp/qlist.h | 1 - include/qapi/qmp/qnum.h| 1 - include/qapi/qmp/qstring.h | 1 - qobject/qbool.c| 11 --- qobject/qdict.c

[Qemu-block] [PATCH v2 1/6] qapi: Add qobject_to()

2018-01-20 Thread Max Reitz
This is a dynamic casting macro that, given a QObject type, returns an object as that type or NULL if the object is of a different type (or NULL itself). The macro uses lower-case letters because: 1. There does not seem to be a hard rule on whether qemu macros have to be upper-cased, 2. The cur

[Qemu-block] [PATCH v2 0/6] block: Handle null backing link

2018-01-20 Thread Max Reitz
Currently, we try to rewrite every occurrence of "backing": null into "backing": "" in qmp_blockdev_add(). However, that breaks using the same "backing": null construction in json:{} file names (which do not go through qmp_blockdev_add()). Currently, these then just behave as if the option has no

[Qemu-block] [PATCH v2 4/6] qapi: Make more of qobject_to()

2018-01-20 Thread Max Reitz
This patch reworks some places which use either qobject_type() checks plus qobject_to(), where the latter alone is sufficient, or NULL checks plus qobject_type() checks where we can simply do a qobject_to() != NULL check. Signed-off-by: Max Reitz --- qapi/qobject-input-visitor.c | 4 ++-- qobje

[Qemu-block] [PATCH v2 6/6] block: Deprecate "backing": ""

2018-01-20 Thread Max Reitz
We have a clear replacement, so let's deprecate it. Signed-off-by: Max Reitz --- qapi/block-core.json | 4 ++-- block.c | 4 qemu-doc.texi| 7 +++ qemu-options.hx | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/qapi/block-core.json b/q

[Qemu-block] [PATCH v2 5/6] block: Handle null backing link

2018-01-20 Thread Max Reitz
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 --- block.c| 4 +++- blockdev.c | 14 -

[Qemu-block] [PATCH v2 2/6] qapi: Replace qobject_to_X(o) by qobject_to(o, X)

2018-01-20 Thread Max Reitz
This patch was generated using the following Coccinelle script: @@ expression Obj; @@ ( - qobject_to_qnum(Obj) + qobject_to(Obj, QNum) | - qobject_to_qstring(Obj) + qobject_to(Obj, QString) | - qobject_to_qdict(Obj) + qobject_to(Obj, QDict) | - qobject_to_qlist(Obj) + qobject_to(Obj, QList) | - qo