From: Paolo Bonzini <pbonzini@redhat.com>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: anton.nefedov@virtuozzo.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 1/3] qom-qobject: introduce object_property_{g, s}et_ptr
Date: Tue, 21 Feb 2017 17:23:24 +0100 [thread overview]
Message-ID: <c7afa895-8923-cd10-0294-1aca5e76f2ee@redhat.com> (raw)
In-Reply-To: <48da68cf-67bf-1be8-206e-f082fbd024fc@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1587 bytes --]
On 21/02/2017 16:57, Eric Blake wrote:
>> + /* You can retrieve a covariant (superclass) type... */
>> + ret = OBJECT_PROPERTY_GET_PTR(OBJECT(dobj), "qv",
>> + UserDefZero, &local_err);
>> + g_assert(!local_err);
>> +
>> + g_assert_cmpint(ret->integer, ==, 0);
>> + qapi_free_UserDefZero(ret);
>
> You coded a non-strict visitor above to allow this to happen, but is it
> really what we want? It basically means we are grabbing the property
> fields we care about, while ignoring the rest of the property. I guess
> it may be okay.
The tests were very useful to write, because I had hardly gotten any of
the corner cases right. :) I think these semantics make the most sense.
Yeah, it uses non-strict mode but this test provides a reason (namely,
covariant return types) why non-strict mode is useful. It makes
backwards-compatibility easier.
>> +
>> + /* Test that the property has not been modified at all */
>> + ret = OBJECT_PROPERTY_GET_PTR(OBJECT(dobj), "qv",
>> + UserDefZero, &local_err);
>> + g_assert(!local_err);
>> +
>> + g_assert_cmpint(ret->integer, ==, 0);
>> + qapi_free_UserDefZero(ret);
>> +}
>> +
>> +++ b/tests/qapi-schema/qapi-schema-test.json
>> @@ -91,6 +91,14 @@
>> '*enum1': 'EnumOne' } } # intentional forward reference
>>
>> ##
>> +# @UserDefOneMore:
>> +# for testing nested structs
> Is nested the right word here?
Just copied from UserDefOne. :) I'll change both to "derived".
Paolo
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2017-02-21 16:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 10:42 [Qemu-devel] [PATCH 0/3] simplify struct QOM properties and use the result for GUEST_PANICKED Paolo Bonzini
2017-02-21 10:42 ` [Qemu-devel] [PATCH 1/3] qom-qobject: introduce object_property_{g, s}et_ptr Paolo Bonzini
2017-02-21 11:56 ` Paolo Bonzini
2017-02-21 16:36 ` Marc-André Lureau
2017-02-21 15:57 ` Eric Blake
2017-02-21 16:23 ` Paolo Bonzini [this message]
2017-02-21 10:42 ` [Qemu-devel] [PATCH 2/3] cpu: implement get_crash_info through QOM properties Paolo Bonzini
2017-02-21 16:11 ` Eric Blake
2017-02-21 10:42 ` [Qemu-devel] [PATCH 3/3] vl: pass CPUState to qemu_system_guest_panicked Paolo Bonzini
2017-02-21 16:13 ` Eric Blake
2017-02-22 9:17 ` Anton Nefedov
2017-02-21 10:50 ` [Qemu-devel] [PATCH 0/3] simplify struct QOM properties and use the result for GUEST_PANICKED no-reply
2017-02-21 10:52 ` no-reply
2017-02-21 11:02 ` no-reply
-- strict thread matches above, loose matches on Subject: below --
2017-02-22 18:04 [Qemu-devel] [PATCH v2 " Paolo Bonzini
2017-02-22 18:04 ` [Qemu-devel] [PATCH 1/3] qom-qobject: introduce object_property_{g, s}et_ptr Paolo Bonzini
2017-02-22 23:34 ` Eric Blake
2017-02-23 8:33 ` Marc-André Lureau
2017-02-24 14:54 ` Markus Armbruster
2017-02-24 15:29 ` Paolo Bonzini
2017-02-24 16:54 ` Eric Blake
2017-02-24 17:12 ` Paolo Bonzini
2017-02-24 19:18 ` 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=c7afa895-8923-cd10-0294-1aca5e76f2ee@redhat.com \
--to=pbonzini@redhat.com \
--cc=anton.nefedov@virtuozzo.com \
--cc=den@openvz.org \
--cc=eblake@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).