qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 26/33] block: Use child_of_bds in remaining places


From: Eric Blake
Subject: Re: [PATCH v2 26/33] block: Use child_of_bds in remaining places
Date: Wed, 5 Feb 2020 17:28:54 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1

On 2/4/20 11:08 AM, Max Reitz wrote:
Replace child_file by child_of_bds in all remaining places (excluding
tests).

Signed-off-by: Max Reitz <address@hidden>
---

+++ b/block/raw-format.c
@@ -444,6 +444,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, 
int flags,
      BDRVRawState *s = bs->opaque;
      bool has_size;
      uint64_t offset, size;
+    BdrvChildRole file_role;
      int ret;
ret = raw_read_options(options, &offset, &has_size, &size, errp);
@@ -451,8 +452,18 @@ static int raw_open(BlockDriverState *bs, QDict *options, 
int flags,
          return ret;
      }
- bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, 0,
-                               false, errp);
+    /*
+     * Without offset and a size limit, this driver behaves very much
+     * like a filter.  With any such limit, it does not.
+     */
+    if (offset || has_size) {
+        file_role = BDRV_CHILD_DATA | BDRV_CHILD_PRIMARY;
+    } else {
+        file_role = BDRV_CHILD_FILTERED | BDRV_CHILD_PRIMARY;
+    }

Cool - the new roles gives us the flexibility to be more dynamic!

Reviewed-by: Eric Blake <address@hidden>

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




reply via email to

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