From nobody Sat Apr 12 06:18:53 2025 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.zohomail.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; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1529073768522197.3906046541756; Fri, 15 Jun 2018 07:42:48 -0700 (PDT) Received: from localhost ([::1]:47255 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTpw2-0007tw-Le for importer@patchew.org; Fri, 15 Jun 2018 10:42:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTpbg-0006H4-A1 for qemu-devel@nongnu.org; Fri, 15 Jun 2018 10:21:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTpbe-0003qN-Br for qemu-devel@nongnu.org; Fri, 15 Jun 2018 10:21:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45852 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fTpbZ-0003ke-Cu; Fri, 15 Jun 2018 10:21:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E439788840; Fri, 15 Jun 2018 14:21:32 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-117-70.ams2.redhat.com [10.36.117.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EE4F63A51; Fri, 15 Jun 2018 14:21:32 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 15 Jun 2018 16:21:05 +0200 Message-Id: <20180615142108.27814-24-kwolf@redhat.com> In-Reply-To: <20180615142108.27814-1-kwolf@redhat.com> References: <20180615142108.27814-1-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 14:21:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 15 Jun 2018 14:21:32 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'kwolf@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 23/26] block: Remove deprecated -drive geometry options 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: kwolf@redhat.com, qemu-devel@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" The -drive options cyls, heads, secs and trans were deprecated in QEMU 2.10. It's time to remove them. hd-geo-test tested both the old version with geometry options in -drive and the new one with -device. Therefore the code using -drive doesn't have to be replaced there, we just need to remove the -drive test cases. This in turn allows some simplification of the code. Signed-off-by: Kevin Wolf Reviewed-by: Markus Armbruster --- include/sysemu/blockdev.h | 1 - blockdev.c | 75 +------------------------------------------= ---- hw/block/block.c | 14 --------- tests/hd-geo-test.c | 37 +++++------------------ hmp-commands.hx | 1 - qemu-doc.texi | 5 ---- qemu-options.hx | 7 +---- 7 files changed, 9 insertions(+), 131 deletions(-) diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index ac22f2ae1f..37ea39719e 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -35,7 +35,6 @@ struct DriveInfo { int auto_del; /* see blockdev_mark_auto_del() */ bool is_default; /* Added by default_drive() ? */ int media_cd; - int cyls, heads, secs, trans; QemuOpts *opts; char *serial; QTAILQ_ENTRY(DriveInfo) next; diff --git a/blockdev.c b/blockdev.c index c24e261e37..bc9f34810f 100644 --- a/blockdev.c +++ b/blockdev.c @@ -731,22 +731,6 @@ QemuOptsList qemu_legacy_drive_opts =3D { .type =3D QEMU_OPT_STRING, .help =3D "interface (ide, scsi, sd, mtd, floppy, pflash, virt= io)", },{ - .name =3D "cyls", - .type =3D QEMU_OPT_NUMBER, - .help =3D "number of cylinders (ide disk geometry)", - },{ - .name =3D "heads", - .type =3D QEMU_OPT_NUMBER, - .help =3D "number of heads (ide disk geometry)", - },{ - .name =3D "secs", - .type =3D QEMU_OPT_NUMBER, - .help =3D "number of sectors (ide disk geometry)", - },{ - .name =3D "trans", - .type =3D QEMU_OPT_STRING, - .help =3D "chs translation (auto, lba, none)", - },{ .name =3D "addr", .type =3D QEMU_OPT_STRING, .help =3D "pci address (virtio only)", @@ -792,7 +776,6 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) QemuOpts *legacy_opts; DriveMediaType media =3D MEDIA_DISK; BlockInterfaceType type; - int cyls, heads, secs, translation; int max_devs, bus_id, unit_id, index; const char *devaddr; const char *werror, *rerror; @@ -803,7 +786,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) Error *local_err =3D NULL; int i; const char *deprecated[] =3D { - "serial", "trans", "secs", "heads", "cyls", "addr" + "serial", "addr" }; =20 /* Change legacy command line options into QMP ones */ @@ -932,57 +915,6 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfac= eType block_default_type) type =3D block_default_type; } =20 - /* Geometry */ - cyls =3D qemu_opt_get_number(legacy_opts, "cyls", 0); - heads =3D qemu_opt_get_number(legacy_opts, "heads", 0); - secs =3D qemu_opt_get_number(legacy_opts, "secs", 0); - - if (cyls || heads || secs) { - if (cyls < 1) { - error_report("invalid physical cyls number"); - goto fail; - } - if (heads < 1) { - error_report("invalid physical heads number"); - goto fail; - } - if (secs < 1) { - error_report("invalid physical secs number"); - goto fail; - } - } - - translation =3D BIOS_ATA_TRANSLATION_AUTO; - value =3D qemu_opt_get(legacy_opts, "trans"); - if (value !=3D NULL) { - if (!cyls) { - error_report("'%s' trans must be used with cyls, heads and sec= s", - value); - goto fail; - } - if (!strcmp(value, "none")) { - translation =3D BIOS_ATA_TRANSLATION_NONE; - } else if (!strcmp(value, "lba")) { - translation =3D BIOS_ATA_TRANSLATION_LBA; - } else if (!strcmp(value, "large")) { - translation =3D BIOS_ATA_TRANSLATION_LARGE; - } else if (!strcmp(value, "rechs")) { - translation =3D BIOS_ATA_TRANSLATION_RECHS; - } else if (!strcmp(value, "auto")) { - translation =3D BIOS_ATA_TRANSLATION_AUTO; - } else { - error_report("'%s' invalid translation type", value); - goto fail; - } - } - - if (media =3D=3D MEDIA_CDROM) { - if (cyls || secs || heads) { - error_report("CHS can't be set with media=3Dcdrom"); - goto fail; - } - } - /* Device address specified by bus/unit or index. * If none was specified, try to find the first free one. */ bus_id =3D qemu_opt_get_number(legacy_opts, "bus", 0); @@ -1105,11 +1037,6 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterf= aceType block_default_type) dinfo =3D g_malloc0(sizeof(*dinfo)); dinfo->opts =3D all_opts; =20 - dinfo->cyls =3D cyls; - dinfo->heads =3D heads; - dinfo->secs =3D secs; - dinfo->trans =3D translation; - dinfo->type =3D type; dinfo->bus =3D bus_id; dinfo->unit =3D unit_id; diff --git a/hw/block/block.c b/hw/block/block.c index b91e2b6d7e..b6c80ab0b7 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -108,20 +108,6 @@ bool blkconf_geometry(BlockConf *conf, int *ptrans, unsigned cyls_max, unsigned heads_max, unsigned secs= _max, Error **errp) { - DriveInfo *dinfo; - - if (!conf->cyls && !conf->heads && !conf->secs) { - /* try to fall back to value set with legacy -drive cyls=3D... */ - dinfo =3D blk_legacy_dinfo(conf->blk); - if (dinfo) { - conf->cyls =3D dinfo->cyls; - conf->heads =3D dinfo->heads; - conf->secs =3D dinfo->secs; - if (ptrans) { - *ptrans =3D dinfo->trans; - } - } - } if (!conf->cyls && !conf->heads && !conf->secs) { hd_geometry_guess(conf->blk, &conf->cyls, &conf->heads, &conf->secs, diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index 24870b38f4..ce665f1f83 100644 --- a/tests/hd-geo-test.c +++ b/tests/hd-geo-test.c @@ -201,7 +201,7 @@ static void setup_mbr(int img_idx, MBRcontents mbr) =20 static int setup_ide(int argc, char *argv[], int argv_sz, int ide_idx, const char *dev, int img_idx, - MBRcontents mbr, const char *opts) + MBRcontents mbr) { char *s1, *s2, *s3; =20 @@ -216,7 +216,7 @@ static int setup_ide(int argc, char *argv[], int argv_s= z, s3 =3D g_strdup(",media=3Dcdrom"); } argc =3D append_arg(argc, argv, argv_sz, - g_strdup_printf("%s%s%s%s", s1, s2, s3, opts)); + g_strdup_printf("%s%s%s", s1, s2, s3)); g_free(s1); g_free(s2); g_free(s3); @@ -260,7 +260,7 @@ static void test_ide_mbr(bool use_device, MBRcontents m= br) for (i =3D 0; i < backend_last; i++) { cur_ide[i] =3D &hd_chst[i][mbr]; dev =3D use_device ? (is_hd(cur_ide[i]) ? "ide-hd" : "ide-cd") : N= ULL; - argc =3D setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr, ""); + argc =3D setup_ide(argc, argv, ARGV_SIZE, i, dev, i, mbr); } args =3D g_strjoinv(" ", argv); qtest_start(args); @@ -327,16 +327,12 @@ static void test_ide_drive_user(const char *dev, bool= trans) const CHST expected_chst =3D { secs / (4 * 32) , 4, 32, trans }; =20 argc =3D setup_common(argv, ARGV_SIZE); - opts =3D g_strdup_printf("%s,%s%scyls=3D%d,heads=3D%d,secs=3D%d", - dev ?: "", - trans && dev ? "bios-chs-" : "", - trans ? "trans=3Dlba," : "", + opts =3D g_strdup_printf("%s,%scyls=3D%d,heads=3D%d,secs=3D%d", + dev, trans ? "bios-chs-trans=3Dlba," : "", expected_chst.cyls, expected_chst.heads, expected_chst.secs); cur_ide[0] =3D &expected_chst; - argc =3D setup_ide(argc, argv, ARGV_SIZE, - 0, dev ? opts : NULL, backend_small, mbr_chs, - dev ? "" : opts); + argc =3D setup_ide(argc, argv, ARGV_SIZE, 0, opts, backend_small, mbr_= chs); g_free(opts); args =3D g_strjoinv(" ", argv); qtest_start(args); @@ -347,22 +343,6 @@ static void test_ide_drive_user(const char *dev, bool = trans) } =20 /* - * Test case: IDE device (if=3Dide) with explicit CHS - */ -static void test_ide_drive_user_chs(void) -{ - test_ide_drive_user(NULL, false); -} - -/* - * Test case: IDE device (if=3Dide) with explicit CHS and translation - */ -static void test_ide_drive_user_chst(void) -{ - test_ide_drive_user(NULL, true); -} - -/* * Test case: IDE device (if=3Dnone) with explicit CHS */ static void test_ide_device_user_chs(void) @@ -392,8 +372,7 @@ static void test_ide_drive_cd_0(void) for (i =3D 0; i <=3D backend_empty; i++) { ide_idx =3D backend_empty - i; cur_ide[ide_idx] =3D &hd_chst[i][mbr_blank]; - argc =3D setup_ide(argc, argv, ARGV_SIZE, - ide_idx, NULL, i, mbr_blank, ""); + argc =3D setup_ide(argc, argv, ARGV_SIZE, ide_idx, NULL, i, mbr_bl= ank); } args =3D g_strjoinv(" ", argv); qtest_start(args); @@ -422,8 +401,6 @@ int main(int argc, char **argv) qtest_add_func("hd-geo/ide/drive/mbr/blank", test_ide_drive_mbr_blank); qtest_add_func("hd-geo/ide/drive/mbr/lba", test_ide_drive_mbr_lba); qtest_add_func("hd-geo/ide/drive/mbr/chs", test_ide_drive_mbr_chs); - qtest_add_func("hd-geo/ide/drive/user/chs", test_ide_drive_user_chs); - qtest_add_func("hd-geo/ide/drive/user/chst", test_ide_drive_user_chst); qtest_add_func("hd-geo/ide/drive/cd_0", test_ide_drive_cd_0); qtest_add_func("hd-geo/ide/device/mbr/blank", test_ide_device_mbr_blan= k); qtest_add_func("hd-geo/ide/device/mbr/lba", test_ide_device_mbr_lba); diff --git a/hmp-commands.hx b/hmp-commands.hx index 0734fea931..0de7c4c29e 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1283,7 +1283,6 @@ ETEXI .params =3D "[-n] [[:]:]\n" "[file=3Dfile][,if=3Dtype][,bus=3Dn]\n" "[,unit=3Dm][,media=3Dd][,index=3Di]\n" - "[,cyls=3Dc,heads=3Dh,secs=3Ds[,trans=3Dt]]\n" "[,snapshot=3Don|off][,cache=3Don|off]\n" "[,readonly=3Don|off][,copy-on-read=3Don|off]", .help =3D "add drive to PCI storage controller", diff --git a/qemu-doc.texi b/qemu-doc.texi index cd05760cac..ab95bffc74 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2850,11 +2850,6 @@ with ``-device ...,netdev=3Dx''), or ``-nic user,smb= =3D/some/dir'' (for embedded NICs). The new syntax allows different settings to be provided per NIC. =20 -@subsection -drive cyls=3D...,heads=3D...,secs=3D...,trans=3D... (since 2.= 10.0) - -The drive geometry arguments are replaced by the the geometry arguments -that can be specified with the ``-device'' parameter. - @subsection -drive serial=3D... (since 2.10.0) =20 The drive serial argument is replaced by the the serial argument diff --git a/qemu-options.hx b/qemu-options.hx index c0d3951e9f..a14b9655c5 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -804,9 +804,8 @@ ETEXI =20 DEF("drive", HAS_ARG, QEMU_OPTION_drive, "-drive [file=3Dfile][,if=3Dtype][,bus=3Dn][,unit=3Dm][,media=3Dd][,in= dex=3Di]\n" - " [,cyls=3Dc,heads=3Dh,secs=3Ds[,trans=3Dt]][,snapshot=3Don|off]= \n" " [,cache=3Dwritethrough|writeback|none|directsync|unsafe][,form= at=3Df]\n" - " [,serial=3Ds][,addr=3DA][,rerror=3Dignore|stop|report]\n" + " [,snapshot=3Don|off][,serial=3Ds][,addr=3DA][,rerror=3Dignore|= stop|report]\n" " [,werror=3Dignore|stop|report|enospc][,id=3Dname][,aio=3Dthrea= ds|native]\n" " [,readonly=3Don|off][,copy-on-read=3Don|off]\n" " [,discard=3Dignore|unmap][,detect-zeroes=3Don|off|unmap]\n" @@ -847,10 +846,6 @@ This option defines where is connected the drive by us= ing an index in the list of available connectors of a given interface type. @item media=3D@var{media} 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}] -Force disk physical geometry and the optional BIOS translation (trans=3Dno= ne or -lba). 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}). --=20 2.13.6