From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47456) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQlFT-0002HX-NV for qemu-devel@nongnu.org; Tue, 02 Feb 2016 19:24:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQlFS-0000vm-Ix for qemu-devel@nongnu.org; Tue, 02 Feb 2016 19:24:43 -0500 References: <1454417864-18774-1-git-send-email-berrange@redhat.com> <1454417864-18774-3-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56B148C0.1020704@redhat.com> Date: Tue, 2 Feb 2016 17:24:32 -0700 MIME-Version: 1.0 In-Reply-To: <1454417864-18774-3-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="n8vKNrTKvLXXoIhVgsjBek9Ib1MWDCldT" Subject: Re: [Qemu-devel] [PATCH v5 02/10] qemu-img: add support for --object command line arg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Markus Armbruster , qemu-block@nongnu.org, =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --n8vKNrTKvLXXoIhVgsjBek9Ib1MWDCldT Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 02/02/2016 05:57 AM, Daniel P. Berrange wrote: > Allow creation of user creatable object types with qemu-img > via a new --object command line arg. This will be used to supply > passwords and/or encryption keys to the various block driver > backends via the recently added 'secret' object type. >=20 > # printf letmein > mypasswd.txt > # qemu-img info --object secret,id=3Dsec0,file=3Dmypasswd.txt \ > ...other info args... >=20 > Signed-off-by: Daniel P. Berrange > --- > qemu-img-cmds.hx | 44 ++++----- > qemu-img.c | 269 +++++++++++++++++++++++++++++++++++++++++++++++= ++++++-- > qemu-img.texi | 8 ++ > 3 files changed, 291 insertions(+), 30 deletions(-) >=20 > +++ b/qemu-img.c > @@ -94,6 +97,10 @@ static void QEMU_NORETURN help(void) > "\n" > "Command parameters:\n" > " 'filename' is a disk image filename\n" > + " 'objectdef' is a QEMU user creatable object definition. = See the @code{qemu(1)}\n" Drop @code; this is the --help text. > + " manual page for a description of the object properties= =2E The common object\n" > + " type that it makes sense to define is 'secret' object,= which is used to\n" s/is/is a/ or maybe go for something shorter: The most common object type is a 'secret', which is used... or match the text you put in the info: The only object type that it makes sense to define is the 'secret' object, which is used... > @@ -275,7 +291,14 @@ static int img_create(int argc, char **argv) > bool quiet =3D false; > =20 > for(;;) { > - c =3D getopt(argc, argv, "F:b:f:he6o:q"); > + int option_index =3D 0; > + static const struct option long_options[] =3D { > + {"help", no_argument, 0, 'h'}, > + {"object", required_argument, 0, OPTION_OBJECT}, > + {0, 0, 0, 0} > + }; > + c =3D getopt_long(argc, argv, "F:b:f:he6o:q", > + long_options, &option_index); Can't you pass NULL for the last parameter, if you aren't going to use option_index in your error reporting? > @@ -675,7 +730,14 @@ static int img_commit(int argc, char **argv) > cache =3D BDRV_DEFAULT_CACHE; > base =3D NULL; > for(;;) { > - c =3D getopt(argc, argv, "f:ht:b:dpq"); > + int option_index =3D 0; > + static const struct option long_options[] =3D { > + {"help", no_argument, 0, 'h'}, > + {"object", required_argument, 0, OPTION_OBJECT}, > + {0, 0, 0, 0} > + }; > + c =3D getopt_long(argc, argv, "f:ht:b:dpq", > + long_options, &option_index); more than once. I'll quit pointing it out. Doesn't affect behavior either way. > +++ b/qemu-img.texi > @@ -24,6 +24,14 @@ Command parameters: > @table @var > @item filename > is a disk image filename > + > +@item --object @var{objectdef} > + > +is a QEMU user creatable object definition. See the @code{qemu(1)} man= ual > +page for a description of the object properties. The only object type = that > +it makes sense to define is the @code{secret} object, which is used to= > +supply passwords and/or encryption keys. With the help text fixed, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --n8vKNrTKvLXXoIhVgsjBek9Ib1MWDCldT 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/ iQEcBAEBCAAGBQJWsUjAAAoJEKeha0olJ0Nq6hsH/i2SOI2kQGLllc2pJV+OjxbL 387jxc4MQs0A7G0BbDw68/P/yuajI/iAaSeELTI83qsno1NQ5gTrD8xtdp2fMXjH tAHLKlSCggc5s3PCGBkovjQv4vVuYCz9z0dwkZBlouOa040DUyv2bNAdozGTRvWS zWOoWm9gEwV/j4HGburMVhZeJT5jt8vM22+fNUXjncfKzeN1lPVEOjLsvXEjhCj7 E3QVm0d3h42qS8Cihih1UfjrPpnz2Je2oKJlKlzqe0FuIoA9Y2iqFBzQswdSDF9B uD0o90DzCauFGMiaCcoS/vRybAStUQhAvnVKUGs3PfHtAY0XWuepvK+qf0CgnMM= =RuM4 -----END PGP SIGNATURE----- --n8vKNrTKvLXXoIhVgsjBek9Ib1MWDCldT--