From: Paolo Bonzini <pbonzini@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/8] qom: introduce get/set methods for Property
Date: Fri, 16 Dec 2011 14:51:14 +0100 [thread overview]
Message-ID: <4EEB4CD2.8080907@redhat.com> (raw)
In-Reply-To: <4EEB439F.7010601@redhat.com>
On 12/16/2011 02:11 PM, Gerd Hoffmann wrote:
> I think we should not touch these. First it doesn't buy us much as we
> are using the old parse/print functions for the visitor-based access,
> which doesn't look like a good idea to me. Also they will not stay but
> will be converted to child<> and link<>, so I think it is better to keep
> the old stuff in the legacy<> namespace.
I thought the same initially. However, I noticed that the visitor
interfaces for links is also a string. So, even if a block/char/netdev
property later becomes a link<>, the interface would not change.
Using the old parse/print functions and get_set/generic is only to avoid
code duplication, I can surely inline everything but it would be uglier.
And again, I found an example in the code of using a similar adapter
pattern (the string properties).
There is one case where I had doubts, namely the PCI address properties.
They will be replaced by links that you set in the parent. However,
in the end I decided to start this way because:
1) QOM properties can still come and go at this stage;
2) The PCI address property can still stay forever as a synthetic
property declared by PCIDevice, so the "qom-get" ABI won't change. The
"qom-set" ABI will, so it might be better to do:
PropertyInfo qdev_prop_pci_devfn = {
.name = "pci-devfn",
.type = PROP_TYPE_UINT32,
.size = sizeof(uint32_t),
.parse = parse_pci_devfn,
.print = print_pci_devfn,
+ .get = get_pci_devfn,
+ .set = NULL,
};
Advantages: it shows that setting the PCI address is (going to be) a
legacy feature;
Disadvantages: looks a little ad-hoc. See below for an alternative.
> Agree on the bit/bool/int types. Although we maybe should apply some
> care to integer bus properties, some of them are used for addressing and
> will most likely replaced by child<> and link<> too.
Yes, these will also become synthetic and read-only. So an alternative
could be:
for (prop = dev->info->props; prop && prop->name; prop++) {
qdev_property_add_legacy(dev, prop, NULL);
/* Let the generic initializer register alternative definitions
* for qdev properties.
*/
if (!qdev_property_find(dev, prop->name) {
qdev_property_add_static(dev, prop, NULL);
}
}
for (prop = dev->info->bus_info->props; prop && prop->name; prop++) {
qdev_property_add_legacy(dev, prop, NULL);
if (!qdev_property_find(dev, prop->name) {
qdev_property_add_static(dev, prop, NULL);
}
}
For now the pci_devfn property remains read-write, but as soon as the
PCIDevice will be able to define it as synthetic, it will become read-only.
Paolo
next prev parent reply other threads:[~2011-12-16 13:51 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 12:01 [Qemu-devel] [PATCH 0/8] qom: introduce non-legacy static properties Paolo Bonzini
2011-12-16 12:01 ` [Qemu-devel] [PATCH 1/8] qapi: fix NULL pointer dereference Paolo Bonzini
2011-12-16 13:55 ` Anthony Liguori
2011-12-16 14:00 ` Paolo Bonzini
2011-12-16 14:10 ` Anthony Liguori
2011-12-16 14:22 ` Paolo Bonzini
2011-12-16 14:46 ` Anthony Liguori
2011-12-16 14:49 ` Paolo Bonzini
2011-12-16 14:56 ` Anthony Liguori
2011-12-16 15:03 ` Paolo Bonzini
2011-12-16 15:05 ` Anthony Liguori
2011-12-16 15:13 ` Paolo Bonzini
2011-12-16 15:23 ` Anthony Liguori
2011-12-16 15:42 ` Paolo Bonzini
2011-12-16 15:54 ` Anthony Liguori
2011-12-16 16:17 ` Paolo Bonzini
2011-12-16 16:24 ` Gerd Hoffmann
2011-12-16 12:01 ` [Qemu-devel] [PATCH 2/8] qapi: protect against NULL QObject in qmp_input_get_object Paolo Bonzini
2011-12-16 13:56 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 3/8] qom: fix swapped parameters Paolo Bonzini
2011-12-16 13:57 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 4/8] qom: push permission checks up into qdev_property_add_legacy Paolo Bonzini
2011-12-16 13:58 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 5/8] qom: introduce QERR_PROPERTY_VALUE_OUT_OF_RANGE Paolo Bonzini
2011-12-16 14:00 ` Anthony Liguori
2011-12-16 14:01 ` Paolo Bonzini
2011-12-16 17:00 ` Paolo Bonzini
2011-12-16 17:01 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 6/8] qom: introduce get/set methods for Property Paolo Bonzini
2011-12-16 13:11 ` Gerd Hoffmann
2011-12-16 13:51 ` Paolo Bonzini [this message]
2011-12-16 14:05 ` Anthony Liguori
2011-12-16 14:18 ` Paolo Bonzini
2011-12-16 14:44 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 7/8] qom: distinguish "legacy" property type name from QOM type name Paolo Bonzini
2011-12-16 14:06 ` Anthony Liguori
2011-12-16 14:18 ` Paolo Bonzini
2011-12-16 14:43 ` Anthony Liguori
2011-12-16 12:01 ` [Qemu-devel] [PATCH 8/8] qom: register qdev properties also as non-legacy properties Paolo Bonzini
2011-12-16 13:54 ` [Qemu-devel] [PATCH 0/8] qom: introduce non-legacy static properties Anthony Liguori
-- strict thread matches above, loose matches on Subject: below --
2011-12-18 16:05 [Qemu-devel] [PATCH v3 " Paolo Bonzini
2011-12-18 16:05 ` [Qemu-devel] [PATCH 6/8] qom: introduce get/set methods for Property 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=4EEB4CD2.8080907@redhat.com \
--to=pbonzini@redhat.com \
--cc=kraxel@redhat.com \
--cc=kwolf@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 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.