From patchwork Wed Dec 22 16:02:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Sementsov-Ogievskiy X-Patchwork-Id: 12691737 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 C713CC433EF for ; Wed, 22 Dec 2021 16:09:46 +0000 (UTC) Received: from localhost ([::1]:52256 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n04BV-0004ub-TR for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 11:09:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n045O-00055T-C5; Wed, 22 Dec 2021 11:03:28 -0500 Received: from mail-eopbgr70109.outbound.protection.outlook.com ([40.107.7.109]:2823 helo=EUR04-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 1n045M-00043n-8F; Wed, 22 Dec 2021 11:03:25 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CDI+lBfWqS1FIyJ2/1mwFmXFfcWvlO4UGUkV1aoDXlKfiKk9hA9D5FRaKPqnRyW2imsD+9EEWM6ZT53M9k5u75VE7oTiSveKJY5XuqEv7Hrmra9cbidWRf6+fTavPRwo7ai71AnHiKXfUrynuhg16PM7F7MpdIDJInRSfu1k2imie4XCOSz0huX82wTt2h9ihdJVeYecfaoy5L8NZb+zzGQQk648GtEXU31JOguwRCbc54xL7B37+f4LjreHkHleiuvxS6A0JvTXBGJDN7CxhB6oONUbgak8vDNriIGP+5UBQ5HgcCbgIarKLar/U+77JcrOEiXcenp2lUf2p5H7bg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AndI/kjMV/Rw7ma9GHxUT1a7OLf3o/5vszUKnrgH8aY=; b=amLNKxl6WSy6ZGOwHSzwuccW9qT5n0iNPkBW9+P/L1zBKsgABxS1g6xFUsRvoL3QDVLI0yQYaW4yNzuT3VkMqFTXcLi1JUkYkwQQlGZWEtGc/sYMgGAWVrwC+ArZKC749EQ2VVJrgVc8mYoPQkv5/s2R13duFv1yG5G0XCrQSrTpE1NVPsj6FVrYlbCBCdi97Dp31LhjYkgQR4/nkqnlmP5lIfoQe4vlXHoJvjmr5SRIbueSxzmIBZ3oJEAnkCB8YctypeV9Nh8zIy8GIZbBx39hDuWA6DPEf+xVKkO5aI7oc/9PynPBtF6SU2DnERyRWqC4vtwX0nxHhn6j0Ru3Hg== 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=AndI/kjMV/Rw7ma9GHxUT1a7OLf3o/5vszUKnrgH8aY=; b=VGvpxW4qdVW7cmR1XQYRZuUEyBmrBzwLik8Lc8pOEewNu+yPOUkXlV5YYi+qMv1kCUgHzgFz8SV+X9ICXd9+gnJSoM+QVQ4z/tnOM+Jjiy7UiBLvaY2r4HGGkMQnrTSOaGotzKgIolyXK7fc8h7qBuzk0m3w51ReTriLXTwISs0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=virtuozzo.com; Received: from AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) by AM9PR08MB6148.eurprd08.prod.outlook.com (2603:10a6:20b:284::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.18; Wed, 22 Dec 2021 16:03:12 +0000 Received: from AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112]) by AM9PR08MB6737.eurprd08.prod.outlook.com ([fe80::b118:483a:d003:3112%5]) with mapi id 15.20.4823.016; Wed, 22 Dec 2021 16:03:12 +0000 From: Vladimir Sementsov-Ogievskiy To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, eblake@redhat.com, armbru@redhat.com, hreitz@redhat.com, kwolf@redhat.com, vsementsov@virtuozzo.com, den@openvz.org, nshirokovskiy@virtuozzo.com, yur@virtuozzo.com, dim@virtuozzo.com, igor@virtuozzo.com, pkrempa@redhat.com, libvir-list@redhat.com, stefanha@redhat.com Subject: [PATCH v2 3/4] block: make bdrv_find_child() function public Date: Wed, 22 Dec 2021 17:02:53 +0100 Message-Id: <20211222160254.226909-4-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211222160254.226909-1-vsementsov@virtuozzo.com> References: <20211222160254.226909-1-vsementsov@virtuozzo.com> X-ClientProxiedBy: AM6P193CA0070.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::47) To AM9PR08MB6737.eurprd08.prod.outlook.com (2603:10a6:20b:304::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 81918132-e9a8-4d09-6b95-08d9c5648e32 X-MS-TrafficTypeDiagnostic: AM9PR08MB6148:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:635; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pyjfb6VZGYAFY0M41XmYmxw/Ty3Mfiz6c5wbFnADV73wzKlEPSulvw+KIlT28oBLC15rxEtfpPIYyliONO2PgsImF/m2znSK/GKKFuqPYdVODJYBCidAt27b7UjkKlQtL4S8FMqCu5sXZjeMfIxQ4hoZTSCnVxl2TViproIg2jDj/6+aClJgI4FTxWA+1Tuaw8bzEbUnCgexL37r8cjyp7KYxlb+9/DCw2g4ljx9qcM/lksX68u8B7CY8iuFNjLfS/V4Q2S7VCb8iniH1G6UQfwyhHEkCADMAK8ZpdEjpR9PvK1EhdoMvFYcoudoJHiZu8JzDGDFsLmLpvhU5d4LSZWkCSBl9CeNzXP9jLoBDYSl/dcG47VOwRv/duXCR0vxTWUizqoY5BLEeQjZse48LnS9W4wiCXeo/6TiJ5zqLn+D58OY0UG8Wg4Uj4/U/jcF7FXgESKd0uQGWWa6jr9uPhP4m0jk6hUJscysYIgRmQLEOhkE715x1YKyJTqL+CCDjRbRKkeakz3ttlTh2xlErRyLlkwpNJeeYZxKNVVXVSTtar/HvZ3nojLRtZmvRsFQmgDDRoNFHb5ERg0DDI4ZtvEVkgpNiKRdW2xket28of92KrQrxFqURDBkifi52zG4eXbn3yBvSowTENpSaIb9I4lO/F3MfplHkH4gh5fVCeR3dZR1zEzfGopdn3mJ2mcxDusZTxGwbMHziTbWar7W6w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR08MB6737.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38350700002)(38100700002)(6506007)(316002)(2906002)(6916009)(2616005)(1076003)(5660300002)(83380400001)(6666004)(86362001)(8936002)(6512007)(66476007)(36756003)(6486002)(186003)(26005)(4326008)(8676002)(66556008)(508600001)(66946007)(52116002);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yJSp+qrbce6STD5BRMXGPEDfK2wZ+hMTvsgoROCCgKTAkCDCinj8qqTk70WNaZPpf1Ro7eIGFS8cM63MHd49GtZs8N5hmxfiH5DSZiV6XMb52nc7SZk0zAoxhaDsRSis3D2eaXPsct7h6agV8pHxN+DPA7QECLq4r7AVXSZ7TY8/H/as8q1ZViEorE87I343g1PunkNBCS8zWQ/7ilHZqNBSOIk9WC6mEq3sSvguX9ONUCQWhXTGN6hX8xKCDbZOvujrEM/pLjM1HD2vTKLeQhCuWx3fmmgD2IHy5oHDDYLU1RBEWP8wE5ueS2O9iytTZvrSXwwF/2p8YjzowKDSMmZ5Wez678a10nYrcy0sZrzpTKYpxLTT26H99aWtxd3oj1g3u83ZVky8SRhULQeeqAOZH1mbJI1t3f4lYvbm2oTj7Q5wVVRNGdi8OXFDtj4v+Xtkz0964v7Vs274vcjucui/8+kR8ghalWXt0dNYR3PtVzX4LjQ6q4WPVDa98AwqdYTAGBmEHwoRkpPkUNFlKBHePxEbPQUzcF7bnm+adzlczJqx2P2ZHq8rOCBAyF2I/3pwTtKzSVTBZA6ml8yLdsaCe4KeLhV+JKh2HCz/pqfr/e0wfr2t+Php8tMu6H3qm1Z433Cjo3p01adMpsVWmuq4S8jTRFvIqbtA1R0mifGpxZ8cSzG/ZpIz7k= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81918132-e9a8-4d09-6b95-08d9c5648e32 X-MS-Exchange-CrossTenant-AuthSource: AM9PR08MB6737.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2021 16:03:12.4750 (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: dMeIfQ5LO6CVnN43+BMq46IgJqjI7BOUjTYZb91Ac4EQofWglZgJ9boZZEyU3BPrjUVlFdvyZERwTPIlBEDcnOYSxl3iZVcJBcHMKSHdmRs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6148 Received-SPF: pass client-ip=40.107.7.109; envelope-from=vsementsov@virtuozzo.com; helo=EUR04-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, 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.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 --- include/block/block_int.h | 1 + block.c | 13 +++++++++++++ blockdev.c | 14 -------------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index f4c75e8ba9..79bdde8bf4 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1433,6 +1433,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); diff --git a/block.c b/block.c index 0ac5b163d2..840d52e7c8 100644 --- a/block.c +++ b/block.c @@ -7727,6 +7727,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 0eb2823b1b..ce23059d5e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -3644,20 +3644,6 @@ out: aio_context_release(aio_context); } -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)