From nobody Thu May 2 01:03:31 2024 Delivered-To: importer@patchew.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 1638265873700304.8912740106474; Tue, 30 Nov 2021 01:51:13 -0800 (PST) Received: from localhost ([::1]:55378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrzn6-00086M-NW for importer@patchew.org; Tue, 30 Nov 2021 04:51:12 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33278) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzir-0001t0-Je for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:49 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:54445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzip-0002y2-6M for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-338-uLIFDL87NnuEObh-OTNFVw-1; Tue, 30 Nov 2021 04:46:43 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DBF883DD21; Tue, 30 Nov 2021 09:46:42 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC7AB67842; Tue, 30 Nov 2021 09:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638265606; 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=Wg85p4YpsagREVjYpi+5jooLA80+daO+GvOkZDwW4Y8=; b=Ss+LV1i7fc1R1nQblm/z5jfr/qIR2UxyCx19iy+U2vqlT1Vfasl4N/2y7x7mhLkQs14Btj JyqloQGk1x22EjFcpREB/lJvT4uJyQZyYLdA2ydI5rQAiGs3ZIJAUYjMgW/7R0Ayzd1fku T1Lm/tpaigUJ6pd+iVfzjWMyWYtQ8q0= X-MC-Unique: uLIFDL87NnuEObh-OTNFVw-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH v2 1/4] block_int: make bdrv_backing_overridden static Date: Tue, 30 Nov 2021 04:46:30 -0500 Message-Id: <20211130094633.277982-2-eesposit@redhat.com> In-Reply-To: <20211130094633.277982-1-eesposit@redhat.com> References: <20211130094633.277982-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eesposit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=170.10.133.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.716, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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: , Cc: Kevin Wolf , Emanuele Giuseppe Esposito , Markus Armbruster , qemu-devel@nongnu.org, Hanna Reitz , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638265875268100001 Content-Type: text/plain; charset="utf-8" bdrv_backing_overridden is only used in block.c, so there is no need to leave it in block_int.h Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- block.c | 4 +++- include/block/block_int.h | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/block.c b/block.c index 0ac5b163d2..10346b5011 100644 --- a/block.c +++ b/block.c @@ -103,6 +103,8 @@ static int bdrv_reopen_prepare(BDRVReopenState *reopen_= state, static void bdrv_reopen_commit(BDRVReopenState *reopen_state); static void bdrv_reopen_abort(BDRVReopenState *reopen_state); =20 +static bool bdrv_backing_overridden(BlockDriverState *bs); + /* If non-zero, use only whitelisted block drivers */ static int use_bdrv_whitelist; =20 @@ -7475,7 +7477,7 @@ static bool append_strong_runtime_options(QDict *d, B= lockDriverState *bs) /* Note: This function may return false positives; it may return true * even if opening the backing file specified by bs's image header * would result in exactly bs->backing. */ -bool bdrv_backing_overridden(BlockDriverState *bs) +static bool bdrv_backing_overridden(BlockDriverState *bs) { if (bs->backing) { return strcmp(bs->auto_backing_file, diff --git a/include/block/block_int.h b/include/block/block_int.h index f4c75e8ba9..27008cfb22 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1122,9 +1122,6 @@ BlockDriver *bdrv_probe_all(const uint8_t *buf, int b= uf_size, void bdrv_parse_filename_strip_prefix(const char *filename, const char *pr= efix, QDict *options); =20 -bool bdrv_backing_overridden(BlockDriverState *bs); - - /** * bdrv_add_aio_context_notifier: * --=20 2.31.1 From nobody Thu May 2 01:03:31 2024 Delivered-To: importer@patchew.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 1638265720383512.6846940853733; Tue, 30 Nov 2021 01:48:40 -0800 (PST) Received: from localhost ([::1]:49636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrzkd-00045X-7L for importer@patchew.org; Tue, 30 Nov 2021 04:48:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzis-0001tv-Tt for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:51 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzip-0002y9-V4 for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:49 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-370-NncoP7RyO1K_HJQRYTn2dg-1; Tue, 30 Nov 2021 04:46:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CE30835E25; Tue, 30 Nov 2021 09:46:43 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 880C82B178; Tue, 30 Nov 2021 09:46:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638265607; 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=zGLYYQN8VeLlSHmUD/3rhKQPqXGYxqvX1A3MXMcKCtQ=; b=Z8kiscfmiMCzNTfwLtTCXT/wo/CSvNFm+HP+DxKIeXTVFUH2IKIOk/uQtZwAkn1kLp8VnE vWEzs+g9MYuvqmC7feUpzZwpWp7RB4i8jXDBvqH6nJqZ/kCgG2pTklT7qmTR1V2FESYbLU KeINLnaHJ7ng+rqywmYQwHhq/nfDSog= X-MC-Unique: NncoP7RyO1K_HJQRYTn2dg-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH v2 2/4] include/sysemu/blockdev.c: introduce block_if_name Date: Tue, 30 Nov 2021 04:46:31 -0500 Message-Id: <20211130094633.277982-3-eesposit@redhat.com> In-Reply-To: <20211130094633.277982-1-eesposit@redhat.com> References: <20211130094633.277982-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eesposit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=170.10.133.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.716, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable 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: , Cc: Kevin Wolf , Emanuele Giuseppe Esposito , Markus Armbruster , qemu-devel@nongnu.org, Hanna Reitz , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638265722320100005 Content-Type: text/plain; charset="utf-8" Add a getter function for the if_name array, so that also outside functions can access it. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- blockdev.c | 5 +++++ include/sysemu/blockdev.h | 1 + 2 files changed, 6 insertions(+) diff --git a/blockdev.c b/blockdev.c index b35072644e..1581f0d2f5 100644 --- a/blockdev.c +++ b/blockdev.c @@ -83,6 +83,11 @@ static const char *const if_name[IF_COUNT] =3D { [IF_XEN] =3D "xen", }; =20 +const char *block_if_name(BlockInterfaceType iface) +{ + return if_name[iface]; +} + static int if_max_devs[IF_COUNT] =3D { /* * Do not change these numbers! They govern how drive option diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 32c2d6023c..b321286dee 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -42,6 +42,7 @@ DriveInfo *blk_legacy_dinfo(BlockBackend *blk); DriveInfo *blk_set_legacy_dinfo(BlockBackend *blk, DriveInfo *dinfo); BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo); =20 +const char *block_if_name(BlockInterfaceType iface); void override_max_devs(BlockInterfaceType type, int max_devs); =20 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); --=20 2.31.1 From nobody Thu May 2 01:03:31 2024 Delivered-To: importer@patchew.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 1638265719656789.2664864130408; Tue, 30 Nov 2021 01:48:39 -0800 (PST) Received: from localhost ([::1]:49674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrzkc-00047I-Ap for importer@patchew.org; Tue, 30 Nov 2021 04:48:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrziq-0001sR-F9 for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:46804) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzio-0002xy-SG for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:48 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-163-g_K5PCNiN4OQRH5YKLgEzQ-1; Tue, 30 Nov 2021 04:46:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D5A283DD20; Tue, 30 Nov 2021 09:46:44 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 57EC667842; Tue, 30 Nov 2021 09:46:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638265606; 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=FY+lt2AlJxKBDZIZpqJbephH97L/1EfFr1G8R+ZyA/w=; b=LRnRHaa6ZF+Q46CTDPmMG3UvOoSu9KjpDltVEuUvuNkS4PqNZh1LqiIC4GVhStOY2jROXR ygs3Sc5bniWLta1hGrDJDUiXrDTFpAGGAQG7MeRaRSX6or9oWhbHjxZD6gAD9slXv7ohYq s03FJ1hchMPp4h28IwfMXZo7bxs0dbE= X-MC-Unique: g_K5PCNiN4OQRH5YKLgEzQ-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH v2 3/4] include/sysemu/blockdev.h: move drive_add and inline drive_def Date: Tue, 30 Nov 2021 04:46:32 -0500 Message-Id: <20211130094633.277982-4-eesposit@redhat.com> In-Reply-To: <20211130094633.277982-1-eesposit@redhat.com> References: <20211130094633.277982-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eesposit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=170.10.129.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.716, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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: , Cc: Kevin Wolf , Emanuele Giuseppe Esposito , Markus Armbruster , qemu-devel@nongnu.org, Hanna Reitz , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638265720611100002 Content-Type: text/plain; charset="utf-8" drive_add is only used in softmmu/vl.c, so it can be a static function there, and drive_def is only a particular use case of qemu_opts_parse_noisily, so it can be inlined. Also remove drive_mark_claimed_by_board, as it is only defined but not implemented (nor used) anywhere. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Stefan Hajnoczi --- block/monitor/block-hmp-cmds.c | 2 +- blockdev.c | 25 ------------------------- include/sysemu/blockdev.h | 4 ---- softmmu/vl.c | 25 ++++++++++++++++++++++++- 4 files changed, 25 insertions(+), 31 deletions(-) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 2ac4aedfff..bfb3c043a0 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -101,7 +101,7 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict) return; } =20 - opts =3D drive_def(optstr); + opts =3D qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, fals= e); if (!opts) return; =20 diff --git a/blockdev.c b/blockdev.c index 1581f0d2f5..e5cb3eb95f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -202,31 +202,6 @@ static int drive_index_to_unit_id(BlockInterfaceType t= ype, int index) return max_devs ? index % max_devs : index; } =20 -QemuOpts *drive_def(const char *optstr) -{ - return qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, false); -} - -QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, - const char *optstr) -{ - QemuOpts *opts; - - opts =3D drive_def(optstr); - if (!opts) { - return NULL; - } - if (type !=3D IF_DEFAULT) { - qemu_opt_set(opts, "if", if_name[type], &error_abort); - } - if (index >=3D 0) { - qemu_opt_set_number(opts, "index", index, &error_abort); - } - if (file) - qemu_opt_set(opts, "file", file, &error_abort); - return opts; -} - DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit) { BlockBackend *blk; diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index b321286dee..21ae0b994a 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -46,16 +46,12 @@ const char *block_if_name(BlockInterfaceType iface); void override_max_devs(BlockInterfaceType type, int max_devs); =20 DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit); -void drive_mark_claimed_by_board(void); void drive_check_orphaned(void); DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); int drive_get_max_bus(BlockInterfaceType type); int drive_get_max_devs(BlockInterfaceType type); DriveInfo *drive_get_next(BlockInterfaceType type); =20 -QemuOpts *drive_def(const char *optstr); -QemuOpts *drive_add(BlockInterfaceType type, int index, const char *file, - const char *optstr); DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type, Error **errp); =20 diff --git a/softmmu/vl.c b/softmmu/vl.c index 1159a64bce..4df30bad14 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -650,6 +650,27 @@ static int drive_enable_snapshot(void *opaque, QemuOpt= s *opts, Error **errp) return 0; } =20 +static QemuOpts *drive_add(BlockInterfaceType type, int index, + const char *file, const char *optstr) +{ + QemuOpts *opts; + + opts =3D qemu_opts_parse_noisily(qemu_find_opts("drive"), optstr, fals= e); + if (!opts) { + return NULL; + } + if (type !=3D IF_DEFAULT) { + qemu_opt_set(opts, "if", block_if_name(type), &error_abort); + } + if (index >=3D 0) { + qemu_opt_set_number(opts, "index", index, &error_abort); + } + if (file) { + qemu_opt_set(opts, "file", file, &error_abort); + } + return opts; +} + static void default_drive(int enable, int snapshot, BlockInterfaceType typ= e, int index, const char *optstr) { @@ -2884,7 +2905,9 @@ void qemu_init(int argc, char **argv, char **envp) break; } case QEMU_OPTION_drive: - if (drive_def(optarg) =3D=3D NULL) { + opts =3D qemu_opts_parse_noisily(qemu_find_opts("drive"), + optarg, false); + if (opts =3D=3D NULL) { exit(1); } break; --=20 2.31.1 From nobody Thu May 2 01:03:31 2024 Delivered-To: importer@patchew.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 1638265875663235.4511695899772; Tue, 30 Nov 2021 01:51:15 -0800 (PST) Received: from localhost ([::1]:55510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrzn8-0008Ck-Ld for importer@patchew.org; Tue, 30 Nov 2021 04:51:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33328) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrziu-0001v0-5u for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:31244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrzis-0002ym-La for qemu-devel@nongnu.org; Tue, 30 Nov 2021 04:46:51 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-474-ynmoYN4NP6KXnaIt6PLIvA-1; Tue, 30 Nov 2021 04:46:45 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D090B100CCC3; Tue, 30 Nov 2021 09:46:44 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 27C3A67842; Tue, 30 Nov 2021 09:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638265609; 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=QCnNlqYMvB0OEr/twOqvyndqGkIfKjLtIkACfXb6y/I=; b=SEdNqrvnEkqlQg9PnUPaevBK87z3h++uJiBmbnmwz6KhCFKxLdaIQYVJjNUVSnJa9VBTPo TFznM+Pup5WGV0tLQXQjgNqyXY7AOiAoZMi5rSEL9sskKGCG9wV3eQzwSy6OCKAxuTzKsk nfFU3AVmCiZnGn5N5AbN4usGnU5mnQY= X-MC-Unique: ynmoYN4NP6KXnaIt6PLIvA-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH v2 4/4] include/sysemu/blockdev.h: remove drive_get_max_devs Date: Tue, 30 Nov 2021 04:46:33 -0500 Message-Id: <20211130094633.277982-5-eesposit@redhat.com> In-Reply-To: <20211130094633.277982-1-eesposit@redhat.com> References: <20211130094633.277982-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=eesposit@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=170.10.133.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.716, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=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: , Cc: Kevin Wolf , Emanuele Giuseppe Esposito , Markus Armbruster , qemu-devel@nongnu.org, Hanna Reitz , Stefan Hajnoczi , Paolo Bonzini , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1638265877478100001 Remove drive_get_max_devs, as it is not used by anyone. Last use was removed in commit 8f2d75e81d5 ("hw: Drop superfluous special checks for orphaned -drive"). Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- blockdev.c | 17 ----------------- include/sysemu/blockdev.h | 1 - 2 files changed, 18 deletions(-) diff --git a/blockdev.c b/blockdev.c index e5cb3eb95f..0112f488a4 100644 --- a/blockdev.c +++ b/blockdev.c @@ -173,23 +173,6 @@ void blockdev_auto_del(BlockBackend *blk) } } =20 -/** - * Returns the current mapping of how many units per bus - * a particular interface can support. - * - * A positive integer indicates n units per bus. - * 0 implies the mapping has not been established. - * -1 indicates an invalid BlockInterfaceType was given. - */ -int drive_get_max_devs(BlockInterfaceType type) -{ - if (type >=3D IF_IDE && type < IF_COUNT) { - return if_max_devs[type]; - } - - return -1; -} - static int drive_index_to_bus_id(BlockInterfaceType type, int index) { int max_devs =3D if_max_devs[type]; diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 21ae0b994a..430abdbdb8 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -49,7 +49,6 @@ DriveInfo *drive_get(BlockInterfaceType type, int bus, in= t unit); void drive_check_orphaned(void); DriveInfo *drive_get_by_index(BlockInterfaceType type, int index); int drive_get_max_bus(BlockInterfaceType type); -int drive_get_max_devs(BlockInterfaceType type); DriveInfo *drive_get_next(BlockInterfaceType type); =20 DriveInfo *drive_new(QemuOpts *arg, BlockInterfaceType block_default_type, --=20 2.31.1