From nobody Thu Apr 25 02:18:57 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 1637736304114585.2806183108111; Tue, 23 Nov 2021 22:45:04 -0800 (PST) Received: from localhost ([::1]:60818 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpm1d-0003KN-7m for importer@patchew.org; Wed, 24 Nov 2021 01:45:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltn-0008Ec-Kx for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:55 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:40713) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltm-0007dA-95 for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:55 -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-521-e-pVEVM9O2GZFdFxjPF42Q-1; Wed, 24 Nov 2021 01:36:50 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BA329102CB2A; Wed, 24 Nov 2021 06:36:49 +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 9B26F1001F50; Wed, 24 Nov 2021 06:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637735813; 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=0cG8kycpocBRwVuiOdo+NfBXow4b/L3w+5AZ5Ch3DTM=; b=Gh4rsVHVyRZFDYL6qZ2aPuuzLJgIgOdFEXk10mnA1UoOPD8YiBw4Q1TkH7+JLdGz3peoU3 vvoaGDu6/Xtc13wA1jFsdn9v69SVYcZdrbfLttVioE0WZvYVJy+gekrdHLZRLj+qACbshY twQCpH43JLgkE4Z/jy8umY1buq43/uw= X-MC-Unique: e-pVEVM9O2GZFdFxjPF42Q-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH 1/4] block_int: make bdrv_backing_overridden static Date: Wed, 24 Nov 2021 01:36:37 -0500 Message-Id: <20211124063640.3118897-2-eesposit@redhat.com> In-Reply-To: <20211124063640.3118897-1-eesposit@redhat.com> References: <20211124063640.3118897-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.7, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 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: 1637736305637100001 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 --- include/block/block_int.h | 3 --- block.c | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) 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: * 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, --=20 2.27.0 From nobody Thu Apr 25 02:18:57 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 16377362257421011.5486579237011; Tue, 23 Nov 2021 22:43:45 -0800 (PST) Received: from localhost ([::1]:59366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpm0N-0002Ja-8X for importer@patchew.org; Wed, 24 Nov 2021 01:43:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltp-0008I4-Gl for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:51030) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltn-0007db-DO for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:56 -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-573-FvqvCttJPayRHUAmsJfF2Q-1; Wed, 24 Nov 2021 01:36:51 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 79D951DDEB; Wed, 24 Nov 2021 06:36:50 +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 D4669100EBBF; Wed, 24 Nov 2021 06:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637735814; 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=xWPVOqX47JZkNlJazBDCDv77dr17FjSiIT76Vd4ex6Y=; b=gVuO3o+qieqYblDbTSiCuwZsuWHPJWtmhC4pMWpDLYR+KnvxvPo4NcieFeWjaBxidxe1kG GreFD6IxDvOwI3gKS7+FuMip685vLor0/kAAvxomnYGK0GEb+VS4Lg+LYWfGvl3WcRqiY8 lwzQ6oXWl6EnbnmDpwnt98heNprNMSk= X-MC-Unique: FvqvCttJPayRHUAmsJfF2Q-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH 2/4] include/sysemu/blockdev.h: rename if_name in block_if_name Date: Wed, 24 Nov 2021 01:36:38 -0500 Message-Id: <20211124063640.3118897-3-eesposit@redhat.com> In-Reply-To: <20211124063640.3118897-1-eesposit@redhat.com> References: <20211124063640.3118897-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.7, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 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: 1637736226245100001 Content-Type: text/plain; charset="utf-8" In preparation to next patch, where we export it to be used also in softmmu/vlc.c Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- blockdev.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/blockdev.c b/blockdev.c index b35072644e..1b6ffbbc73 100644 --- a/blockdev.c +++ b/blockdev.c @@ -71,7 +71,7 @@ void bdrv_set_monitor_owned(BlockDriverState *bs) QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list); } =20 -static const char *const if_name[IF_COUNT] =3D { +static const char *const block_if_name[IF_COUNT] =3D { [IF_NONE] =3D "none", [IF_IDE] =3D "ide", [IF_SCSI] =3D "scsi", @@ -120,7 +120,7 @@ void override_max_devs(BlockInterfaceType type, int max= _devs) if (dinfo->type =3D=3D type) { fprintf(stderr, "Cannot override units-per-bus property of" " the %s interface, because a drive of that type has" - " already been added.\n", if_name[type]); + " already been added.\n", block_if_name[type]); g_assert_not_reached(); } } @@ -212,7 +212,7 @@ QemuOpts *drive_add(BlockInterfaceType type, int index,= const char *file, return NULL; } if (type !=3D IF_DEFAULT) { - qemu_opt_set(opts, "if", if_name[type], &error_abort); + qemu_opt_set(opts, "if", block_if_name[type], &error_abort); } if (index >=3D 0) { qemu_opt_set_number(opts, "index", index, &error_abort); @@ -269,7 +269,7 @@ void drive_check_orphaned(void) qemu_opts_loc_restore(dinfo->opts); error_report("machine type does not support" " if=3D%s,bus=3D%d,unit=3D%d", - if_name[dinfo->type], dinfo->bus, dinfo->unit); + block_if_name[dinfo->type], dinfo->bus, dinfo->un= it); loc_pop(&loc); orphans =3D true; } @@ -887,7 +887,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type, value =3D qemu_opt_get(legacy_opts, "if"); if (value) { for (type =3D 0; - type < IF_COUNT && strcmp(value, if_name[type]); + type < IF_COUNT && strcmp(value, block_if_name[type]); type++) { } if (type =3D=3D IF_COUNT) { @@ -945,10 +945,10 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfa= ceType block_default_type, mediastr =3D (media =3D=3D MEDIA_CDROM) ? "-cd" : "-hd"; } if (max_devs) { - new_id =3D g_strdup_printf("%s%i%s%i", if_name[type], bus_id, + new_id =3D g_strdup_printf("%s%i%s%i", block_if_name[type], bu= s_id, mediastr, unit_id); } else { - new_id =3D g_strdup_printf("%s%s%i", if_name[type], + new_id =3D g_strdup_printf("%s%s%i", block_if_name[type], mediastr, unit_id); } qdict_put_str(bs_opts, "id", new_id); --=20 2.27.0 From nobody Thu Apr 25 02:18:57 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 163773664842548.12065660199437; Tue, 23 Nov 2021 22:50:48 -0800 (PST) Received: from localhost ([::1]:38430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpm7B-0007ic-Nx for importer@patchew.org; Wed, 24 Nov 2021 01:50:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltx-0000BL-SQ for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:37:05 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:27562) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltv-0007eJ-RR for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:37:05 -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-166-sfr2UI4QPtq80SiVBwhZ1Q-1; Wed, 24 Nov 2021 01:36:52 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3AA38100C667; Wed, 24 Nov 2021 06:36:51 +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 942A01001F50; Wed, 24 Nov 2021 06:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637735822; 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=GuLobzqZKvuLzKtPsjkNNShkaHwczEoPV1HYeSgRuXE=; b=QbT4xtt7xt/uP8SYt8L4F2abRZu/c7JKxt8jCkVF6g771A41nZv6gxE/nJGffYPT8IRX+P E8uWVMbQ3H8cJLGnc7IX+tRQfgYpW3ttb0IBkXc05k6/YiZLiGjcMjDPi1YMW2I5AI9+0I aEKK/afgXYUVUGk/Hi0qv4hEqIr0/Jw= X-MC-Unique: sfr2UI4QPtq80SiVBwhZ1Q-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH 3/4] include/sysemu/blockdev.h: move drive_add and inline drive_def Date: Wed, 24 Nov 2021 01:36:39 -0500 Message-Id: <20211124063640.3118897-4-eesposit@redhat.com> In-Reply-To: <20211124063640.3118897-1-eesposit@redhat.com> References: <20211124063640.3118897-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.7, 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 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: 1637736650306100001 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 --- include/sysemu/blockdev.h | 6 ++---- block/monitor/block-hmp-cmds.c | 2 +- blockdev.c | 27 +-------------------------- softmmu/vl.c | 25 ++++++++++++++++++++++++- 4 files changed, 28 insertions(+), 32 deletions(-) diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 32c2d6023c..aacc587a33 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -27,6 +27,8 @@ typedef enum { IF_COUNT } BlockInterfaceType; =20 +extern const char *const block_if_name[]; + struct DriveInfo { BlockInterfaceType type; int bus; @@ -45,16 +47,12 @@ BlockBackend *blk_by_legacy_dinfo(DriveInfo *dinfo); 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/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 1b6ffbbc73..928bb743a1 100644 --- a/blockdev.c +++ b/blockdev.c @@ -71,7 +71,7 @@ void bdrv_set_monitor_owned(BlockDriverState *bs) QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list); } =20 -static const char *const block_if_name[IF_COUNT] =3D { +const char *const block_if_name[IF_COUNT] =3D { [IF_NONE] =3D "none", [IF_IDE] =3D "ide", [IF_SCSI] =3D "scsi", @@ -197,31 +197,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", 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; -} - DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit) { BlockBackend *blk; diff --git a/softmmu/vl.c b/softmmu/vl.c index 1159a64bce..f47827926c 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.27.0 From nobody Thu Apr 25 02:18:57 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 1637736700444305.4320710269893; Tue, 23 Nov 2021 22:51:40 -0800 (PST) Received: from localhost ([::1]:40784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpm82-0000vp-8h for importer@patchew.org; Wed, 24 Nov 2021 01:51:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57612) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpltq-0008KF-VA for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:59 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:47424) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mplto-0007ds-OI for qemu-devel@nongnu.org; Wed, 24 Nov 2021 01:36:58 -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-567-P71pKk-tMs2Lz0-Hb0HPHA-1; Wed, 24 Nov 2021 01:36:53 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EFC8100C669; Wed, 24 Nov 2021 06:36:52 +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 546781001F50; Wed, 24 Nov 2021 06:36:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637735816; 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=qSTJ65kgKATH0lAhEJQAGEbeqmMHtqLDGOaBYo+Mdvw=; b=LjPFqRMvosQ3LwOIozbp5Q9+TnbVLXwknMsmDcP+DROK6GRJTWf9Jj312XwgC3oUGrB0RB 7eIcu7/dBuQFry04KWO0ANwatInxnIafkDyjAKKZ41Ah8L76JfIF8riwLZ964VnKxAeOPg 0o6SyKMpSVjwrg2DM8DYyzRfy3WobF0= X-MC-Unique: P71pKk-tMs2Lz0-Hb0HPHA-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Subject: [PATCH 4/4] include/sysemu/blockdev.h: remove drive_get_max_devs Date: Wed, 24 Nov 2021 01:36:40 -0500 Message-Id: <20211124063640.3118897-5-eesposit@redhat.com> In-Reply-To: <20211124063640.3118897-1-eesposit@redhat.com> References: <20211124063640.3118897-1-eesposit@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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.7, 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_H4=0.001, RCVD_IN_MSPIKE_WL=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 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: 1637736701487100001 Content-Type: text/plain; charset="utf-8" Remove drive_get_max_devs, as it is not used by anyone. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefan Hajnoczi --- include/sysemu/blockdev.h | 1 - blockdev.c | 17 ----------------- 2 files changed, 18 deletions(-) diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index aacc587a33..c4b7b8b54e 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -50,7 +50,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, diff --git a/blockdev.c b/blockdev.c index 928bb743a1..84897f9d70 100644 --- a/blockdev.c +++ b/blockdev.c @@ -168,23 +168,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]; --=20 2.27.0