From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMekU-0005J2-NO for qemu-devel@nongnu.org; Fri, 22 Jan 2016 11:39:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMekT-0001dx-KT for qemu-devel@nongnu.org; Fri, 22 Jan 2016 11:39:46 -0500 References: <1453375338-13508-1-git-send-email-rudyflyzhang@gmail.com> <1453375338-13508-2-git-send-email-rudyflyzhang@gmail.com> <56A109D1.4000701@redhat.com> From: Eric Blake Message-ID: <56A25B4A.90702@redhat.com> Date: Fri, 22 Jan 2016 09:39:38 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Ql5UvaHQ53ughBhlSIPCVQHDN55GCaO3A" Subject: Re: [Qemu-devel] [PATCH 1/2] hmp: add hmp command for incremental backup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?5byg5pWP?= , qemu-devel@nongnu.org Cc: famz@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Ql5UvaHQ53ughBhlSIPCVQHDN55GCaO3A Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/21/2016 07:04 PM, =E5=BC=A0=E6=95=8F wrote: >>> - .args_type =3D "reuse:-n,full:-f,device:B,target:s,format:s= ?", >>> - .params =3D "[-n] [-f] device target [format]", >>> + .args_type =3D "reuse:-n,full:-f,device:B,target:s,bitmap:s= ?,format:s?", >>> + .params =3D "[-n] [-f] device target [bitmap] [format]",= >> This is HMP, so it may not matter, but this is not backwards compatibl= e. >> Scripts targetting the old style of passing a format will now have t= hat >> format string interpreted as a bitmap name with no format. Better wou= ld >> be to stick [bitmap] at the end, not the middle. >=20 > But I have a question: If I don't want to input a 'format', only use 'b= itmap', > it will let 'bitmap' as 'format', This problem how to do it. Several solutions, some nicer than others, some more complicated than others. I don't have any strong preference, so much as pointing out the design space: 1. You don't. If you want to use 'bitmap', you MUST supply 'format' (supplying format is good anyways, as implicit formats have led to CVEs in the past). 1.a. Possible variation: Teach the command to allow empty '' format to be a synonym for an implicit format, so that it could look like: drive_backup device target '' /path/to/bitmap 2. You modify the HMP parser to accept optionally-named arguments, so that you can then supply later optional arguments by name without having to provide the earlier optional arguments. Maybe looking something like:= drive_backup device target --bitmap=3D/path/to/bitmap 3. Instead of trying to overload an existing command, you create a new command. Particularly since your overload already declared that '-f' and 'bitmap' are incompatible. 4. maybe something else? >> Needs {}. Run your patch through scripts/checkpatch.pl, to flag this >> and other style violations. >=20 > I have checked these patches=EF=BC=8Cbut I ignored these warnings. Not a good idea. And even in the rare case that you plan on ignoring the warnings, you should at least document in the commit message your justification for doing so. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Ql5UvaHQ53ughBhlSIPCVQHDN55GCaO3A 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/ iQEcBAEBCAAGBQJWoltKAAoJEKeha0olJ0NqHxgH/3FRXWoaghBCow1kQtlcP6z/ 3wF98E8DkSCsTASVlfrUNOu76P3FhPPygf0Ebi8h23/aqrXsCMLxVih+ltU7My4X MOkMVVxVrFMuWwVOuiHBZO2NpRJGqtK8E4OMAM0vF8cTpKLmQMtpbVmi39HLVLiO 1HUBceaYCGupxn0wBfepsz97mbfO34xrxXHPNHMV5mi32Tcq8nPdqknOcq1PvR3w dnHQOiq37pgiyMbSviaGfz+9BSnLXfLbb3HzPD1uT/AQq067Pum5FM8LKihWnL72 0wkqP77BUuaoCn2Bh8aVaIqL3kpudviWo5S1aqbTIMUI1qauWVxvB7qcsp0v834= =fa0F -----END PGP SIGNATURE----- --Ql5UvaHQ53ughBhlSIPCVQHDN55GCaO3A--