qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>,
	Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel qemu-devel <qemu-devel@nongnu.org>,
	Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v9] block/raw-posix.c: Make physical devices usable in QEMU under Mac OS X host
Date: Mon, 30 Nov 2015 09:49:35 -0700	[thread overview]
Message-ID: <565C7E1F.7080503@redhat.com> (raw)
In-Reply-To: <DEF1CD70-810F-4483-A3A5-7656D7B32189@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1551 bytes --]

On 11/30/2015 09:38 AM, Programmingkid wrote:

>>>>>> +    /* if a working partition on the device was not found */
>>>>>> +    if (partition_found == false) {
>>>>>> +        error_setg(errp, "Error: Failed to find a working partition on "
>>>>>> +                                                                     "disc!\n");
>>>>>
>>>>> and I already pointed out on v8 that this is not the correct usage of
>>>>> error_setg().  So, here's hoping v10 addresses the comments here and
>>>>> elsewhere.
>>>>
>>>> Kevin Wolf wanted it this way. What would you do instead?
>>>
>>> Keven and I both want you to use error_setg(), but to use it correctly -
>>> and the correct way is to NOT supply a trailing \n.
>>
>> Nor leading "Error:", for that matter.
> 
> I just think that using "Error" does communicate the fact that something is wrong
> a lot better than just printing the message. 

But error_setg() _already_ provides the context that an error message is
being printed.  The whole point of using wrapper functions is that the
common functionality (like an 'error:' prefix, or '\n' suffix) is done
in the wrapper, not at every call site.  If you were using raw printf(),
then yes, using your own 'Error:' prefix would be appropriate.  But we
aren't using raw printf().  Your use of an 'Error:' prefix is therefore
redundant, and we are trying to convince you that you are using
error_setg() incorrectly.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

      reply	other threads:[~2015-11-30 16:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-26  4:10 [Qemu-devel] [PATCH v9] block/raw-posix.c: Make physical devices usable in QEMU under Mac OS X host Programmingkid
2015-11-26  4:23 ` Eric Blake
2015-11-26  4:29   ` Eric Blake
2015-11-27 21:24     ` Programmingkid
2015-11-27 19:35   ` Programmingkid
2015-11-30 16:19     ` Eric Blake
2015-11-30 16:26       ` Kevin Wolf
2015-11-30 16:38         ` Programmingkid
2015-11-30 16:49           ` Eric Blake [this message]

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=565C7E1F.7080503@redhat.com \
    --to=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=programmingkidx@gmail.com \
    --cc=qemu-block@nongnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).