From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34449) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBQDj-0001Qr-6R for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:55:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBQDc-0001T5-WF for qemu-devel@nongnu.org; Tue, 22 Dec 2015 11:55:30 -0500 References: <1450782389-17326-1-git-send-email-berrange@redhat.com> <1450782389-17326-5-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56798075.50005@redhat.com> Date: Tue, 22 Dec 2015 09:55:17 -0700 MIME-Version: 1.0 In-Reply-To: <1450782389-17326-5-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rsWg4hpquBSSdr3aMToW7OOxblM4bE0u6" Subject: Re: [Qemu-devel] [PATCH 4/7] qemu-io: 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) --rsWg4hpquBSSdr3aMToW7OOxblM4bE0u6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/22/2015 04:06 AM, Daniel P. Berrange wrote: > Allow creation of user creatable object types with qemu-io > via a --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 > # echo -n letmein > mypasswd.txt > # qemu-io --object secret,id=3Dsec0,file=3Dmypasswd.txt \ > ...other args... Same comments as on 3/7. >=20 > Signed-off-by: Daniel P. Berrange > --- > qemu-io.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > 1 file changed, 87 insertions(+) > @@ -205,6 +207,9 @@ static void usage(const char *name) > "Usage: %s [-h] [-V] [-rsnm] [-f FMT] [-c STRING] ... [file]\n" > "QEMU Disk exerciser\n" > "\n" > +" --object OBJECTDEF define a object such as 'secret' for\n" s/a object/an object/ > +" providing passwords and/or encryption\n" > +" keys\n" 3 lines feels long; you got away with only 2 lines in 3/7 by using longer line wrapping, while still fitting in the user's 80 column output:= +" --object type,id=3DID,... define an object such as 'secret' for providing\n" +" passwords and/or encryption keys\n" > =20 > +enum { > + OPTION_OBJECT =3D 258, > +}; 256 would work. But 258 doesn't hurt. > +static int object_create(void *opaque, QemuOpts *opts, Error **errp) > +{ > + Error *err =3D NULL; > + char *type =3D NULL; > + char *id =3D NULL; > + void *dummy =3D NULL; > + OptsVisitor *ov; > + QDict *pdict; > + > + ov =3D opts_visitor_new(opts); > + pdict =3D qemu_opts_to_qdict(opts, NULL); > + > + visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &e= rr); Same comments as on 3/7. We now have 5 very similar functions (hmp.c, vl.c, and your three additions); should this be factored into a common reusable function rather than open-coding it into each client? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --rsWg4hpquBSSdr3aMToW7OOxblM4bE0u6 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/ iQEcBAEBCAAGBQJWeYB1AAoJEKeha0olJ0NqTIIH/ArsZMaPeg4r7B8qP0oR2Xji CIfYhjnm7/QiBkvdMHSmehYhT4PRzznU1NNxPlbfhX7urKdH21G8bHWQQkwGRXw5 uhj7XjjryNngkrvx+/Mje0TeNGRUqGWOMl6SyRuz2J0R9UY2ArxxPd3mS+10PrPM HfyNKtbLs/SbC+fvjqF+g/wtVJUbWbBG9QgDde2vCpSEWFP1hcmQn5PlbLUVrihe DMobPHGIFaZ2dRCDgnmEzhYJkJCx7P0jm7OwhL66kKODpSYqhdJev82yo1e0PXGc 4NPyb2NZc12TZ13lzwWN1TN7fvBrLyA7CBMlsCf4twr8YlH0QWfTm6YLXGEYedQ= =H0yh -----END PGP SIGNATURE----- --rsWg4hpquBSSdr3aMToW7OOxblM4bE0u6--