All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 5/8] qemu-img: img_create(): use Error object
Date: Thu, 18 Oct 2012 16:02:22 +0200	[thread overview]
Message-ID: <50800BEE.9010006@redhat.com> (raw)
In-Reply-To: <20121018104941.486f1404@doriath.home>

Am 18.10.2012 15:49, schrieb Luiz Capitulino:
> On Thu, 18 Oct 2012 14:11:40 +0200
> Kevin Wolf <kwolf@redhat.com> wrote:
> 
>> Am 17.10.2012 21:35, schrieb Luiz Capitulino:
>>> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
>>> ---
>>>  qemu-img.c | 10 +++++++---
>>>  1 file changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/qemu-img.c b/qemu-img.c
>>> index 12fb6c2..dfde588 100644
>>> --- a/qemu-img.c
>>> +++ b/qemu-img.c
>>> @@ -302,6 +302,7 @@ static int img_create(int argc, char **argv)
>>>      const char *base_filename = NULL;
>>>      char *options = NULL;
>>>      QEMUOptionParameter *params = NULL;
>>> +    Error *local_err = NULL;
>>>  
>>>      for(;;) {
>>>          c = getopt(argc, argv, "F:b:f:he6o:");
>>> @@ -362,9 +363,12 @@ static int img_create(int argc, char **argv)
>>>          goto out;
>>>      }
>>>  
>>> -    ret = bdrv_img_create(filename, fmt, base_filename, base_fmt,
>>> -                          options, img_size, BDRV_O_FLAGS, &params, NULL);
>>> -    if (ret < 0) {
>>> +    bdrv_img_create(filename, fmt, base_filename, base_fmt,
>>> +                    options, img_size, BDRV_O_FLAGS, &params, &local_err);
>>> +    if (error_is_set(&local_err)) {
>>> +        fprintf(stderr, "qemu-img: %s\n", error_get_pretty(local_err));
>>
>> This should use error_report() instead of adding the "qemu-img:" manually.
> 
> If you want to do it for consistency with the current code then ok,
> I'll do it for v2. But I disagree qemu-img should keep using error_report(),
> printing to hmp for example is something beyond the interests of a tool like
> qemu-img.

qemu-img doesn't have an HMP monitor, so it doesn't hurt either. If you
want to replace it, replace it with a copy of qemu-error.c that only
removes the monitor_vprintf() case. That is, in particular, leave all of
the loc_*() functionality there, because this is something that is meant
for use in command line parsers.

That qemu-img doesn't use these functions yet should be fixed. It has
some good use cases for them.

Kevin

  reply	other threads:[~2012-10-18 14:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-17 19:35 [Qemu-devel] [PATCH 0/8] block: bdrv_img_create(): propagate errors Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 1/8] error: add error_set_errno and error_setg_errno Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 2/8] block: bdrv_img_create(): add param_list argument Luiz Capitulino
2012-10-18 11:57   ` Kevin Wolf
2012-10-18 13:33     ` Luiz Capitulino
2012-10-18 17:18       ` Luiz Capitulino
2012-10-19  9:13         ` Kevin Wolf
2012-10-19 12:49           ` Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 3/8] block: bdrv_img_create(): move parameter list printing to qemu-img Luiz Capitulino
2012-10-18 12:01   ` Kevin Wolf
2012-10-18 12:16     ` Kevin Wolf
2012-10-18 13:34       ` Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 4/8] block: bdrv_img_create(): add Error ** argument Luiz Capitulino
2012-10-18 12:08   ` Kevin Wolf
2012-10-18 13:41     ` Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 5/8] qemu-img: img_create(): use Error object Luiz Capitulino
2012-10-18 12:11   ` Kevin Wolf
2012-10-18 13:49     ` Luiz Capitulino
2012-10-18 14:02       ` Kevin Wolf [this message]
2012-10-23  9:58         ` Markus Armbruster
2012-10-23 10:08           ` Kevin Wolf
2012-10-23 13:07             ` Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 6/8] qemu-img: img_create(): simplify Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 7/8] qmp: qmp_transaction(): pass Error object to bdrv_img_create() Luiz Capitulino
2012-10-17 19:35 ` [Qemu-devel] [PATCH 8/8] block: bdrv_img_create(): drop unused error handling code Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50800BEE.9010006@redhat.com \
    --to=kwolf@redhat.com \
    --cc=armbru@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.