From nobody Tue Nov 4 18:52:28 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 153088276347556.24542137493813; Fri, 6 Jul 2018 06:12:43 -0700 (PDT) Received: from localhost ([::1]:57998 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQXS-0000cv-Mk for importer@patchew.org; Fri, 06 Jul 2018 09:12:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQRS-0004rj-Ep for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbQRR-0005NR-I4 for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56934 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 1fbQRM-0005Ko-NB; Fri, 06 Jul 2018 09:06:24 -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 4D4A74022414; Fri, 6 Jul 2018 13:06:24 +0000 (UTC) Received: from localhost (dhcp-192-215.str.redhat.com [10.33.192.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 074307C20; Fri, 6 Jul 2018 13:06:23 +0000 (UTC) From: Cornelia Huck To: Kevin Wolf , Max Reitz Date: Fri, 6 Jul 2018 15:06:17 +0200 Message-Id: <20180706130620.5647-2-cohuck@redhat.com> In-Reply-To: <20180706130620.5647-1-cohuck@redhat.com> References: <20180706130620.5647-1-cohuck@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.6]); Fri, 06 Jul 2018 13:06:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 06 Jul 2018 13:06:24 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@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] [PATCH for-3.0 1/4] Revert "block: Remove dead deprecation warning code" 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: Peter Maydell , qemu-block@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Christian Borntraeger 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" This reverts commit 6266e900b8083945cb766b45c124fb3c42932cb3. Some deprecated -drive options were still in use by libvirt, only fixed with libvirt commit b340c6c614 ("qemu: format serial and geometry on frontend disk device"), which is not yet in any released version of libvirt. So let's hold off removing the deprecated options for one more QEMU release. Reported-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- blockdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/blockdev.c b/blockdev.c index 72f5347df5..37eb40670b 100644 --- a/blockdev.c +++ b/blockdev.c @@ -775,6 +775,8 @@ 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 { + }; =20 /* Change legacy command line options into QMP ones */ static const struct { @@ -851,6 +853,16 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfac= eType block_default_type) goto fail; } =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) { --=20 2.14.4 From nobody Tue Nov 4 18:52:28 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 1530882887932232.0603216021516; Fri, 6 Jul 2018 06:14:47 -0700 (PDT) Received: from localhost ([::1]:58011 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQZR-0002DH-2l for importer@patchew.org; Fri, 06 Jul 2018 09:14:45 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQRT-0004tF-OL for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbQRR-0005OE-Uz for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53456 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 1fbQRO-0005Lc-BR; Fri, 06 Jul 2018 09:06:26 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDA7072647; Fri, 6 Jul 2018 13:06:25 +0000 (UTC) Received: from localhost (dhcp-192-215.str.redhat.com [10.33.192.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88B36111DCFA; Fri, 6 Jul 2018 13:06:25 +0000 (UTC) From: Cornelia Huck To: Kevin Wolf , Max Reitz Date: Fri, 6 Jul 2018 15:06:18 +0200 Message-Id: <20180706130620.5647-3-cohuck@redhat.com> In-Reply-To: <20180706130620.5647-1-cohuck@redhat.com> References: <20180706130620.5647-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 06 Jul 2018 13:06:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 06 Jul 2018 13:06:25 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@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] [PATCH for-3.0 2/4] Revert "block: Remove deprecated -drive option serial" 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: Peter Maydell , qemu-block@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Christian Borntraeger 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" This reverts commit b0083267444a5e0f28391f6c2831a539f878d424. Hold off removing this for one more QEMU release (current libvirt release still uses it.) Signed-off-by: Cornelia Huck --- block/block-backend.c | 1 + blockdev.c | 10 ++++++++++ hw/block/block.c | 13 +++++++++++++ hw/block/nvme.c | 1 + hw/block/virtio-blk.c | 1 + hw/ide/qdev.c | 1 + hw/scsi/scsi-disk.c | 1 + hw/usb/dev-storage.c | 1 + include/hw/block/block.h | 1 + include/sysemu/blockdev.h | 1 + qemu-doc.texi | 5 +++++ qemu-options.hx | 6 +++++- tests/ahci-test.c | 6 +++--- tests/ide-test.c | 8 ++++---- 14 files changed, 48 insertions(+), 8 deletions(-) diff --git a/block/block-backend.c b/block/block-backend.c index 6b75bca317..f7155942ac 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -419,6 +419,7 @@ static void drive_info_del(DriveInfo *dinfo) return; } qemu_opts_del(dinfo->opts); + g_free(dinfo->serial); g_free(dinfo); } =20 diff --git a/blockdev.c b/blockdev.c index 37eb40670b..6c530769fd 100644 --- a/blockdev.c +++ b/blockdev.c @@ -730,6 +730,10 @@ QemuOptsList qemu_legacy_drive_opts =3D { .name =3D "if", .type =3D QEMU_OPT_STRING, .help =3D "interface (ide, scsi, sd, mtd, floppy, pflash, virt= io)", + },{ + .name =3D "serial", + .type =3D QEMU_OPT_STRING, + .help =3D "disk serial number", },{ .name =3D "file", .type =3D QEMU_OPT_STRING, @@ -772,10 +776,12 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfa= ceType block_default_type) const char *werror, *rerror; bool read_only =3D false; bool copy_on_read; + const char *serial; const char *filename; Error *local_err =3D NULL; int i; const char *deprecated[] =3D { + "serial" }; =20 /* Change legacy command line options into QMP ones */ @@ -943,6 +949,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) goto fail; } =20 + /* Serial number */ + serial =3D qemu_opt_get(legacy_opts, "serial"); + /* no id supplied -> create one */ if (qemu_opts_id(all_opts) =3D=3D NULL) { char *new_id; @@ -1017,6 +1026,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfa= ceType block_default_type) dinfo->type =3D type; dinfo->bus =3D bus_id; dinfo->unit =3D unit_id; + dinfo->serial =3D g_strdup(serial); =20 blk_set_legacy_dinfo(blk, dinfo); =20 diff --git a/hw/block/block.c b/hw/block/block.c index cf0eb826f1..b6c80ab0b7 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -15,6 +15,19 @@ #include "qapi/qapi-types-block.h" #include "qemu/error-report.h" =20 +void blkconf_serial(BlockConf *conf, char **serial) +{ + DriveInfo *dinfo; + + if (!*serial) { + /* try to fall back to value set with legacy -drive serial=3D... */ + dinfo =3D blk_legacy_dinfo(conf->blk); + if (dinfo) { + *serial =3D g_strdup(dinfo->serial); + } + } +} + void blkconf_blocksizes(BlockConf *conf) { BlockBackend *blk =3D conf->blk; diff --git a/hw/block/nvme.c b/hw/block/nvme.c index fc7dacb816..5e508ab1b3 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1217,6 +1217,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error **= errp) return; } =20 + blkconf_serial(&n->conf, &n->serial); if (!n->serial) { error_setg(errp, "serial property not set"); return; diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index 225fe44b7a..50b5c869e3 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -935,6 +935,7 @@ static void virtio_blk_device_realize(DeviceState *dev,= Error **errp) return; } =20 + blkconf_serial(&conf->conf, &conf->serial); if (!blkconf_apply_backend_options(&conf->conf, blk_is_read_only(conf->conf.blk), t= rue, errp)) { diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index 573b022e1e..f395d24592 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -188,6 +188,7 @@ static void ide_dev_initfn(IDEDevice *dev, IDEDriveKind= kind, Error **errp) return; } =20 + blkconf_serial(&dev->conf, &dev->serial); if (kind !=3D IDE_CD) { if (!blkconf_geometry(&dev->conf, &dev->chs_trans, 65535, 16, 255, errp)) { diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 32f3f96ff8..d7df357029 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2378,6 +2378,7 @@ static void scsi_realize(SCSIDevice *dev, Error **err= p) return; } =20 + blkconf_serial(&s->qdev.conf, &s->serial); blkconf_blocksizes(&s->qdev.conf); =20 if (s->qdev.conf.logical_block_size > diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index cd5551d94f..45a9487cdb 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -599,6 +599,7 @@ static void usb_msd_storage_realize(USBDevice *dev, Err= or **errp) return; } =20 + blkconf_serial(&s->conf, &dev->serial); blkconf_blocksizes(&s->conf); if (!blkconf_apply_backend_options(&s->conf, blk_is_read_only(blk), tr= ue, errp)) { diff --git a/include/hw/block/block.h b/include/hw/block/block.h index e9f9e2223f..d4f4dfffab 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -72,6 +72,7 @@ static inline unsigned int get_physical_block_exp(BlockCo= nf *conf) =20 /* Configuration helpers */ =20 +void blkconf_serial(BlockConf *conf, char **serial); bool blkconf_geometry(BlockConf *conf, int *trans, unsigned cyls_max, unsigned heads_max, unsigned secs= _max, Error **errp); diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 24954b94e0..c0ae3700ec 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -35,6 +35,7 @@ struct DriveInfo { bool is_default; /* Added by default_drive() ? */ int media_cd; QemuOpts *opts; + char *serial; QTAILQ_ENTRY(DriveInfo) next; }; =20 diff --git a/qemu-doc.texi b/qemu-doc.texi index d3924e928e..d343affd6d 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2887,6 +2887,11 @@ 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 serial=3D... (since 2.10.0) + +The drive serial argument is replaced by the the serial argument +that can be specified with the ``-device'' parameter. + @subsection -usbdevice (since 2.10.0) =20 The ``-usbdevice DEV'' argument is now a synonym for setting diff --git a/qemu-options.hx b/qemu-options.hx index 16208f63f2..381648b9cb 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -805,7 +805,7 @@ ETEXI DEF("drive", HAS_ARG, QEMU_OPTION_drive, "-drive [file=3Dfile][,if=3Dtype][,bus=3Dn][,unit=3Dm][,media=3Dd][,in= dex=3Di]\n" " [,cache=3Dwritethrough|writeback|none|directsync|unsafe][,form= at=3Df]\n" - " [,snapshot=3Don|off][,rerror=3Dignore|stop|report]\n" + " [,snapshot=3Don|off][,serial=3Ds][,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" @@ -879,6 +879,10 @@ The default mode is @option{cache=3Dwriteback}. Specify which disk @var{format} will be used rather than detecting the format. Can be used to specify format=3Draw to avoid interpreting an untrusted format header. +@item serial=3D@var{serial} +This option specifies the serial number to assign to the device. 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), diff --git a/tests/ahci-test.c b/tests/ahci-test.c index 937ed2f910..1a7b761304 100644 --- a/tests/ahci-test.c +++ b/tests/ahci-test.c @@ -180,12 +180,12 @@ static AHCIQState *ahci_boot(const char *cli, ...) s =3D ahci_vboot(cli, ap); va_end(ap); } else { - cli =3D "-drive if=3Dnone,id=3Ddrive0,file=3D%s,cache=3Dwriteback,= format=3D%s" + cli =3D "-drive if=3Dnone,id=3Ddrive0,file=3D%s,cache=3Dwriteback,= serial=3D%s" + ",format=3D%s" " -M q35 " "-device ide-hd,drive=3Ddrive0 " - "-global ide-hd.serial=3D%s " "-global ide-hd.ver=3D%s"; - s =3D ahci_boot(cli, tmp_path, imgfmt, "testdisk", "version"); + s =3D ahci_boot(cli, tmp_path, "testdisk", imgfmt, "version"); } =20 return s; diff --git a/tests/ide-test.c b/tests/ide-test.c index f39431b1a9..2384c2c3e2 100644 --- a/tests/ide-test.c +++ b/tests/ide-test.c @@ -529,8 +529,8 @@ static void test_bmdma_no_busmaster(void) static void test_bmdma_setup(void) { ide_test_start( - "-drive file=3D%s,if=3Dide,cache=3Dwriteback,format=3Draw " - "-global ide-hd.serial=3D%s -global ide-hd.ver=3D%s", + "-drive file=3D%s,if=3Dide,serial=3D%s,cache=3Dwriteback,format=3D= raw " + "-global ide-hd.ver=3D%s", tmp_path, "testdisk", "version"); qtest_irq_intercept_in(global_qtest, "ioapic"); } @@ -561,8 +561,8 @@ static void test_identify(void) int ret; =20 ide_test_start( - "-drive file=3D%s,if=3Dide,cache=3Dwriteback,format=3Draw " - "-global ide-hd.serial=3D%s -global ide-hd.ver=3D%s", + "-drive file=3D%s,if=3Dide,serial=3D%s,cache=3Dwriteback,format=3D= raw " + "-global ide-hd.ver=3D%s", tmp_path, "testdisk", "version"); =20 dev =3D get_pci_device(&bmdma_bar, &ide_bar); --=20 2.14.4 From nobody Tue Nov 4 18:52:28 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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1530882537375785.7274125899427; Fri, 6 Jul 2018 06:08:57 -0700 (PDT) Received: from localhost ([::1]:57968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQTj-0006LJ-7l for importer@patchew.org; Fri, 06 Jul 2018 09:08:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQRT-0004tH-P6 for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbQRS-0005Od-Gl for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:31 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53466 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 1fbQRP-0005MO-TC; Fri, 06 Jul 2018 09:06:27 -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 7835C7264E; Fri, 6 Jul 2018 13:06:27 +0000 (UTC) Received: from localhost (dhcp-192-215.str.redhat.com [10.33.192.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30C7F7C20; Fri, 6 Jul 2018 13:06:27 +0000 (UTC) From: Cornelia Huck To: Kevin Wolf , Max Reitz Date: Fri, 6 Jul 2018 15:06:19 +0200 Message-Id: <20180706130620.5647-4-cohuck@redhat.com> In-Reply-To: <20180706130620.5647-1-cohuck@redhat.com> References: <20180706130620.5647-1-cohuck@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, 06 Jul 2018 13:06:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Fri, 06 Jul 2018 13:06:27 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@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] [PATCH for-3.0 3/4] Revert "block: Remove deprecated -drive option addr" 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: Peter Maydell , qemu-block@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Christian Borntraeger 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" This reverts commit eae3bd1eb7c6b105d30ec06008b3bc3dfc5f45bb. Reverted to avoid conflicts for geometry options revert. Signed-off-by: Cornelia Huck --- blockdev.c | 17 ++++++++++++++++- device-hotplug.c | 4 ++++ include/sysemu/blockdev.h | 1 + qemu-doc.texi | 5 +++++ qemu-options.hx | 5 ++++- 5 files changed, 30 insertions(+), 2 deletions(-) diff --git a/blockdev.c b/blockdev.c index 6c530769fd..c23587b075 100644 --- a/blockdev.c +++ b/blockdev.c @@ -730,6 +730,10 @@ QemuOptsList qemu_legacy_drive_opts =3D { .name =3D "if", .type =3D QEMU_OPT_STRING, .help =3D "interface (ide, scsi, sd, mtd, floppy, pflash, virt= io)", + },{ + .name =3D "addr", + .type =3D QEMU_OPT_STRING, + .help =3D "pci address (virtio only)", },{ .name =3D "serial", .type =3D QEMU_OPT_STRING, @@ -773,6 +777,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) DriveMediaType media =3D MEDIA_DISK; BlockInterfaceType type; int max_devs, bus_id, unit_id, index; + const char *devaddr; const char *werror, *rerror; bool read_only =3D false; bool copy_on_read; @@ -781,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" + "serial", "addr" }; =20 /* Change legacy command line options into QMP ones */ @@ -971,6 +976,12 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfac= eType block_default_type) } =20 /* Add virtio block device */ + devaddr =3D qemu_opt_get(legacy_opts, "addr"); + if (devaddr && type !=3D IF_VIRTIO) { + error_report("addr is not supported by this bus type"); + goto fail; + } + if (type =3D=3D IF_VIRTIO) { QemuOpts *devopts; devopts =3D qemu_opts_create(qemu_find_opts("device"), NULL, 0, @@ -982,6 +993,9 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) } qemu_opt_set(devopts, "drive", qdict_get_str(bs_opts, "id"), &error_abort); + if (devaddr) { + qemu_opt_set(devopts, "addr", devaddr, &error_abort); + } } =20 filename =3D qemu_opt_get(legacy_opts, "file"); @@ -1026,6 +1040,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterfa= ceType block_default_type) dinfo->type =3D type; dinfo->bus =3D bus_id; dinfo->unit =3D unit_id; + dinfo->devaddr =3D devaddr; dinfo->serial =3D g_strdup(serial); =20 blk_set_legacy_dinfo(blk, dinfo); diff --git a/device-hotplug.c b/device-hotplug.c index cd427e2c76..23fd6656f1 100644 --- a/device-hotplug.c +++ b/device-hotplug.c @@ -69,6 +69,10 @@ void hmp_drive_add(Monitor *mon, const QDict *qdict) if (!dinfo) { goto err; } + if (dinfo->devaddr) { + monitor_printf(mon, "Parameter addr not supported\n"); + goto err; + } =20 switch (dinfo->type) { case IF_NONE: diff --git a/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index c0ae3700ec..37ea39719e 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -28,6 +28,7 @@ typedef enum { } BlockInterfaceType; =20 struct DriveInfo { + const char *devaddr; BlockInterfaceType type; int bus; int unit; diff --git a/qemu-doc.texi b/qemu-doc.texi index d343affd6d..ae5531a053 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2892,6 +2892,11 @@ provided per NIC. The drive serial argument is replaced by the the serial argument that can be specified with the ``-device'' parameter. =20 +@subsection -drive addr=3D... (since 2.10.0) + +The drive addr argument is replaced by the the addr argument +that can be specified with the ``-device'' parameter. + @subsection -usbdevice (since 2.10.0) =20 The ``-usbdevice DEV'' argument is now a synonym for setting diff --git a/qemu-options.hx b/qemu-options.hx index 381648b9cb..df248d1568 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -805,7 +805,7 @@ ETEXI DEF("drive", HAS_ARG, QEMU_OPTION_drive, "-drive [file=3Dfile][,if=3Dtype][,bus=3Dn][,unit=3Dm][,media=3Dd][,in= dex=3Di]\n" " [,cache=3Dwritethrough|writeback|none|directsync|unsafe][,form= at=3Df]\n" - " [,snapshot=3Don|off][,serial=3Ds][,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" @@ -883,6 +883,9 @@ an untrusted format header. This option specifies the serial number to assign to the device. This parameter is deprecated, use the corresponding parameter of @code{-device} instead. +@item addr=3D@var{addr} +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 2.14.4 From nobody Tue Nov 4 18:52:28 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 1530882662553559.2096267169242; Fri, 6 Jul 2018 06:11:02 -0700 (PDT) Received: from localhost ([::1]:57986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQVp-0007yZ-RJ for importer@patchew.org; Fri, 06 Jul 2018 09:11:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fbQRZ-0004xc-R0 for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fbQRX-0005RK-Vu for qemu-devel@nongnu.org; Fri, 06 Jul 2018 09:06:37 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:56938 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 1fbQRR-0005NJ-Gi; Fri, 06 Jul 2018 09:06:29 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 246CB4022414; Fri, 6 Jul 2018 13:06:29 +0000 (UTC) Received: from localhost (dhcp-192-215.str.redhat.com [10.33.192.215]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0F802026D68; Fri, 6 Jul 2018 13:06:28 +0000 (UTC) From: Cornelia Huck To: Kevin Wolf , Max Reitz Date: Fri, 6 Jul 2018 15:06:20 +0200 Message-Id: <20180706130620.5647-5-cohuck@redhat.com> In-Reply-To: <20180706130620.5647-1-cohuck@redhat.com> References: <20180706130620.5647-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 06 Jul 2018 13:06:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 06 Jul 2018 13:06:29 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@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] [PATCH for-3.0 4/4] Revert "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: Peter Maydell , qemu-block@nongnu.org, Cornelia Huck , qemu-devel@nongnu.org, Christian Borntraeger 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" This reverts commit a7aff6dd10b16b67e8b142d0c94c5d92c3fe88f6. Hold off removing this for one more QEMU release (current libvirt release still uses it.) Signed-off-by: Cornelia Huck --- blockdev.c | 75 +++++++++++++++++++++++++++++++++++++++++++= +++- hmp-commands.hx | 1 + hw/block/block.c | 14 +++++++++ include/sysemu/blockdev.h | 1 + qemu-doc.texi | 5 ++++ qemu-options.hx | 7 ++++- tests/hd-geo-test.c | 37 ++++++++++++++++++----- 7 files changed, 131 insertions(+), 9 deletions(-) diff --git a/blockdev.c b/blockdev.c index c23587b075..dcf8c8d2ab 100644 --- a/blockdev.c +++ b/blockdev.c @@ -730,6 +730,22 @@ QemuOptsList qemu_legacy_drive_opts =3D { .name =3D "if", .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, @@ -776,6 +792,7 @@ 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; @@ -786,7 +803,7 @@ DriveInfo *drive_new(QemuOpts *all_opts, BlockInterface= Type block_default_type) Error *local_err =3D NULL; int i; const char *deprecated[] =3D { - "serial", "addr" + "serial", "trans", "secs", "heads", "cyls", "addr" }; =20 /* Change legacy command line options into QMP ones */ @@ -915,6 +932,57 @@ 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); @@ -1037,6 +1105,11 @@ 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/hmp-commands.hx b/hmp-commands.hx index c1fc747403..91dfe51c37 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1306,6 +1306,7 @@ 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/hw/block/block.c b/hw/block/block.c index b6c80ab0b7..b91e2b6d7e 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -108,6 +108,20 @@ 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/include/sysemu/blockdev.h b/include/sysemu/blockdev.h index 37ea39719e..ac22f2ae1f 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -35,6 +35,7 @@ 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/qemu-doc.texi b/qemu-doc.texi index ae5531a053..0fbf8b108b 100644 --- a/qemu-doc.texi +++ b/qemu-doc.texi @@ -2887,6 +2887,11 @@ 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 df248d1568..654e69cc3b 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -804,8 +804,9 @@ 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" - " [,snapshot=3Don|off][,serial=3Ds][,addr=3DA][,rerror=3Dignore|= stop|report]\n" + " [,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" @@ -846,6 +847,10 @@ 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}). diff --git a/tests/hd-geo-test.c b/tests/hd-geo-test.c index ce665f1f83..24870b38f4 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) + MBRcontents mbr, const char *opts) { 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", s1, s2, s3)); + g_strdup_printf("%s%s%s%s", s1, s2, s3, opts)); 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,12 +327,16 @@ 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,%scyls=3D%d,heads=3D%d,secs=3D%d", - dev, trans ? "bios-chs-trans=3Dlba," : "", + opts =3D g_strdup_printf("%s,%s%scyls=3D%d,heads=3D%d,secs=3D%d", + dev ?: "", + trans && dev ? "bios-chs-" : "", + trans ? "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, opts, backend_small, mbr_= chs); + argc =3D setup_ide(argc, argv, ARGV_SIZE, + 0, dev ? opts : NULL, backend_small, mbr_chs, + dev ? "" : opts); g_free(opts); args =3D g_strjoinv(" ", argv); qtest_start(args); @@ -342,6 +346,22 @@ static void test_ide_drive_user(const char *dev, bool = trans) qtest_end(); } =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 */ @@ -372,7 +392,8 @@ 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_bl= ank); + argc =3D setup_ide(argc, argv, ARGV_SIZE, + ide_idx, NULL, i, mbr_blank, ""); } args =3D g_strjoinv(" ", argv); qtest_start(args); @@ -401,6 +422,8 @@ 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); --=20 2.14.4