On 2/4/20 11:08 AM, Max Reitz wrote:
We plan to unify the generic .inherit_options() functions.  The
resulting common function will need to decide whether to force-enable
format probing, force-disable it, or leave it as-is.  To make this
decision, it will need to know whether the parent node is a format node
or not (because we never want format probing if the parent is a format
node already (except for the backing chain)).

Signed-off-by: Max Reitz <mre...@redhat.com>
---
  block.c                   | 37 +++++++++++++++++++++++++++----------
  block/block-backend.c     |  2 +-
  block/vvfat.c             |  2 +-
  include/block/block_int.h |  2 +-
  4 files changed, 30 insertions(+), 13 deletions(-)


@@ -2992,8 +2994,22 @@ static BlockDriverState *bdrv_open_inherit(const char 
*filename,
      bs->explicit_options = qdict_clone_shallow(options);
if (child_class) {
+        bool parent_is_format;
+
+        if (parent->drv) {
+            parent_is_format = parent->drv->is_format;
+        } else {
+            /*
+             * parent->drv is not set yet because this node is opened for
+             * (potential) format probing.  That means that @parent is going
+             * to be a format node.
+             */
+            parent_is_format = true;
+        }

Nice comment.

Reviewed-by: Eric Blake <ebl...@redhat.com>

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org


Reply via email to