From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58359) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bQNHi-0000vR-EO for qemu-devel@nongnu.org; Thu, 21 Jul 2016 19:21:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bQNHh-00082U-8P for qemu-devel@nongnu.org; Thu, 21 Jul 2016 19:21:42 -0400 References: <1469130019-18497-1-git-send-email-den@openvz.org> <1469130019-18497-12-git-send-email-den@openvz.org> From: Eric Blake Message-ID: <579158FC.9080402@redhat.com> Date: Thu, 21 Jul 2016 17:21:32 -0600 MIME-Version: 1.0 In-Reply-To: <1469130019-18497-12-git-send-email-den@openvz.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="GtjmN42oUChtnN96si9BNMMjcjprGaAV8" Subject: Re: [Qemu-devel] [PATCH v6 11/16] block: simplify drive-backup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Pavel Butsykin , Jeff Cody , Markus Armbruster , John Snow , Stefan Hajnoczi , Kevin Wolf This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GtjmN42oUChtnN96si9BNMMjcjprGaAV8 From: Eric Blake To: "Denis V. Lunev" , qemu-block@nongnu.org, qemu-devel@nongnu.org Cc: Pavel Butsykin , Jeff Cody , Markus Armbruster , John Snow , Stefan Hajnoczi , Kevin Wolf Message-ID: <579158FC.9080402@redhat.com> Subject: Re: [PATCH v6 11/16] block: simplify drive-backup References: <1469130019-18497-1-git-send-email-den@openvz.org> <1469130019-18497-12-git-send-email-den@openvz.org> In-Reply-To: <1469130019-18497-12-git-send-email-den@openvz.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/21/2016 01:40 PM, Denis V. Lunev wrote: > From: Pavel Butsykin >=20 > Now that we can support boxed commands, use it to greatly reduce the > number of parameters (and likelihood of getting out of sync) when > adjusting drive-backup parameters.. s/.././ >=20 > Signed-off-by: Pavel Butsykin > Reviewed-by: Stefan Hajnoczi > Signed-off-by: Denis V. Lunev > CC: Jeff Cody > CC: Markus Armbruster > CC: Eric Blake > CC: John Snow > CC: Stefan Hajnoczi > CC: Kevin Wolf > --- > blockdev.c | 115 +++++++++++++++++--------------------------= -------- > hmp.c | 29 ++++++++----- > qapi/block-core.json | 3 +- > 3 files changed, 58 insertions(+), 89 deletions(-) >=20 > +++ b/hmp.c > @@ -1109,8 +1109,24 @@ void hmp_drive_backup(Monitor *mon, const QDict = *qdict) > const char *format =3D qdict_get_try_str(qdict, "format"); > bool reuse =3D qdict_get_try_bool(qdict, "reuse", false); > bool full =3D qdict_get_try_bool(qdict, "full", false); > - enum NewImageMode mode; > Error *err =3D NULL; > + DriveBackup backup =3D { > + .device =3D (char *)device, > + .target =3D (char *)filename, > + .has_format =3D !!format, > + .format =3D (char *)format, > + .sync =3D full ? MIRROR_SYNC_MODE_FULL : MIRROR_SYNC_MODE_TOP,= > + .has_mode =3D true, > + .mode =3D reuse ? NEW_IMAGE_MODE_EXISTING : NEW_IMAGE_MODE_ABS= OLUTE_PATHS, Good. > + .has_speed =3D false, > + .speed =3D 0, > + .has_bitmap =3D false, > + .bitmap =3D NULL, > + .has_on_source_error =3D false, > + .on_source_error =3D 0, > + .has_on_target_error =3D false, > + .on_target_error =3D 0, I'd drop these. C guarantees that they'll be zero-initialized, and unless HMP has a way to set them to non-default values, it's not worth wasting the lines of code. With those fixups, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --GtjmN42oUChtnN96si9BNMMjcjprGaAV8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXkVj8AAoJEKeha0olJ0Nq3z8H/2t2hL6AAbFJk4cEt+h7Xw6v LZG4eQoM4GIagrVFTahQNGp6SSDkH7wnfxQpQBwN6d6vm9QZD/Ckd0x9PLHdR9pQ WiHCuB20s3ozIBXRZ6x4UNb5IiB53uan2CnoXB1B9eDrwt+YtvqbtOhFR+BwwF3A 6sBaYhzQUkr600YFeXubPHm/PVNVjDxf9IWyxlZAGSOZVCE8obe0rUkxwNygqHNN HTCuFxJXtweRrdOpdSNznSgF1fQT3XPC2V40cOKGlTlUtJgB/v/C2OZBP6U/RZ76 1ycykP6Lg034dIKHAp/md2cVi66UdOFsipYG40O0cJ9Pm6W6jf/yc+RNc6Lik5s= =9vQ5 -----END PGP SIGNATURE----- --GtjmN42oUChtnN96si9BNMMjcjprGaAV8--