From nobody Sat May 4 23:02:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494585291284430.46252778221015; Fri, 12 May 2017 03:34:51 -0700 (PDT) Received: from localhost ([::1]:52707 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d97uL-0004r9-HT for importer@patchew.org; Fri, 12 May 2017 06:34:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d97tX-0004XV-5c for qemu-devel@nongnu.org; Fri, 12 May 2017 06:34:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d97tW-0005G9-6d for qemu-devel@nongnu.org; Fri, 12 May 2017 06:33:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44306) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d97tR-0005Ar-Gu; Fri, 12 May 2017 06:33:53 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B34C05BECB; Fri, 12 May 2017 10:33:51 +0000 (UTC) Received: from thh440s.str.redhat.com (dhcp-192-189.str.redhat.com [10.33.192.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id A0AC37D533; Fri, 12 May 2017 10:33:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B34C05BECB Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=thuth@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B34C05BECB From: Thomas Huth To: qemu-devel@nongnu.org, Kevin Wolf , Max Reitz Date: Fri, 12 May 2017 12:33:49 +0200 Message-Id: <1494585229-9119-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 12 May 2017 10:33:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] blockdev: Print a warning for legacy drive options that belong to -device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We likely do not want to carry these legacy -drive options along forever. Let's emit a deprecation warning for the -drive options that have a replacement with the -device option, so that the (hopefully few) remaining users are aware of this and can adapt their scripts / behaviour accordingly. Signed-off-by: Thomas Huth --- v2: - Check for !qtest_enabled() since tests/hd-geo-test still uses these - Added "addr" to the list, too - Also mark the options as deprecated in the documentation blockdev.c | 14 ++++++++++++++ qemu-options.hx | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 0b38c3d..aef38f0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -50,6 +50,7 @@ #include "qmp-commands.h" #include "block/trace.h" #include "sysemu/arch_init.h" +#include "sysemu/qtest.h" #include "qemu/cutils.h" #include "qemu/help_option.h" #include "qemu/throttle-options.h" @@ -797,6 +798,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) const char *filename; Error *local_err =3D NULL; int i; + const char *deprecated[] =3D { + "serial", "trans", "secs", "heads", "cyls", "addr" + }; =20 /* Change legacy command line options into QMP ones */ static const struct { @@ -880,6 +884,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfac= eType block_default_type) "update your scripts.\n"); } =20 + /* Other deprecated options */ + if (!qtest_enabled()) { + for (i =3D 0; i < ARRAY_SIZE(deprecated); i++) { + if (qemu_opt_get(legacy_opts, deprecated[i]) !=3D NULL) { + error_report("'%s' is deprecated, please use the correspon= ding " + "option of '-device' instead", deprecated[i]); + } + } + } + /* Media type */ value =3D qemu_opt_get(legacy_opts, "media"); if (value) { diff --git a/qemu-options.hx b/qemu-options.hx index 9d7964d..2f66f1a 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -615,6 +615,8 @@ of available connectors of a given interface type. This option defines the type of the media: disk or cdrom. @item cyls=3D@var{c},heads=3D@var{h},secs=3D@var{s}[,trans=3D@var{t}] These options have the same definition as they have in @option{-hdachs}. +These parameters are deprecated, use the corresponding parameters +of @code{-device} instead. @item snapshot=3D@var{snapshot} @var{snapshot} is "on" or "off" and controls snapshot mode for the given d= rive (see @option{-snapshot}). @@ -631,7 +633,8 @@ an untrusted format header. @item serial=3D@var{serial} This option specifies the serial number to assign to the device. @item addr=3D@var{addr} -Specify the controller's PCI address (if=3Dvirtio only). +Specify the controller's PCI address (if=3Dvirtio only). This parameter is +deprecated, use the corresponding parameter of @code{-device} instead. @item werror=3D@var{action},rerror=3D@var{action} Specify which @var{action} to take on write and read errors. Valid actions= are: "ignore" (ignore the error and try to continue), "stop" (pause QEMU), --=20 1.8.3.1