qemu-devel
[Top][All Lists]
Advanced

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

[PATCH v3 03/33] block: Add BdrvChildRole and BdrvChildRoleBits


From: Max Reitz
Subject: [PATCH v3 03/33] block: Add BdrvChildRole and BdrvChildRoleBits
Date: Tue, 18 Feb 2020 13:42:12 +0100

This mask will supplement BdrvChildClass when it comes to what role (or
combination of roles) a child takes for its parent.  It consists of
BdrvChildRoleBits values (which is an enum).

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

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

diff --git a/include/block/block.h b/include/block/block.h
index fd89eb6c75..8c23948d08 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -268,6 +268,44 @@ enum {
     DEFAULT_PERM_UNCHANGED      = BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROUGH,
 };
 
+enum BdrvChildRoleBits {
+    /* Child stores data */
+    BDRV_CHILD_DATA         = (1 << 0),
+
+    /* Child stores metadata */
+    BDRV_CHILD_METADATA     = (1 << 1),
+
+    /*
+     * A child to which the parent forwards all reads and writes.  It
+     * must present exactly the same visible data as the parent.
+     * Any node may have at most one filtered child at a time.
+     */
+    BDRV_CHILD_FILTERED     = (1 << 2),
+
+    /*
+     * Child from which to read all data that isn’t allocated in the
+     * parent (i.e., the backing child); such data is copied to the
+     * parent through COW (and optionally COR).
+     */
+    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,
+};
+
+/* Mask of BdrvChildRoleBits values */
+typedef unsigned int BdrvChildRole;
+
 char *bdrv_perm_names(uint64_t perm);
 uint64_t bdrv_qapi_perm_to_blk_perm(BlockPermission qapi_perm);
 
-- 
2.24.1




reply via email to

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