From nobody Thu Nov 14 18:10:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass(p=quarantine dis=none) header.from=virtuozzo.com ARC-Seal: i=2; a=rsa-sha256; t=1629794623; cv=pass; d=zohomail.com; s=zohoarc; b=jFyIruIdYF54jkYMLn3yIwu2mcXFfNCNTlu4qGlDOAmVrGnYP55mjo41HAbixIu2n2XDK84gKFjivyBZqeedGOcOusWwjaw+gWow3JnyBBjhijrMXCHFTYEqY8EYFit57adRVQ0BxiSUX97OUKfARwVzBHQgBhFjhA09X9KsnD4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629794623; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7GmJJP2me1hAQJQvNuKG3Yp1F2STkJylbpXCBY/QG70=; b=GejToXinrtrABSv1+gfHp/1BrTtyEaq2Gf9lRSPljZmRK12Jb2ALi3wXlDc9O5+yxRFUaEgVvgrxJkC8NzDYAur+/DhVo7FtVSm+OChG/eJCkwKkOoi05paXTFe8OPlLn7O/vSaS6UoghDOOzc+Dg748v6eJ1I6yvuvlPnHrkyQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; 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; arc=pass (i=1 dmarc=pass fromdomain=virtuozzo.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1629794623614734.4140099703809; Tue, 24 Aug 2021 01:43:43 -0700 (PDT) Received: from localhost ([::1]:33708 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIS22-00030L-I2 for importer@patchew.org; Tue, 24 Aug 2021 04:43:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIRy2-0002RM-Kl; Tue, 24 Aug 2021 04:39:36 -0400 Received: from mail-eopbgr130120.outbound.protection.outlook.com ([40.107.13.120]:56386 helo=EUR01-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIRy1-0007HX-3c; Tue, 24 Aug 2021 04:39:34 -0400 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) by AS8PR08MB6533.eurprd08.prod.outlook.com (2603:10a6:20b:33e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 08:39:19 +0000 Received: from AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::3c5e:7829:362d:1423]) by AM7PR08MB5494.eurprd08.prod.outlook.com ([fe80::3c5e:7829:362d:1423%2]) with mapi id 15.20.4436.025; Tue, 24 Aug 2021 08:39:19 +0000 Received: from localhost.localdomain (185.215.60.249) by HE1PR05CA0178.eurprd05.prod.outlook.com (2603:10a6:3:f8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 08:39:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hfs9rTJGppy5wXT7nvZ/9yqvNk3H11IKzOkziRZdu3jjcOFSgVQSKWhgrnbNEQaf02QXmw/j+XOUM5ktqlDeWKRgB84oiED4y7Zt4zcjGHT7bVdpbLs7k0PO9wundwc1fZ4gLQes8YEvnLOJ72TawjV5OgZIUPwGtvYWuxZDmbgSiFlBUNLC+ZbWgUlVjKKRm8NAtVC618PMfy6PNPJYzU+CsyQl5/oMbeoBtkKW10iqdQN95JjSS6+nhN2nXNqHv1Oszia85Sputp3ZkXpx8bKg0YHntc2qmBN3RlsPt1hmEyL8QfEbxXD0XKrDeszaFaZx/dCpLQQaGkpRupZaOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7GmJJP2me1hAQJQvNuKG3Yp1F2STkJylbpXCBY/QG70=; b=Ol/hjIdX/C/B+kHyP7t161DOso02QK6vsX4MfX2k9SdjKEab9l1sglwjgvUXg3bpbUeTCxHl77lVNo4Cup6je+Pk1GkGFDBlvvqstEfmhxAzPYqIS+P4CUmFkxRGhKuBoHlWLo9tEM0tHZgITd0F5bvgJDufwClQU1fnYmcwSdiaAhHsBjwZm3vwO4IY+uCysosHf3BfY4aY55V+4oKT2/yjN5+4Wc4bBbcsenHXWrgs6ArVAwqJfi4avfO6xheONP9g6bzak7Hb7npy2p2d3b3hNheZJiwPah/3v6DVYIK0BpxfdpnHpdyYy4+Qe1Tqnnrohbu0Wv4gkreSHy3AGg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=virtuozzo.com; dmarc=pass action=none header.from=virtuozzo.com; dkim=pass header.d=virtuozzo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7GmJJP2me1hAQJQvNuKG3Yp1F2STkJylbpXCBY/QG70=; b=bl5JjvfeyTcg9bKC7JdT6YXvM/PPU1GMGjirhiwopkKMLE6b2HpJzyeXImjqfA+cZ3LfAUJi7X/VHyhMnZaduJnJBApFv5qHGFstrxcj7SETUz2XzT/b+IokvZEcbVisNhCasRKvJTlwjA4savK0AykRljVg2zqT8e86STJVGY8= Authentication-Results: nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=none action=none header.from=virtuozzo.com; From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, crosa@redhat.com, ehabkost@redhat.com, berrange@redhat.com, pbonzini@redhat.com, vsementsov@virtuozzo.com, jsnow@redhat.com, hreitz@redhat.com, kwolf@redhat.com, Max Reitz Subject: [PATCH v8 02/34] block: introduce blk_replace_bs Date: Tue, 24 Aug 2021 11:38:24 +0300 Message-Id: <20210824083856.17408-3-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210824083856.17408-1-vsementsov@virtuozzo.com> References: <20210824083856.17408-1-vsementsov@virtuozzo.com> Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: HE1PR05CA0178.eurprd05.prod.outlook.com (2603:10a6:3:f8::26) To AM7PR08MB5494.eurprd08.prod.outlook.com (2603:10a6:20b:dc::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 36a1e139-5936-452c-50e8-08d966daaa4e X-MS-TrafficTypeDiagnostic: AS8PR08MB6533: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:352; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FB9qxIPpwtUT5+JbNdxQCaYHrqwu/Q1CKMUtCSFzy/kHXpxnSn9KqxpJ71sZHi6mpI1MQ2w7Zm8DAFKZCpZ7uXV/BHIUohOTCC2SB31XsMlXVKirlhRbCKiPo/p+hp6CMHh8+te45CCVL/4EeZ9PmxTblhUwBceUrg2ElFrsVRm1x2IuV4OOft5wYg0RrteMRrlWZdQ2G3p5tAiPPH0RwX//sSmaRtXGmHKHHBGxcoqJArDGqhWQ5SU/Q70xQF6+QCIeXrS9duabyzrmKEjEyqbxnT8c1F9f6BLKM9tvL+Mc4vRFHUcj4gjq9llTZ5EDV2Uk25o7gUMkh32ykgpow68vvpxo9RlD9FNZrqP5raLNLya08JrNxtMJRYJFaa11T8d7nErVSHgL6bOj98aNPvhgELVvsz0Hai2/nlv2L/UQCKWzCd+0hNFJIFI/Odr1ZzaR1mH82u8dCcZTPTaC8JZdX6Nehyp6bgjN3qgPZ7K4W3g+uTCCB2iBFn76fLZJw8M2RzwqcsvlGKMmh/yCZDfi/ABqa7vKwbMhMqTH9JS+mXsqEWQFQij3N2tLIMt+3tr8KP/P+B6cw6+S2nLCchJG4GPtkq1SjOhBfOMfS+FuDYYrD1/qvKtdnYEdcGc2GVum4QvOPb98LLlp3x1/qafSkne+fHW1sDfaAhSL41i19c+f/TkBdMtgBLnt/HfFKVdb3kgOOJz/oD267RqzWw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM7PR08MB5494.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(366004)(376002)(136003)(39830400003)(346002)(316002)(83380400001)(86362001)(36756003)(4326008)(6512007)(186003)(6486002)(478600001)(1076003)(6666004)(6506007)(26005)(38100700002)(38350700002)(7416002)(52116002)(6916009)(2616005)(8676002)(66476007)(2906002)(5660300002)(66556008)(956004)(8936002)(66946007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ETKPveF1EDh+aaTItru66TYl8bCznwxWjNcRd6lls9FSbzmutk5kFBDnRnAm?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idN+qpb/wewpbtO5FyB7cf96kP?= =?us-ascii?Q?gLMDcOTD6cKBGehbrrVfvx6FESSEdajIa3ozYvGCTBl0yLDuQVUMs25Sc8Aw?= =?us-ascii?Q?q/dmpbhSguxzZmZUnTeycMZmFl3DN278qxQajWnjgt75AqeBLLXwQ1Hf3s2K?= =?us-ascii?Q?iAboKdUeMsOpFeJUeXHBc9dv07q1UMABKITBxXA309S5HovH4CjUXB3EWj1J?= =?us-ascii?Q?WTJyGiHDA2qE/MIehedRnQSAQJpDZflpFFI1EPl3UXiuA0LM3f6sowiN5ZZV?= =?us-ascii?Q?fnPsokDPA5XNGWDbbR4Mk6UbxK1+EhlU8AdbN5+B0jnWHnMSt9jHYkqC3CTo?= =?us-ascii?Q?1HR/BdlMiBouDnV3fneeGV3nRq/8/ts+F3n+b0c7wp5v85um2NVIBzWe7t5p?= =?us-ascii?Q?v1tdAIGFcYcYwnMIwg4FMivQ?= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36a1e139-5936-452c-50e8-08d966daaa4e X-MS-Exchange-CrossTenant-AuthSource: AM7PR08MB5494.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 08:39:19.6983 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: LGQ5GiqL5NWqiyXA8XzTmnvb0WilCSduWttG1Jibyw2gQtjiJK1DUc00NywewwZZub/0aqAzXEa5RgNRXsRFQQKYiMSivZssOuSk5vJdPcQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6533 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; Received-SPF: pass client-ip=40.107.13.120; envelope-from=vsementsov@virtuozzo.com; helo=EUR01-HE1-obe.outbound.protection.outlook.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @virtuozzo.com) X-ZM-MESSAGEID: 1629794625739100001 Content-Type: text/plain; charset="utf-8" Add function to change bs inside blk. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Max Reitz --- include/sysemu/block-backend.h | 1 + block/block-backend.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 9ac5f7bbd3..29d4fdbf63 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -102,6 +102,7 @@ BlockBackend *blk_by_public(BlockBackendPublic *public); BlockDriverState *blk_bs(BlockBackend *blk); void blk_remove_bs(BlockBackend *blk); int blk_insert_bs(BlockBackend *blk, BlockDriverState *bs, Error **errp); +int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **er= rp); bool bdrv_has_blk(BlockDriverState *bs); bool bdrv_is_root_node(BlockDriverState *bs); int blk_set_perm(BlockBackend *blk, uint64_t perm, uint64_t shared_perm, diff --git a/block/block-backend.c b/block/block-backend.c index deb55c272e..6140d133e2 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -869,6 +869,14 @@ int blk_insert_bs(BlockBackend *blk, BlockDriverState = *bs, Error **errp) return 0; } =20 +/* + * Change BlockDriverState associated with @blk. + */ +int blk_replace_bs(BlockBackend *blk, BlockDriverState *new_bs, Error **er= rp) +{ + return bdrv_replace_child_bs(blk->root, new_bs, errp); +} + /* * Sets the permission bitmasks that the user of the BlockBackend needs. */ --=20 2.29.2