qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, anthony@codemonkey.ws
Subject: Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new
Date: Thu, 24 May 2012 16:31:01 +0200	[thread overview]
Message-ID: <4FBE4625.9040703@suse.de> (raw)
In-Reply-To: <m37gw1eknl.fsf@blackfin.pond.sub.org>

Am 24.05.2012 16:08, schrieb Markus Armbruster:
> Andreas Färber <afaerber@suse.de> writes:
> 
>> Am 24.05.2012 13:43, schrieb Markus Armbruster:
>>> Beware: second patch is the product of voodoo-coding.
>>
>> Hm, I don't like the voodoo. ;) I would rather expose a proper C API
>> like object_try_new(const char *, Error **) than opening up the TypeImpl
>> internals to the public and hand-coding it everywhere.
> 
> How does returning a TypeImpl * open up TypeImpl any more than
> type_register() already does?

type_register[_static]() operates on TypeInfo, not TypeImpl.

I consider TypeImpl an implementation detail of qom/object.c, but maybe
I'm mistaken.

>> similar error-catching scenario where I needed to check for class
>> existence in some qdev_try_* function.
> 
> If this is a really common pattern, and object_try_new() really saves
> code, why not.
> 
> Can't see why we need the Error **argument, though.  What kinds of
> different errors that do you envisage?  Where "different" means "actual
> callers care about the difference".

Well, I thought of class-doesn't-exist vs. out-of-memory. It would just
be to report different textual messages to the end user - as QMP error
response or as stderr output elsewhere. I have better OOM handling
somewhere down my TODO list, including a preallocated Error object. Main
reason is avoiding code duplication though.

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-05-24 14:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24 11:43 [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new Markus Armbruster
2012-05-24 11:43 ` [Qemu-devel] [PATCH RFC 1/2] qom: Give type_get_by_name() external linkage Markus Armbruster
2012-05-24 11:43 ` [Qemu-devel] [PATCH RFC 2/2] qmp: New command qom-new Markus Armbruster
2012-05-24 11:51   ` Paolo Bonzini
2012-05-24 12:58     ` Anthony Liguori
2012-05-24 13:01       ` Andreas Färber
2012-05-24 13:44       ` Paolo Bonzini
2012-05-24 14:12         ` Anthony Liguori
2012-05-24 13:04   ` Anthony Liguori
2012-05-24 13:48     ` Igor Mammedov
2012-05-24 14:01       ` Andreas Färber
2012-05-24 14:07         ` Anthony Liguori
2012-05-24 15:33         ` Igor Mammedov
2012-05-24 14:04       ` Anthony Liguori
2012-05-24 14:24     ` Markus Armbruster
2012-05-24 15:15       ` Michael Roth
2012-05-24 12:32 ` [Qemu-devel] [PATCH RFC 0/2] QMP " Andreas Färber
2012-05-24 13:06   ` Anthony Liguori
2012-05-24 13:18     ` Peter Maydell
2012-05-24 14:10       ` Anthony Liguori
2012-05-24 14:23         ` Peter Maydell
2012-05-24 14:35           ` Anthony Liguori
2012-05-24 14:52             ` Peter Maydell
2012-05-24 14:08   ` Markus Armbruster
2012-05-24 14:31     ` Andreas Färber [this message]
2012-05-24 14:48       ` 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=4FBE4625.9040703@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=armbru@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 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).