From nobody Thu Nov 13 19:24:57 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1582029848775110.79795980459971; Tue, 18 Feb 2020 04:44:08 -0800 (PST) Received: from localhost ([::1]:33804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j42ER-0005dP-NH for importer@patchew.org; Tue, 18 Feb 2020 07:44:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38714) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j42DM-0003qC-BP for qemu-devel@nongnu.org; Tue, 18 Feb 2020 07:43:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j42DL-0000zH-6D for qemu-devel@nongnu.org; Tue, 18 Feb 2020 07:43:00 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:46856 helo=us-smtp-delivery-1.mimecast.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j42DL-0000yt-2f for qemu-devel@nongnu.org; Tue, 18 Feb 2020 07:42:59 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-LbrfguFlOG2CaDugLou4VA-1; Tue, 18 Feb 2020 07:42:56 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C043B100550E; Tue, 18 Feb 2020 12:42:55 +0000 (UTC) Received: from localhost (unknown [10.36.118.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D44560C80; Tue, 18 Feb 2020 12:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582029778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eGOeRG4Lx+pTp0i14plka3WDezKrZb39267MP8MsP8c=; b=W3oRPKJG0x+r3YDL5lqmGd7irl9lwILZ9jsm9uNwyKhQUS+FgkisrZlsawT97QHNWkubSa tLco7R1N4FrNtJJ8hppQgKeAswFM++F0FTdu3JBF/v4ffUI/CpmqXsY/gb72Sx6rzSXitD yxiW7Y16+r/RNuz75Uv47K3QIc8fzjw= From: Max Reitz To: qemu-block@nongnu.org Subject: [PATCH v3 03/33] block: Add BdrvChildRole and BdrvChildRoleBits Date: Tue, 18 Feb 2020 13:42:12 +0100 Message-Id: <20200218124242.584644-4-mreitz@redhat.com> In-Reply-To: <20200218124242.584644-1-mreitz@redhat.com> References: <20200218124242.584644-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: LbrfguFlOG2CaDugLou4VA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 205.139.110.61 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Eric Blake --- 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 =3D BLK_PERM_ALL & ~DEFAULT_PERM_PASSTHROU= GH, }; =20 +enum BdrvChildRoleBits { + /* Child stores data */ + BDRV_CHILD_DATA =3D (1 << 0), + + /* Child stores metadata */ + BDRV_CHILD_METADATA =3D (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 =3D (1 << 2), + + /* + * Child from which to read all data that isn=E2=80=99t allocated in t= he + * parent (i.e., the backing child); such data is copied to the + * parent through COW (and optionally COR). + */ + BDRV_CHILD_COW =3D (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 =3D (1 << 4), + + /* Useful combination of flags */ + BDRV_CHILD_IMAGE =3D 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); =20 --=20 2.24.1