From: Markus Armbruster <armbru@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Paul Brook <paul@codesourcery.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qdev: add return value to init() callbacks.
Date: Thu, 13 Aug 2009 11:06:41 +0200 [thread overview]
Message-ID: <87tz0cytem.fsf@pike.pond.sub.org> (raw)
In-Reply-To: <4A83C562.1090802@redhat.com> (Gerd Hoffmann's message of "Thu\, 13 Aug 2009 09\:48\:50 +0200")
Gerd Hoffmann <kraxel@redhat.com> writes:
> On 08/13/09 08:17, Markus Armbruster wrote:
>
>> One problem with passing up error codes is diagnostics: when we reach
>> the point where we can decide on policy, we've lost the context for
>> precise diagnostics. net.c tackles that problem by passing the
>> destination for diagnostics down, to let code report errors with
>> config_error() while remaining unaware of policy.
>
> I don't want pass additional arguments all the way down just for error
> reporting.
It sure is tedious and ugly.
> One thing we can do is storing the error message in a
> global or thread-local variable (much like errno). We could also add
> a errmsg field to DeviceState and use that.
>
>> Issue also exists elsewhere. Try monitor command "pci_add auto
>> model=?".
>
> Thats why I'd tend to use a global variable. It also works in case
> don't have a DeviceState.
I find stashing error messages for later printing rather awkward. Do
you provide space for one fixed-sized message? Or arbitrary length?
Arbitrary number of messages? Once you start to malloc(), you get to
worry about free()... Meh.
I'd rather use the global or thread-local state to hold the sink for the
messages, then send the messages there as we make them. No memory
management worries.
next prev parent reply other threads:[~2009-08-13 9:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-12 15:59 [Qemu-devel] [PATCH] qdev: add return value to init() callbacks Gerd Hoffmann
2009-08-12 17:00 ` Markus Armbruster
2009-08-12 19:28 ` Paul Brook
2009-08-12 19:47 ` Gerd Hoffmann
2009-08-13 6:17 ` Markus Armbruster
2009-08-13 7:48 ` Gerd Hoffmann
2009-08-13 9:06 ` Markus Armbruster [this message]
2009-08-13 11:05 ` Gerd Hoffmann
2009-08-13 11:42 ` Markus Armbruster
2009-08-13 14:31 ` Gerd Hoffmann
2009-08-13 17:22 ` Markus Armbruster
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=87tz0cytem.fsf@pike.pond.sub.org \
--to=armbru@redhat.com \
--cc=kraxel@redhat.com \
--cc=paul@codesourcery.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.