From: Anthony Liguori <anthony@codemonkey.ws>
To: Kevin Wolf <kwolf@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-char: Print strerror message on failure
Date: Wed, 22 Jun 2011 12:24:46 -0500 [thread overview]
Message-ID: <4E02255E.40202@codemonkey.ws> (raw)
In-Reply-To: <4E00C471.3060802@redhat.com>
On 06/21/2011 11:18 AM, Kevin Wolf wrote:
> Am 21.06.2011 18:09, schrieb Markus Armbruster:
>> Kevin Wolf<kwolf@redhat.com> writes:
>>
>>> The only way for chardev drivers to communicate an error was to return a NULL
>>> pointer, which resulted in an error message that said _that_ something went
>>> wrong, but not _why_.
>>>
>>> This patch changes the interface to return 0/-errno and updates
>>> qemu_chr_open_opts to use strerror to display a more helpful error message.
>>
>> Returning the result through a pointer is awkward. What about stuffing
>> the error code into errno?
>
> I generally like it better to return error codes explicitly instead of
> storing them in some global variable where it tends to be trampled over
> before you print the message. But if people prefer it that way, I can
> redo the patch.
I think passing a pointer to an int to receive the error is best. That
way a NULL can be passed to indicate that the caller doesn't care.
This matches the Error model that we're proposing else where.
Regards,
Anthony Liguori
>
> Kevin
>
next prev parent reply other threads:[~2011-06-22 17:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-01 11:29 [Qemu-devel] [PATCH] qemu-char: Print strerror message on failure Kevin Wolf
2011-06-21 15:33 ` Kevin Wolf
2011-06-21 16:09 ` Markus Armbruster
2011-06-21 16:18 ` Kevin Wolf
2011-06-22 17:24 ` Anthony Liguori [this message]
2011-07-23 16:53 ` Anthony Liguori
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=4E02255E.40202@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=kwolf@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 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).