qemu-rust
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 07/11] block: Add bdrv_open_blockdev_ref_file()


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH 07/11] block: Add bdrv_open_blockdev_ref_file()
Date: Wed, 12 Feb 2025 08:43:11 +0100
User-agent: Mozilla Thunderbird

On 11/2/25 22:43, Kevin Wolf wrote:
This is the equivalent of bdrv_open_file_child() to be used in cases
where the caller is QAPI based and has a BlockdevRef rather than a
filename and an options QDict.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
  include/block/block-global-state.h |  4 ++++
  block.c                            | 30 +++++++++++++++++++++++++++---
  2 files changed, 31 insertions(+), 3 deletions(-)


+BlockDriverState *bdrv_open_blockdev_ref_file(BlockdevRef *ref,
+                                              BlockDriverState *parent,
+                                              Error **errp)
+{
+    BdrvChildRole role;
+
+    /* commit_top and mirror_top don't use this function */
+    assert(!parent->drv->filtered_child_is_backing);
+    role = parent->drv->is_filter ?
+        (BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY) : BDRV_CHILD_IMAGE;

Nitpicking style:

       role = parent->drv->is_filter
              ? (BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY)
              : BDRV_CHILD_IMAGE;

+    return bdrv_open_blockdev_ref_common(ref, parent, &child_of_bds, role,
+                                         true, errp);
+}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]