From: Kevin Wolf <kwolf@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Markus Armbruster" <armbru@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH qom-next 1/7] qdev: Push state up to Object
Date: Mon, 11 Jun 2012 16:38:46 +0200 [thread overview]
Message-ID: <4FD602F6.4080508@redhat.com> (raw)
In-Reply-To: <4FD5F0D1.8070305@codemonkey.ws>
Am 11.06.2012 15:21, schrieb Anthony Liguori:
> On 06/11/2012 03:25 AM, Kevin Wolf wrote:
>> Am 10.06.2012 19:38, schrieb Andreas Färber:
>>> Am 10.06.2012 17:49, schrieb Paolo Bonzini:
>>>> Il 08/06/2012 03:19, Anthony Liguori ha scritto:
>>>>>>
>>>>>> +typedef enum ObjectState {
>>>>>> + OBJECT_STATE_INITIALIZED = 1,
>>>>>> + OBJECT_STATE_REALIZED,
>>>>>> +} ObjectState;
>>>>>
>>>>> I think using a bool would be better since it reduces the temptation to
>>>>> add additional states.
>>>>
>>>> In fact someone already discussed having a third state for block
>>>> devices... :)
>>>
>>> I would expect that file_opened state to remain internal to the block
>>> layer. Thought we discussed that on IRC?
>>
>> I think I still don't understand well enough what 'realized' is really
>> supposed to mean.
>
> realized is essentially the Vcc pin for the device.
My BlockDriverState doesn't have a Vcc pin, and neither has my Error
object. I thought realize() did exist in Object and not only in Device?
If so, it must have a more generic meaning.
>> Does some magic happen when an object gets realised? From outside,
>> what's the difference between an INITIALIZED and a REALIZED object? Is
>> it more or less an implementation detail of the base class or is it
>> something that affects the object model itself?
>
> On the rising edge of realized, you typically will validate any parameters and
> do any actions necessary based on the parameters. As long as the guest isn't
> running, we want the ability to make changes to the devices that we normally
> couldn't change while the guest is running (like updating the CharDriverState
> pointer).
Okay, that matches my understanding.
Are all of the checks and the status change of properties (modifiable ->
const) done by the specific subclass or is it done by QOM to some degree?
>> I think the file_opened state should have more or less the same status
>> as the realisation of an object. They are quite similar, so they should
>> both be an implementation detail of their respective class, or they
>> should both be baked into the object model.
>
> I think we need to think about what realized means to a non-Device. Does
> file_opened have the same logical semantics as the above?
Yes, I think it's quite similar, just at an intermediate stage of the
object creation. As I imagine it, you would:
1. Create a BlockDriveState
2. Modify the filename property (you can really modify any property if
you want for some reason)
3. Call file_open, which opens the image file and may derive some
default property values from the image file (flags in the header or
whatever). Typical example: The backing file path. I think this would
roughly correspond to an extended .bdrv_probe.
4. Modify more properties, overriding any defaults of the image.
file_open has made some properties read-only (like the filename),
which cannot be modified any more.
5. Call realize. This is the actual .bdrv_open call that makes the
BlockDriverState ready to be used. This makes some more properties
read-only, like the backing file and format.
>> A comment in this patch says it means that an object is fully
>> constructed.
>
> That's not really the best wording. See above.
For non-Devices it's still the best explanation I have found.
Kevin
next prev parent reply other threads:[~2012-06-11 14:39 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 19:30 [Qemu-devel] [PATCH qom-next 0/7] QOM realize, revised Andreas Färber
2012-06-07 19:30 ` [Qemu-devel] [PATCH qom-next 1/7] qdev: Push state up to Object Andreas Färber
2012-06-08 1:19 ` Anthony Liguori
2012-06-10 15:49 ` Paolo Bonzini
2012-06-10 17:35 ` Anthony Liguori
2012-06-10 17:38 ` Andreas Färber
2012-06-11 8:25 ` Kevin Wolf
2012-06-11 13:21 ` Anthony Liguori
2012-06-11 14:38 ` Kevin Wolf [this message]
2012-06-11 21:31 ` Andreas Färber
2012-06-11 21:43 ` Andreas Färber
2012-06-11 21:48 ` Anthony Liguori
2012-06-12 0:14 ` Andreas Färber
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 2/7] qom: Add get_id Andreas Färber
2012-06-08 1:22 ` Anthony Liguori
2012-06-08 7:11 ` Andreas Färber
2012-06-08 7:44 ` Anthony Liguori
2012-06-08 8:17 ` Andreas Färber
2012-06-08 10:59 ` [Qemu-devel] [libvirt] " Daniel P. Berrange
2012-06-08 11:58 ` [Qemu-devel] " Eric Blake
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 3/7] qdev: Generalize properties to Objects Andreas Färber
2012-06-08 1:23 ` Anthony Liguori
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 4/7] qdev: Move bulk of qdev-properties.c to qom/object-properties.c Andreas Färber
2012-06-07 23:23 ` Paolo Bonzini
2012-06-08 1:26 ` Anthony Liguori
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 5/7] qom: Push static properties to Object Andreas Färber
2012-06-08 1:26 ` Anthony Liguori
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 6/7] qom: Add "realized" property Andreas Färber
2012-06-08 1:26 ` Anthony Liguori
2012-06-07 19:31 ` [Qemu-devel] [PATCH qom-next 7/7] qom: Add QERR_PROPERTY_SET_AFTER_REALIZE Andreas Färber
2012-06-07 19:56 ` Andreas Färber
2012-06-07 23:22 ` [Qemu-devel] [PATCH qom-next 0/7] QOM realize, revised Paolo Bonzini
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=4FD602F6.4080508@redhat.com \
--to=kwolf@redhat.com \
--cc=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).