From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQuNY-0002s3-UK for qemu-devel@nongnu.org; Wed, 03 Feb 2016 05:09:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQuNX-0001iO-Mj for qemu-devel@nongnu.org; Wed, 03 Feb 2016 05:09:40 -0500 Date: Wed, 3 Feb 2016 10:09:30 +0000 From: "Daniel P. Berrange" Message-ID: <20160203100930.GC30222@redhat.com> References: <1454417864-18774-1-git-send-email-berrange@redhat.com> <1454417864-18774-3-git-send-email-berrange@redhat.com> <56B148C0.1020704@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56B148C0.1020704@redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 02/10] qemu-img: add support for --object command line arg Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , qemu-block@nongnu.org, qemu-devel@nongnu.org, Markus Armbruster , Paolo Bonzini , Andreas =?utf-8?Q?F=C3=A4rber?= On Tue, Feb 02, 2016 at 05:24:32PM -0700, Eric Blake wrote: > 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. > > > > # printf letmein > mypasswd.txt > > # qemu-img info --object secret,id=sec0,file=mypasswd.txt \ > > ...other info args... > > > > 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(-) > > > > > +++ 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. 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 = false; > > > > for(;;) { > > - c = getopt(argc, argv, "F:b:f:he6o:q"); > > + int option_index = 0; > > + static const struct option long_options[] = { > > + {"help", no_argument, 0, 'h'}, > > + {"object", required_argument, 0, OPTION_OBJECT}, > > + {0, 0, 0, 0} > > + }; > > + c = 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? Oh, I didn't realize that it allowed NULL for that parameter. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|