qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH v2 03/33] block: Add BdrvChildRole


From: Eric Blake
Subject: Re: [PATCH v2 03/33] block: Add BdrvChildRole
Date: Wed, 5 Feb 2020 09:24:46 -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:
This enum will supplement BdrvChildClass when it comes to what role (or
combination of roles) a child takes for its parent.

Because empty enums are not allowed, let us just start with it filled.

Signed-off-by: Max Reitz <address@hidden>
---
  include/block/block.h | 27 +++++++++++++++++++++++++++
  1 file changed, 27 insertions(+)

diff --git a/include/block/block.h b/include/block/block.h
index 38963ef203..0f7e8caa5b 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -279,6 +279,33 @@ enum {
      DEFAULT_PERM_UNCHANGED      = BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROUGH,
  };
+typedef enum BdrvChildRole {
+    /* Child stores data */
+    BDRV_CHILD_DATA         = (1 << 0),
+
+    /* Child stores metadata */
+    BDRV_CHILD_METADATA     = (1 << 1),
+
+    /* Filtered child */
+    BDRV_CHILD_FILTERED     = (1 << 2),

I'm not sure this comment does justice for what the flag represents, but am not sure of what longer comment to put in its place.

+
+    /* Child to COW from (backing child) */
+    BDRV_CHILD_COW          = (1 << 3),
+
+    /*
+     * The primary child.  For most drivers, this is the child whose
+     * filename applies best to the parent node.
+     * Each parent must give this flag to no more than one child at a
+     * time.
+     */
+    BDRV_CHILD_PRIMARY      = (1 << 4),
+
+    /* Useful combination of flags */
+    BDRV_CHILD_IMAGE        = BDRV_CHILD_DATA
+                              | BDRV_CHILD_METADATA
+                              | BDRV_CHILD_PRIMARY,
+} BdrvChildRole;
+
  char *bdrv_perm_names(uint64_t perm);
  uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission qapi_perm);

Whether or not you can improve the comment, the enum makes sense.

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]