From nobody Sat Apr 12 03:41:05 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 1529074015010146.6678119461086; Fri, 15 Jun 2018 07:46:55 -0700 (PDT) Received: from localhost ([::1]:47282 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTq06-0003AO-4c for importer@patchew.org; Fri, 15 Jun 2018 10:46:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fTpbn-0006LV-54 for qemu-devel@nongnu.org; Fri, 15 Jun 2018 10:21:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fTpbg-0003sm-Ba for qemu-devel@nongnu.org; Fri, 15 Jun 2018 10:21:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54424 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 1fTpbb-0003mZ-5B; Fri, 15 Jun 2018 10:21:35 -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 BC82440122A1; Fri, 15 Jun 2018 14:21:34 +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 17AC463A51; Fri, 15 Jun 2018 14:21:33 +0000 (UTC) From: Kevin Wolf To: qemu-block@nongnu.org Date: Fri, 15 Jun 2018 16:21:07 +0200 Message-Id: <20180615142108.27814-26-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.5]); Fri, 15 Jun 2018 14:21:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 15 Jun 2018 14:21:34 +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 25/26] 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: 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 option serial was deprecated in QEMU 2.10. It's time to remove it. Tests need to be updated to set the serial number with -global instead of using the -drive option. Signed-off-by: Kevin Wolf Reviewed-by: Markus Armbruster Reviewed-by: Jeff Cody --- include/hw/block/block.h | 1 - include/sysemu/blockdev.h | 1 - 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 - tests/ahci-test.c | 6 +++--- tests/ide-test.c | 8 ++++---- qemu-doc.texi | 5 ----- qemu-options.hx | 6 +----- 14 files changed, 8 insertions(+), 48 deletions(-) diff --git a/include/hw/block/block.h b/include/hw/block/block.h index d4f4dfffab..e9f9e2223f 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -72,7 +72,6 @@ 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 c0ae3700ec..24954b94e0 100644 --- a/include/sysemu/blockdev.h +++ b/include/sysemu/blockdev.h @@ -35,7 +35,6 @@ struct DriveInfo { bool is_default; /* Added by default_drive() ? */ int media_cd; QemuOpts *opts; - char *serial; QTAILQ_ENTRY(DriveInfo) next; }; =20 diff --git a/block/block-backend.c b/block/block-backend.c index d55c328736..2d1a3463e8 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -419,7 +419,6 @@ 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 2984e400c2..d1ab425085 100644 --- a/blockdev.c +++ b/blockdev.c @@ -731,10 +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 "serial", - .type =3D QEMU_OPT_STRING, - .help =3D "disk serial number", - },{ .name =3D "file", .type =3D QEMU_OPT_STRING, .help =3D "file name", @@ -776,12 +772,10 @@ 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 */ @@ -949,9 +943,6 @@ 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; @@ -1026,7 +1017,6 @@ 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 b6c80ab0b7..cf0eb826f1 100644 --- a/hw/block/block.c +++ b/hw/block/block.c @@ -15,19 +15,6 @@ #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 811084b6a7..d5bf95b79b 100644 --- a/hw/block/nvme.c +++ b/hw/block/nvme.c @@ -1215,7 +1215,6 @@ 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 50b5c869e3..225fe44b7a 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -935,7 +935,6 @@ 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 f395d24592..573b022e1e 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -188,7 +188,6 @@ 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 ded23d36ca..aeaf611854 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2368,7 +2368,6 @@ 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 481694a473..47b992f403 100644 --- a/hw/usb/dev-storage.c +++ b/hw/usb/dev-storage.c @@ -606,7 +606,6 @@ 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/tests/ahci-test.c b/tests/ahci-test.c index 1a7b761304..937ed2f910 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,= serial=3D%s" - ",format=3D%s" + cli =3D "-drive if=3Dnone,id=3Ddrive0,file=3D%s,cache=3Dwriteback,= 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, "testdisk", imgfmt, "version"); + s =3D ahci_boot(cli, tmp_path, imgfmt, "testdisk", "version"); } =20 return s; diff --git a/tests/ide-test.c b/tests/ide-test.c index 2384c2c3e2..f39431b1a9 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,serial=3D%s,cache=3Dwriteback,format=3D= raw " - "-global ide-hd.ver=3D%s", + "-drive file=3D%s,if=3Dide,cache=3Dwriteback,format=3Draw " + "-global ide-hd.serial=3D%s -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,serial=3D%s,cache=3Dwriteback,format=3D= raw " - "-global ide-hd.ver=3D%s", + "-drive file=3D%s,if=3Dide,cache=3Dwriteback,format=3Draw " + "-global ide-hd.serial=3D%s -global ide-hd.ver=3D%s", tmp_path, "testdisk", "version"); =20 dev =3D get_pci_device(&bmdma_bar, &ide_bar); diff --git a/qemu-doc.texi b/qemu-doc.texi index 338477725f..282bc3dc35 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 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 c2531e2f3c..d5b0c26e8e 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][,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,10 +879,6 @@ 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), --=20 2.13.6