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. > > # echo -n letmein > mypasswd.txt > # qemu-io --object secret,id=sec0,file=mypasswd.txt \ > ...other args...
Same comments as on 3/7. > > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > 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=ID,... define an object such as 'secret' for providing\n" +" passwords and/or encryption keys\n" > > +enum { > + OPTION_OBJECT = 258, > +}; 256 would work. But 258 doesn't hurt. > +static int object_create(void *opaque, QemuOpts *opts, Error **errp) > +{ > + Error *err = NULL; > + char *type = NULL; > + char *id = NULL; > + void *dummy = NULL; > + OptsVisitor *ov; > + QDict *pdict; > + > + ov = opts_visitor_new(opts); > + pdict = qemu_opts_to_qdict(opts, NULL); > + > + visit_start_struct(opts_get_visitor(ov), &dummy, NULL, NULL, 0, &err); 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? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature