From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58378) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPC0K-0001fE-13 for qemu-devel@nongnu.org; Fri, 19 Oct 2012 08:48:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TPC0F-0000uN-79 for qemu-devel@nongnu.org; Fri, 19 Oct 2012 08:48:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TPC0E-0000uH-TJ for qemu-devel@nongnu.org; Fri, 19 Oct 2012 08:48:39 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9JCmctq028031 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 19 Oct 2012 08:48:38 -0400 Date: Fri, 19 Oct 2012 09:49:33 -0300 From: Luiz Capitulino Message-ID: <20121019094933.04f8d5eb@doriath.home> In-Reply-To: <508119C3.4010406@redhat.com> References: <1350502556-4885-1-git-send-email-lcapitulino@redhat.com> <1350502556-4885-3-git-send-email-lcapitulino@redhat.com> <507FEEB9.7050302@redhat.com> <20121018103330.132f1366@doriath.home> <20121018141838.61d53a41@doriath.home> <508119C3.4010406@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/8] block: bdrv_img_create(): add param_list argument List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com On Fri, 19 Oct 2012 11:13:39 +0200 Kevin Wolf wrote: > Am 18.10.2012 19:18, schrieb Luiz Capitulino: > > On Thu, 18 Oct 2012 10:33:30 -0300 > > Luiz Capitulino wrote: > > > >> On Thu, 18 Oct 2012 13:57:45 +0200 > >> Kevin Wolf wrote: > >> > >>> Am 17.10.2012 21:35, schrieb Luiz Capitulino: > >>>> If set returns a copy of the parameter list used by the block driver > >>>> to create the new image. > >>>> > >>>> Signed-off-by: Luiz Capitulino > >>>> --- > >>>> block.c | 7 ++++++- > >>>> block.h | 3 ++- > >>>> blockdev.c | 2 +- > >>>> qemu-img.c | 2 +- > >>>> 4 files changed, 10 insertions(+), 4 deletions(-) > >>>> > >>>> diff --git a/block.c b/block.c > >>>> index e95f613..254a5c2 100644 > >>>> --- a/block.c > >>>> +++ b/block.c > >>>> @@ -4294,7 +4294,8 @@ bdrv_acct_done(BlockDriverState *bs, BlockAcctCookie *cookie) > >>>> > >>>> int bdrv_img_create(const char *filename, const char *fmt, > >>>> const char *base_filename, const char *base_fmt, > >>>> - char *options, uint64_t img_size, int flags) > >>>> + char *options, uint64_t img_size, int flags, > >>>> + QEMUOptionParameter **param_list) > >>>> { > >>>> QEMUOptionParameter *param = NULL, *create_options = NULL; > >>>> QEMUOptionParameter *backing_fmt, *backing_file, *size; > >>>> @@ -4430,6 +4431,10 @@ int bdrv_img_create(const char *filename, const char *fmt, > >>>> } > >>>> > >>>> out: > >>>> + if (param_list && ret == 0) { > >>>> + *param_list = append_option_parameters(NULL, param); > >>>> + } > >>> > >>> If you put this above the out: label, the ret == 0 check wouldn't be > >>> necessary. > >> > >> I'll maintain it it there but will drop the ret check, so that we're > >> able to return the options on error too and thus keep the "Formatting" > >> message the way it's today. > > > > Actually my idea didn't work. I can think of the following options: > > > > 1. Change it to "Formatted" as you suggested. Cons: will only be > > printed after the image is created > > > > 2. Print "Formatting 'foo', 'qcow2' " before the image is created > > and the options afterwards. Cons: weird? > > > > 3. Don't change this. Cons: will keep spitting stuff to stdout while in > > QMP > > > > I think we should do 2. > > How about leaving the code printing the message where it is, but putting > an if (!cur_mon) around it? So ugly that I prefer to drop this patch from my series and revisit this later :)