From: Paolo Bonzini <pbonzini@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: stefanha@redhat.com, sw@weilnetz.de, mjt@tls.msk.ru,
qemu-devel@nongnu.org, lcapitulino@redhat.com,
blauwirbel@gmail.com, aliguori@amazon.com, afaerber@suse.de,
rth@twiddle.net
Subject: Re: [Qemu-devel] [RFC 0/5] -object/object-add support custom location and 2nd stage initialization
Date: Fri, 10 Jan 2014 16:40:28 +0100 [thread overview]
Message-ID: <52D0146C.70505@redhat.com> (raw)
In-Reply-To: <20140110154438.4d4fd23b@nial.usersys.redhat.com>
Il 10/01/2014 15:44, Igor Mammedov ha scritto:
> On Fri, 10 Jan 2014 12:38:57 +0100
> Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>> Il 10/01/2014 12:28, Igor Mammedov ha scritto:
>>>>> Regarding the "overloading" of the realize name, I was against it in
>>>>> previous discussion and I still am (I was in favor of something like
>>>>> UserCreatable and naming the method "complete" or "construct"), but I
>>>>> didn't want to sound too negative. :)
>>> issue with naming interface as CommandLine or UserCreatable is that, it could
>>> be used not only by CLI/user but also it could be used internally. For example
>>> see "[PATCH 3/5] virtio_rng: use object_realize interface instead of calling
>>> backend API", where default backend is created by frontend.
>>
>> I see. Yes, with something like UserCreatable, you would not have that
> I'm not sure why I wouldn't have that path. It does exactly what you've
> just written vvv,
You're right, I misremembered.
>> patch. Instead, UserCreatable's complete method would redirect to the
>> backend-specific API.
> i.e. it calls cast<UserCreatable>(default_rng).complete() which
> redirects to backend specific API, where UserCreatable.complete()
> is rng_backend_realize()
>
>>
>> BTW, note that UserCreatable's complete method should take a
>> UserCreatable (or whatever the name is) as the first parameter, not an
>> Object. This would affect that patch, too.
> It does, 'void (*realize)(ObjectRealizeInterface *obj, Error **errp);'
>
> call_object_realize_interface(Object *obj,...) is a wrapper
> that reduces casting code duplication at call sites since it's used
> at more then 1 place.
This is needed only because you allow creating objects that do not have
ObjectRealizeInterface. With a UserCreatable interface, the dynamic
cast would be in vl.c and qmp.c (to check whether the user is actually
allowed to use -object on that device) and there's no duplication at the
call sites of the 2nd-stage init method.
> I'm fine with UserCreatable, lets wait couple days if there is no objection
> or another suggestions and I'll then respin series.
Thanks!
Paolo
next prev parent reply other threads:[~2014-01-10 15:40 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-08 16:09 [Qemu-devel] [RFC 0/5] -object/object-add support custom location and 2nd stage initialization Igor Mammedov
2014-01-08 16:09 ` [Qemu-devel] [PATCH 1/5] object_add: consolidate error handling Igor Mammedov
2014-01-08 16:09 ` [Qemu-devel] [PATCH 2/5] add optional 2nd stage initialization to -object/object-add/object_add commands Igor Mammedov
2014-01-08 16:09 ` [Qemu-devel] [PATCH 3/5] virtio_rng: use object_realize interface instead of calling backend API Igor Mammedov
2014-01-08 16:09 ` [Qemu-devel] [PATCH 4/5] vl.c: -object: handle duplicate 'id' properly Igor Mammedov
2014-01-08 16:09 ` [Qemu-devel] [PATCH 5/5] -object/object-add: use custom default object location if provided Igor Mammedov
2014-01-09 4:35 ` Stefan Hajnoczi
2014-01-10 10:59 ` Igor Mammedov
2014-01-08 16:24 ` [Qemu-devel] [RFC 0/5] -object/object-add support custom location and 2nd stage initialization Paolo Bonzini
2014-01-08 16:45 ` Andreas Färber
2014-01-08 17:00 ` Igor Mammedov
2014-01-08 16:51 ` Igor Mammedov
2014-01-08 17:33 ` Paolo Bonzini
2014-01-10 11:28 ` Igor Mammedov
2014-01-10 11:38 ` Paolo Bonzini
2014-01-10 14:44 ` Igor Mammedov
2014-01-10 15:40 ` Paolo Bonzini [this message]
2014-01-10 15:31 ` Igor Mammedov
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=52D0146C.70505@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@amazon.com \
--cc=blauwirbel@gmail.com \
--cc=imammedo@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=stefanha@redhat.com \
--cc=sw@weilnetz.de \
/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).