From patchwork Tue Mar 29 20:40:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12795256 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21E59C433EF for ; Tue, 29 Mar 2022 21:20:11 +0000 (UTC) Received: from localhost ([::1]:58614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZJG6-0007ms-8h for qemu-devel@archiver.kernel.org; Tue, 29 Mar 2022 17:20:10 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42890) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZIhF-0006nI-Vf; Tue, 29 Mar 2022 16:44:10 -0400 Received: from smtp48.i.mail.ru ([94.100.177.108]:55496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZIhE-0006x1-DX; Tue, 29 Mar 2022 16:44:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mail.ru; s=mail4; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:From:Subject:Content-Type:Content-Transfer-Encoding:To:Cc; bh=xGtHB0bAuLTdMvdPxHi4k/451jX5Q5cmQvJtivNZP28=; t=1648586648;x=1649192048; b=Q8u3c3KSs4A6n2IMQVd3qp956Lp+Fp7gryPpAvoqci5ILnfrPPJl95/mUgDsVyIt6uXaQ9Ik6p85WcfTRNPuxk6MF6oLrDORpcDglhagBEI3RS2aQyk+/8/oXw/t84VavV/19TZ3+KWYEpspnexEEuGwSxTk/XfHPCpBb+cEjKAaIZpwzjAqd9JahnsYOWkX4qsaZmVV6sq84iE/t0bEuOdV7irh1d/pu7c14LrN9GSbSwhMcBfPR+mHDTmqzPDlT2Fx0QbXA9XDo5D8qzQ5C6Tm4iTqZjmPjTxegZM+aYCplGME3KOQ81pwjzqxOpgqid5zBRP++XKI7Z8eqKSEBw==; Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1nZIgs-000374-47; Tue, 29 Mar 2022 23:43:46 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, kwolf@redhat.com, hreitz@redhat.com, v.sementsov-og@mail.ru, Markus Armbruster Subject: [PATCH v4 35/45] block: make bdrv_find_child() function public Date: Tue, 29 Mar 2022 23:40:57 +0300 Message-Id: <20220329204107.411011-36-v.sementsov-og@mail.ru> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220329204107.411011-1-v.sementsov-og@mail.ru> References: <20220329204107.411011-1-v.sementsov-og@mail.ru> MIME-Version: 1.0 Authentication-Results: smtp48.i.mail.ru; auth=pass smtp.auth=v.sementsov-og@mail.ru smtp.mailfrom=v.sementsov-og@mail.ru X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD92B0439D57C14BB617BAFEA8A05E639C3B4E0E7AAF66DFFB700894C459B0CD1B967AE21F9FC9E44179497A2F62DED97B2C206EF2094F4D734BFC1E8E3B9A80342 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7C6068CE86C2B75F5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C867FEFF36BCDF178638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D815EBADF44BF440593AAB7567ED1700D96F9789CCF6C18C3F8528715B7D10C86878DA827A17800CE70F3DDF2BBF19B93A9FA2833FD35BB23D9E625A9149C048EE9ECD01F8117BC8BEA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209ECD01F8117BC8BEA471835C12D1D977C4224003CC836476EB9C4185024447017B076A6E789B0E975F5C1EE8F4F765FCE823D0BD2C3627263AA81AA40904B5D9CF19DD082D7633A078D18283394535A93AA81AA40904B5D98AA50765F7900637A9B5CFA561830F3FD81D268191BDAD3D698AB9A7B718F8C4D1B931868CE1C5781A620F70A64A45A98AA50765F79006372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89F72BE6798D6036352156CCFE7AF13BCA4B5C8C57E37DE458BEDA766A37F9254B7 X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CF593E0A4FA3DD8F5358D128605E25AC25F3E4409A56DDD5B9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFD07623A0E6354027699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D342B94C1DAF75C4D2252FA3974474F90C2FAD0508C49CEF3E35056C7CF5B7AEF4AA67D769CBA0BC6801D7E09C32AA3244C909D876F57CF5B0A436A10B963225B9DF94338140B71B8EE8D5DD81C2BAB7D1D X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojX92LdC94eGZwQXVJPYSrSg== X-Mailru-Sender: 6C3E74F07C41AE94618A7CFF02C4D1FE336C705384C873163BBB4E97AC50B7743C5642EA9D5B86B0E6462B2528CDCABCE234FDC7CE4030BEBA6D275AA6409EB3BDC3C9FB484E02823A35ECB215E68A28E3F6503ABEB32C155FEEDEB644C299C0ED14614B50AE0675 X-Mras: Ok Received-SPF: pass client-ip=94.100.177.108; envelope-from=v.sementsov-og@mail.ru; helo=smtp48.i.mail.ru X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_BL=0.001, RCVD_IN_MSPIKE_L3=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" To be reused soon. Signed-off-by: Vladimir Sementsov-Ogievskiy --- block.c | 13 +++++++++++++ blockdev.c | 14 -------------- include/block/block_int.h | 1 + 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/block.c b/block.c index d4d0adc6c8..605eabc589 100644 --- a/block.c +++ b/block.c @@ -7762,6 +7762,19 @@ int bdrv_make_empty(BdrvChild *c, Error **errp) return 0; } +BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name) +{ + BdrvChild *child; + + QLIST_FOREACH(child, &parent_bs->children, next) { + if (strcmp(child->name, child_name) == 0) { + return child; + } + } + + return NULL; +} + /* * Return the child that @bs acts as an overlay for, and from which data may be * copied in COW or COR operations. Usually this is the backing file. diff --git a/blockdev.c b/blockdev.c index d95e1e6922..b10e867676 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3630,20 +3630,6 @@ out: tran_finalize(tran, ret); } -static BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, - const char *child_name) -{ - BdrvChild *child; - - QLIST_FOREACH(child, &parent_bs->children, next) { - if (strcmp(child->name, child_name) == 0) { - return child; - } - } - - return NULL; -} - void qmp_x_blockdev_change(const char *parent, bool has_child, const char *child, bool has_node, const char *node, Error **errp) diff --git a/include/block/block_int.h b/include/block/block_int.h index f6deb89f23..da3da8ac02 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1462,6 +1462,7 @@ BdrvDirtyBitmap *block_dirty_bitmap_remove(const char *node, const char *name, BlockDriverState **bitmap_bs, Error **errp); +BdrvChild *bdrv_find_child(BlockDriverState *parent_bs, const char *child_name); BdrvChild *bdrv_cow_child(BlockDriverState *bs); BdrvChild *bdrv_filter_child(BlockDriverState *bs); BdrvChild *bdrv_filter_or_cow_child(BlockDriverState *bs);