From patchwork Wed Dec 22 16:02:51 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: 12691733 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 79B2FC433F5 for ; Wed, 22 Dec 2021 16:07:06 +0000 (UTC) Received: from localhost ([::1]:44766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n048v-0008Ij-4f for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 11:07:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n045J-00050V-NU; Wed, 22 Dec 2021 11:03:22 -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 1n045G-00043n-SX; Wed, 22 Dec 2021 11:03:21 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HyxpKISccq+ebovNA2tsmISqBBb0uhXs9cut2s2BLgiO73Zpl9jLYIt7+fOguhrIEiOjnjZes3OfG3haUYkQtAfNNioYP8hM4I91C5dVycTe8iOB+YinOfsK99TTimUbSEQXM9sX/Q+iu9TZUkMKh4SCFpOaFazFpqeby0cnhxRnKL+kKM+9h5m+XvGycxzLdMk8YCk3WOkYA6M9ywxjPB/RH6PGb7mrI7EF3fkpPHJxCoF5Oe0gFcj6ivR3YdD0KE/L2vaezno+IhjLO0J4O7FSP5hgDfaSHTqk++foUadpQcuPjo0kQB3eDgURBRdm7tt68vegLAAiFwd99YENPw== 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=EEUHKsR434FlW2xvNwek+bipA3zdn8m3wAv7arxBqzw=; b=gdfIB6LAmX3PDGjQ+SZ0jIvmlM3Bzhj4+FEgOzs150tmDUllHcMTVAdRMQslnIXooGP6IBWd/Kq1XPmh4PdYXUBk/lGS30EqcgI1N62SVUt+W25JXwg6UW7oNzVy8MDJ05HbwczSm7azyY0v7NJrTVlFaPYLfTlS3iTmIUsGZc1GaRAtQjsxzpLUVBxn8Co66OrU8NegejONM309DJ8iAfAK/DA9h5Tc3O9y840OzWAHnXiXZb0TqWvMWGthgNV49DwXVzgbYtJb/AkbgwoIjTIWod3itR8vHPCrYDX1z6f9/6UroM7zoQm6VvapHMahS6FFju2anBEWHJVfb2LU1A== 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=EEUHKsR434FlW2xvNwek+bipA3zdn8m3wAv7arxBqzw=; b=NT2kQ+b50xv81nwSEfqoVDQowHriTSfMaKHZfAk7kkL3/HMS7xWfW86Lm71mki0Z8ycdKT36P0hauMn2vwgy0MIrRpsgjePrzHHrRJX7uRTm63U1w5YS6URqrPl1INHkGMh/JLK1VrnDi+lR8/aRd53+a/g0QjCI/gK6CEOyblU= 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:10 +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:10 +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 1/4] block-backend: blk_root(): drop const specifier on return type Date: Wed, 22 Dec 2021 17:02:51 +0100 Message-Id: <20211222160254.226909-2-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: dff2d1fd-3ccb-47ba-9507-08d9c5648d11 X-MS-TrafficTypeDiagnostic: AM9PR08MB6148:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:913; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MOXFtntPyRYa5kO3nmHwHAeS07nedtVeTdryhdTEH4VvB1EqIRoY+RJyM45jFdwS/+3LHq9oAXdnUCilEasuwrdOglPfLrkSrYHYLbZAhHHeMYVA0Yhvt3o/pKMb3sNHsy7bPuRDyTq6aPU5vuwfmsaA3OMGs/WRDQyKr7J9lcCo7dPhmB4Bu1Pt9zE9s/AGxnPyn+9BLr+IQJsdKkVUvSPvXECZlxK/Pdav0SZVpZ+3PyFpjukfXfmWavPq/l+q+m/mXL6A3wdEFAkLtqEOgWAfopfPkCvMv7lpZp+7iuxVckgjCWclsuxcAjYdGAlqFmoA0wUpKxuXUNgJqPjQ856f1s6tKE7a5GhX7wn5H9wY9eFKYqr3PvCvtFSocitrkQJeyXO8ie1eWN7kL5TRHTY4/wWm6ma75x9HSj86IsbrFlok6yuhB/Ky7zunEg+0p62NA9YxHW0Um62u2e1aQwM+tsky//s+rgYnyRetlA0jc96piagLEIPm1yxlrALCEqbcgULjZrUCwjV1pt57FkLcze54KfFvaJttfj2Ld8AJgNC0ll4YuC/TPpE2xHLqFgjcSPwJnDNM3xi/v2NzhJhWpSoAi2uSCpPsjiGYjCBtuyvP5U1SsFJ5cEVQXKSBB0jtKJChVKvqhfz/JEPYVsHdN9AwbA0YgnI+9w6Kx2B48dJg27jD9mEY6dAEXwVN9ebU6mjQ1RjoTgK9ZYspvA== 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); DIR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Obj9PbIRSA5BizPseLORoUPOlYL7piTcead7CQQhcLLnoV+phEubYPcOJjwyiMa7bLb73QpW47OIC04W1ZE09FjtfRj+9Xr4DzaEL7rc0ppv3FsN1ClgkjFmbMW/v/VFfqQbNNJNoLlrfxRNn9gLPkOpzAXtniPabhbxnmz5uSZXA6PUT69zjFikjG1N3lR6utd++oS7Cl1YW0HjgZ6CkeKiusP9mN1Bf+i5X4K+9eV2ZGyKf0+T+CDNjgduGeIUWCPQ5klXJXISd4TxdwzGqPSFb+u1Hg3ZJmFPXtEAOIfvcWtMQUgV0ILxfg5yzXocU4/nbOz95cJ9NU3sesWDCq+s5b9ANSz+17OGrABFjeMU8x5nnmmMQweeDj/qJz7cgOl/RaQwe381UqkL1wvRYIYQEnb+pfTW6LeAr4vAodhPsIcuDiA+ofz0hXwK/RALL7S6watt2RaUxmFjprwpNa7m0YH6rJbLywLxVCPD/Na0UJaO09npqSr4xf0Mk4M40r7IKDyMxd33a8/UgmRhqdLXxqaxG6VNVh9vi6cboim3nnHZbe1xPvHJwXX51zQ/Prfu99muqcfEZNjX6eniK/ZJxCUVd5OAgLns2kV3gRPsw+t7+R+XAd1/mTn4tLTXvQ2uo7kZ0j7q1+kpem0PLf8vstIn+O3Pwmfi83g7Q+agSvlF3Qi+tuOe3Xd0u1oq9X8G7D7RoPKR4= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: dff2d1fd-3ccb-47ba-9507-08d9c5648d11 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:10.6602 (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: 3vmVT6rZo5CVWOOmSBfI53CcG4KiM5CHRoVNIErFgdarGXolQF9QPMZo6mbUZoZFMdeZReetmP/hOgF5NK42aN+2otl0mKkr/6wkOuxUs40= 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" We'll need get non-const child pointer for graph modifications in further commits. Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 2 +- block/block-backend.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index e5e1524f06..904d70f49c 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -277,7 +277,7 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, int64_t bytes, BdrvRequestFlags read_flags, BdrvRequestFlags write_flags); -const BdrvChild *blk_root(BlockBackend *blk); +BdrvChild *blk_root(BlockBackend *blk); int blk_make_empty(BlockBackend *blk, Error **errp); diff --git a/block/block-backend.c b/block/block-backend.c index 12ef80ea17..d994a0f096 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -2438,7 +2438,7 @@ int coroutine_fn blk_co_copy_range(BlockBackend *blk_in, int64_t off_in, bytes, read_flags, write_flags); } -const BdrvChild *blk_root(BlockBackend *blk) +BdrvChild *blk_root(BlockBackend *blk) { return blk->root; } From patchwork Wed Dec 22 16:02:52 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: 12691736 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 BD071C433F5 for ; Wed, 22 Dec 2021 16:09:12 +0000 (UTC) Received: from localhost ([::1]:51498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n04Ax-0004NH-NZ for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 11:09:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52408) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n045L-00052U-IO; Wed, 22 Dec 2021 11:03:23 -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 1n045K-00043n-2O; Wed, 22 Dec 2021 11:03:23 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Hb0OT1JPfDY0dkVsk2L0NsmRvKErfNyrpNQNieQSVQVKbz/vM/CpgWuvSTQvsMSEMFZD4jlSP2bflG8N/PnXp71fsZ+d9xFwbUK6DkMS2OfHylf9ANHMfJGPzi27TtHXMfIiOMVhPsLiF/EXELAcf433n6Ek2WnEQgXxuSccf8Dz033vOThsXoY0ps6OWwnORZ+ZKCu/38XE0QEDrRE1Yv5rf3CXk9BeORQ3FLUNJw3SNUJ7XWQr/pDgyosPbKiHGejyPwyNp0zHz7MjeZV69WhH4OjN++lGNNy9mqhJPq4BX/vfi4u4VihChXfP0MVHEAzy8aPAyXr7NsAFaJAV4g== 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=cLB5Dv/1GYn5I+CAd03lR75J1viOHLrpmujXJiyH7dc=; b=c83OXU9NFNAlrMUZhB32F2PlsWtDfw4xY3Gmfc1dUD+bgC6P5i/8d9ZYu8CBkYFKRYNTVj7XQbzM+5OgErxbvfQp/jLYh6xOVxblLxmS8iPZ9pbOpz7AgzNsXs6PcOqyoEyD4ueZ6ksoT4n8h3ZnWXAlRHocCA3S2AxpXeYLhXbYqIlk6wOK4g9sWYC+G51vZayeRE+mGsTr+SLehBQIkS8Bb3E4iQ8Hw6qgtkyXyxkMkfpK6RXFM+N9y5W887DwH8DDrz4Iktw0cILWCPs7MNuOMeVqb3mFDts6xqE3WGLGmfQUziztbVjhuNJ8n/52hwqqEijK+85eDt76aZS71w== 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=cLB5Dv/1GYn5I+CAd03lR75J1viOHLrpmujXJiyH7dc=; b=rd008eKW2LIxE2NXvTMmdrEFcnVcdwomGZ1eONXqgU+z3Nnq2xt/E/Lisz6gMb9TwQ6DLpUO3juhycQunmKD0Ns2Aw2U5q/XxiQ7LYuuvLetyHDuOdrR20TjOvlUHKNYlx/so+BCgXJMweBWjt2r3HfQ3TVaoakSxGCMVkTLwOs= 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:11 +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:11 +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 2/4] block/export: add blk_by_export_id() Date: Wed, 22 Dec 2021 17:02:52 +0100 Message-Id: <20211222160254.226909-3-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: 142afff9-f946-44c3-23ec-08d9c5648d71 X-MS-TrafficTypeDiagnostic: AM9PR08MB6148:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:81; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: e/4Pu/L7b1RAJ+JGRAYmcrHJf9EYjRP3uV4wPLHFnpL4DzjpwJTnFrm2CbfguN91a85VT2072sultOtnSOy8LWzjNh4ZYl47+sH07etnJow1RIFTQuPhS5sWlm5ctQClhcsf1FAXRk2mZKsSwD4UPTD6uXQlT/QOlQRTs7G5QlGvZkZlSpCVNdHNe59ymEpvEzjIyNa6cnK46evzxZjUXfS79HAKcV1kbpyAR0bKJoM8u47/YRgi7yXNMIL67KpSM3Ko3iL2PM4mNdBd/N4V/rpiEL/BUJORtRlk+yaJKxk4ywdweNYYtgmi0kGLX16hQ18f8sjbuv4Splwr4bH9lYqGTY8Z8IKpd7/+/aRo1o7Qpp+vYrMihBI1IwnYZmVGApauCiNoOwdNf7wmSqauBC16K15nEC7UFst8OLFwBXocNnPi+e+AobmyOn3R1KZ4feSz7osDwhk48le8mPCJsVZqRxIXUc3yeYKNBXhA1PuNZFdh7cODrnGz4hrXtJI53wmhQSKTxbmX3m294U45FBTXKhc/ZAed4Q/9KnMcv3ojzo5hoFgS9HcM2+0Pr0gW/F1HDlhiCyUn4uvaILda8pcfN5u1z2MV34ZMaS7Vw6i5YXItgBGb6gCSC9pVhVTWDABRa09lHTKeCvAP6+k34EUhmxO/xb9a1FtMMYlrYhdOIBUcCz3ysbvk31aIC2G3d+mLCRGMQgXNcolXyqm0UQ== 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); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VVogmBEFn1y4zX1ILojKTmk4iQ17DeDXQ4J0dhbkia9Zr3NP7O5ptYFbEzQXPVPcX4YIiuvWrkuHT3mZfr03jYm82+0YzyMvj8AQRvU9qdzj7qVA+crOK85Z97LbEwQfOqd/5yKkEKAUaDCDfzxcPiszRnlEY6K16QpjRKjWJwIBvqEEYIEtuLYQ7KGPMUt34coMTK1/qAV2a0RAz7+25DXkF1SRaGh3INgzxVNlcJhVl3RsH9s5Bq/8f2fyFPcaC7xmyJjWkhw9oE3q6PvetKx1pEuZXYLgFb2IqFMpOuaXLoVNEzVFwPgTVgtecSdIAxFuv28svJTjwkQcSNJb9H7zjuGGSaqtyd+esFoqFSeszb4JCWTtrtpOUKi/JcBKq/6UzAxXmmQfcj+u937DoOFu05h8svLc9rFz+5tzUUDMd8XtyXNkOzWbQS1c8PVx1ZgKGfs/YXUhz7ZBQ9dOEe5M2PuufsLGuE7pDvhpJmXZdHxfkGI5xi4Fgkr9HZyQB/voTgHA83lclV8Su6hX3BFw6jjybOURi2wUJQqqb/i3Qqr5tm3n4s/5pHjfg1GyGwvmwDEb+x0ClDwM2DRqcE19dEXyiPxF6jKjDkwJ+HycHh0/PC8Fd9YXNpzY0qH6SWFBIRaxCPMeyS+pwjexZrIRlGCCFcBpLE+3GRtV5Tc0ogxTl6FPx+3AQzA0UYKwTIa54kY+PRrB/pK/RmRNi3UNweWIPvrbzC65nAkkbaFBfv92YXXc6KDV0QcjQQWvXbTNhd40IPeoOQ1ONKZvzXRDEc78UjXoME+sujf/xcS4a3LxPt11TKkV4eUNjlp9fAMlxV4IulrKUbdWye+c9UDE64as2hGQx0JLu8+1zcLiPEnbwlfrvVKFitD+rPNUlKdTy89z9wsZJNKLUiKQFlvSxi6sbGnCaxa4GXgyHNehm0oU4SbnivqErU/SO0D4k1zpQe2JCu9WXNjEek8DUEHR8jsJkG+WKBaw/lG+nSDK3kuX347FN81nOkmZlHseAd/+lKmo7AlAutRUIHjoaFWnEBrEtf8fIb5n8wGwk07MEwlJvAWDJvw0bT7Hl0qzKicZtTJkEzNKwlNVNnzeFpktcxA+0P2w7CImFHvzjBho98sJeo7luOdy4vGNBeWVsuTP/+3z/DI835Uh09Mqr61m/MM5xI4EQXvUBsrUEfOgh0Uy7FcovsqoJ2sibR1QMWS8Iac6EykhwzGlPH3beFugLYK5KDafjug23kAOJywtekEEuDOqlVwsGh3UmUxfSDkouTXGnhWRzdA0xM/whN3v95R/faHq1dp540tr7EnA17EXvv9z7bS/6S4KX31E/TqBrISDqmZKJCLkFm51V9D2YHpZ5PgzF1OYlrUjyqSCB6xV0ZuEJkZWiLYcYWXpvgkNvrJK1RLAX9gfRKcYeXDgZajzImBaBuLU2/sJEH6bJ6LlIUp8UnlN8ClCBIeLjlmorIHsUspflzUCzKQGpiyGISCj0tEipVkiKusJZfbwdTGlVOqyLb8F++BDtqG4EcoRLLWNzOhkBSFohS5hOnI6k7NomLpJHH0n0KlZTyMdfIK+5c2fLTM6WSwqTcO6ENMLDnTDQ/EbngSVF20osMglibDkhTSpSbPjlHzFKaJpgoWYwgxaVwikZGM4XWSFn4exVVGL4CIB8Ylx6pCV2w== X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 142afff9-f946-44c3-23ec-08d9c5648d71 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:11.4413 (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: QThOqUYNlLpmpxMSLDVkAooQcsHfHXpOup0UQxyRnr8Vx6fAOiXtNZxu/nQPXiZRwB42qLoiXC/F+4KYVFQ/o+F8/tr3IlYfiKDukDbWkQ8= 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" Signed-off-by: Vladimir Sementsov-Ogievskiy --- include/sysemu/block-backend.h | 1 + block/export/export.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/sysemu/block-backend.h b/include/sysemu/block-backend.h index 904d70f49c..250c7465a5 100644 --- a/include/sysemu/block-backend.h +++ b/include/sysemu/block-backend.h @@ -124,6 +124,7 @@ DeviceState *blk_get_attached_dev(BlockBackend *blk); char *blk_get_attached_dev_id(BlockBackend *blk); BlockBackend *blk_by_dev(void *dev); BlockBackend *blk_by_qdev_id(const char *id, Error **errp); +BlockBackend *blk_by_export_id(const char *id, Error **errp); void blk_set_dev_ops(BlockBackend *blk, const BlockDevOps *ops, void *opaque); int coroutine_fn blk_co_preadv(BlockBackend *blk, int64_t offset, int64_t bytes, QEMUIOVector *qiov, diff --git a/block/export/export.c b/block/export/export.c index 6d3b9964c8..613b5bc1d5 100644 --- a/block/export/export.c +++ b/block/export/export.c @@ -362,3 +362,21 @@ BlockExportInfoList *qmp_query_block_exports(Error **errp) return head; } + +BlockBackend *blk_by_export_id(const char *id, Error **errp) +{ + BlockExport *exp; + + exp = blk_exp_find(id); + if (exp == NULL) { + error_setg(errp, "Export '%s' not found", id); + return NULL; + } + + if (!exp->blk) { + error_setg(errp, "Export '%s' is empty", id); + return NULL; + } + + return exp->blk; +} 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); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sAS4A97sfKMw6qnECFv1+kwP6UtmDy4VyS7/zFkLlUTOYX/8XhkZrhCDmvA3on5vSSjI9bTQtYWn+mkOMM7zcVwl8DMp30JFZz5q8HxZnLHCNZvSJXeE5Ew8PTVEs7UPkccSvcQY9NgcbNIPUJBg4bU7PGffbhA1uLiDVx79c/UCH3ATBqBOaUK7ii4/BrCEDPtykkJqqqYtCC/+0R7JpC33mht2FYFvO/r3EVVP01my23+Sg4VbjUzycbJGJF61j3cQL4VJfZGoCfhJunbnIa1aIDNAlTrxFmZH31rwPPryFwN1vfO3GEMjr1ZbxpuaA9ojP43I4lNL1VNaDbMhP+bIYikIseroDI2HqMCS2YZKAEY6ladtzURpnhPGWlPqkQFaAekGLkTxdRc70nnuGu+5a+tnI7lWkBsrK3lP2iCmfgKZ9i80qsJIZO8kancjalYh2ywW33QUFI2s7sMlxnOy1XN9BfXaorlRCQevmE7WtOTPXOEED5K6IuM9WWlMECuG2dBLycEhrdY1PqreQ1i15I3ddz11o22Z4GEm1Nn56OOirH2/2xceJD6voN8w11H/Cfu5mvO5aqWveac5FNrE0jnHn9MTuWQhFWZqfvNDk8h95cRcFGGrZNbRoBmWcWGFPsjcDhlJ/LI8/k2wyBrBKtao5X3z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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) From patchwork Wed Dec 22 16:02:54 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: 12691735 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 459A7C433EF for ; Wed, 22 Dec 2021 16:08:02 +0000 (UTC) Received: from localhost ([::1]:46772 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n049p-0001D7-0e for qemu-devel@archiver.kernel.org; Wed, 22 Dec 2021 11:08:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n045Q-00055g-HC; 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 1n045O-00043n-W2; Wed, 22 Dec 2021 11:03:28 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jYDKKGwUQy4GJHfFm1kojgBcG1cgfp/tQQ5iZb7IdKmDej4+aBPam1/6E6FOaMgzHgcXz+th37wEhrH/1CsWUfp64On2KuuVGGBMQ+WG/5o1htHsO1FQyyJiQAkeAde2hvEQalzzuMtV4Y3ShHiI/KNAQPQYu2P5XWlDD67HbJG8ufzSW9vjWJUsNq7KBaVQDupaGCY66MWbWmGFMpiMBCpmFcS0px2ClCQwiq8uHd3qEHoJtGJjYv2TRAYUr8FnzYItjsnW56AyHeq6FvVtT8VHkb/l5bZBJ+YCgZkaSK/0WcBOhIUhwqsn9s+U3GSncVW+8upvtMju+7dPwZl2Nw== 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=i/tzf8w/tyinpFYKIYCHh45b2/3cCpNwt+6WfE9kBAU=; b=hdJtzV12YnUMYXqSDJwmporX7ObEPaHYhNWSfc5JaEe/eBaHaYoQmHajpNOPtqSHL+BxkUGppANPBffSFz9YWd3blXDToDhCmOXTNbskE3ojC4zLOkmvAb5KdVat0RjHybesUUK5xLGPEpmZSlXMvYFw5eh8JwuywQR/51ssXzZ5dFa6lDoksdgDArub092RuuuwRHu/m1gigBxVwp0mVqu9TFf1+E/MJH5+rX3Yonybh57w+QtcylPS2jYsKSX0gTo7ljwpIgLYR08G7CZoceBVlKLYHQlhizfqcZAnkfHwhu2RJDwsZFMM0RK1hJPu3pjxOsnOVP5/3FqZrLkC0g== 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=i/tzf8w/tyinpFYKIYCHh45b2/3cCpNwt+6WfE9kBAU=; b=T7p6ThYYWXIMJ06/1mlNGDVHCfy70g6sKkJ6520sC+uqOrrFNHxH8bpOFBFpdwupAcAXhLEX4Qxrg/xavBTv9iTNA/mJuZKo/P6AZ/oOrL11Z+7xL9qRO/Z99H19sCduWog6x2o6tXE0rz4C8PJFEME9AvEWRGi04vWb7d7CDoY= 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:13 +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:13 +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 4/4] qapi: add blockdev-replace command Date: Wed, 22 Dec 2021 17:02:54 +0100 Message-Id: <20211222160254.226909-5-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: 53a2c510-b39f-497d-d3ae-08d9c5648e8a X-MS-TrafficTypeDiagnostic: AM9PR08MB6148:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:61; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JukFvGf7fmJzpyKpNdgS3YjzQ+/8SvIAMyjB/0y2bU+yHKrrpCqoUDU5LNiy9kXIWL6W+ZV+nwJAwytkpXupWbuIxpfam8fnGCo6pIUPdC8EZGoZ40vLrZOJO+gkYY2b9WguflktMA5tCV/Br8y2Hh+xF2TptE9QHRoJ7e65XE8eJVdhzP7QBVWuSXWOvGPBJJR8Bd+OqIf9sglE0uKPNg9tU41YrE699xZ2PKytL4L/CLsXmMZUGf/ozw11P3U0wfP5ADL+buSiy5412xaRzcLn04sVfP13+ntaWj3cYClEyMj+t3FOXXz7reCOqbV/u+FybL3eY1YFPCjZQUadFTYZCFM+Kdmdqk0QKZYKaFsRmaAYPQ7xD5iv3PHABRonAcXDiFj5rNrIoj90bmYGChecaABlWw+cWUsOnUSc5SKPwCmFETnnREZO0DbEfbI5pUjl6fqGCmnwgAiWPn/kWqjZpsRNM9+SRKxCoR5G17fBVETfV6ykAqo4TGojbxbZ+CDp4ZKxPPQ6x3rI52Blj9ZHfSoQ8ETgKsrxqK5bn/k+uoZ+Ik+KulvuN+vuvz4RTYoSbNNKtgN1d9cwYpjJMams/lO/4mPUa/9zha7aaXHjWBSfNTOzeBdrtej7jRhestYu/SukJYwFjLccgnovByMbdHLFpthjNiPR5T8S+IdRPYOgy46MD5LrSDU7lWclRoTdlbm4O6f4xc39jEyUHg== 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); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 61ee0YgjahY05rsF0ZhIva5WVlkFqB6+kcQumQEcMsdpvb6nPPmnX4hCLkkYu8Japs91g3O1T3Lu62wx5097UfS3A2+Qe3ba23U/eVidAiZOkrj8GMB82oq/rx9Rs9uBjoXyBRyVGSRIiHUd7EXnmJC9CDHuXrqhuWFE+aIs6BqZ7R1vm0eutdlecjEpBencC5wkTzV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8NTcsu5mY//Ey5YQTLzykWivxX9ObkwvzH8W3Jbwy4RUvuQ8ZAVwAXcrFuO9cMe5HtuYeZL6Gm0vYoXTnzTd1CnOmcbXaVb3bZRnJOR+Q5lodBBZoyTTOO9suypeGckWdg3jg6ocMYpz2xwM+VWf9BOorlLbvk0/UdqCfzXIxr2KVTjIkY5iuZ46N/lZYdR3GC7Jfp8dpD5LR/ukUKfl3OP2wfBYBy7mGW8A0rNv4Go3/CnBNPQvkHiXd3hH3QuX96Vn5MC+9gsqpvg3ZbW4b+VdMeJrgO1ILv1IoDitsdqh3wQxY94qIf17rT3Zo1Pxjz0KritniYQkfw4RjZGIDGA3VpK0l0qHjy+atpv6q9pUcZn8tlBmSmSmRsibj77hL3GJeospsZcBb3IZ25UF1MmnsNpsbN53xvU= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 53a2c510-b39f-497d-d3ae-08d9c5648e8a 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.9749 (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: JzjYA4vDOScfV84XKc/HI+eckm2C7kfL4IevKCOnZzFExhFhxrtgpz7Rcr6BozqE5Oc9dfRcVqUJS1AId0sybASjjXofc4eO7RH8PZDyuZY= 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" Add a command that can replace bs in following BdrvChild structures: - qdev blk root child - block-export blk root child - any child BlockDriverState selected by child-name Signed-off-by: Vladimir Sementsov-Ogievskiy --- qapi/block.json | 61 +++++++++++++++++++++++++++++++++++++++++++++ block/qapi-sysemu.c | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) diff --git a/qapi/block.json b/qapi/block.json index 82fcf2c914..a4dd1e34d4 100644 --- a/qapi/block.json +++ b/qapi/block.json @@ -570,3 +570,64 @@ '*boundaries-read': ['uint64'], '*boundaries-write': ['uint64'], '*boundaries-flush': ['uint64'] } } +## +# @BlockParentType: +# +# Since 7.0 +## +{ 'enum': 'BlockParentType', + 'data': ['qdev', 'driver', 'export'] } + +## +# @BdrvChildRefQdev: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefQdev', + 'data': { 'qdev-id': 'str' } } + +## +# @BdrvChildRefExport: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefExport', + 'data': { 'export-id': 'str' } } + +## +# @BdrvChildRefDriver: +# +# Since 7.0 +## +{ 'struct': 'BdrvChildRefDriver', + 'data': { 'node-name': 'str', 'child': 'str' } } + +## +# @BlockdevReplace: +# +# Since 7.0 +## +{ 'union': 'BlockdevReplace', + 'base': { + 'parent-type': 'BlockParentType', + 'new-child': 'str' + }, + 'discriminator': 'parent-type', + 'data': { + 'qdev': 'BdrvChildRefQdev', + 'export': 'BdrvChildRefExport', + 'driver': 'BdrvChildRefDriver' + } } + +## +# @x-blockdev-replace: +# +# Replace a block-node associated with device (selected by +# @qdev-id) or with block-export (selected by @export-id) or +# any child of block-node (selected by @node-name and @child) +# with @new-child block-node. +# +# Since 7.0 +## +{ 'command': 'x-blockdev-replace', 'boxed': true, + 'data': 'BlockdevReplace' } diff --git a/block/qapi-sysemu.c b/block/qapi-sysemu.c index 8498402ad4..ca1aaef376 100644 --- a/block/qapi-sysemu.c +++ b/block/qapi-sysemu.c @@ -588,3 +588,59 @@ void qmp_block_latency_histogram_set( } } } + +void qmp_x_blockdev_replace(BlockdevReplace *repl, Error **errp) +{ + BdrvChild *child = NULL; + BlockDriverState *new_child_bs; + + if (repl->parent_type == BLOCK_PARENT_TYPE_DRIVER) { + BlockDriverState *parent_bs; + + parent_bs = bdrv_find_node(repl->u.driver.node_name); + if (!parent_bs) { + error_setg(errp, "Block driver node with node-name '%s' not " + "found", repl->u.driver.node_name); + return; + } + + child = bdrv_find_child(parent_bs, repl->u.driver.child); + if (!child) { + error_setg(errp, "Block driver node '%s' doesn't have child " + "named '%s'", repl->u.driver.node_name, + repl->u.driver.child); + return; + } + } else { + /* Other types are similar, they work through blk */ + BlockBackend *blk; + bool is_qdev = repl->parent_type == BLOCK_PARENT_TYPE_QDEV; + const char *id = + is_qdev ? repl->u.qdev.qdev_id : repl->u.export.export_id; + + assert(is_qdev || repl->parent_type == BLOCK_PARENT_TYPE_EXPORT); + + blk = is_qdev ? blk_by_qdev_id(id, errp) : blk_by_export_id(id, errp); + if (!blk) { + return; + } + + child = blk_root(blk); + if (!child) { + error_setg(errp, "%s '%s' is empty, nothing to replace", + is_qdev ? "Device" : "Export", id); + return; + } + } + + assert(child); + assert(child->bs); + + new_child_bs = bdrv_find_node(repl->new_child); + if (!new_child_bs) { + error_setg(errp, "Node '%s' not found", repl->new_child); + return; + } + + bdrv_replace_child_bs(child, new_child_bs, errp); +}