[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicat
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties |
Date: |
Thu, 22 May 2014 12:17:53 +0200 |
On Thu, May 22, 2014 at 12:04 AM, Paolo Bonzini <address@hidden> wrote:
> Il 21/05/2014 22:22, Stefan Hajnoczi ha scritto:
>
>> virtio-blk-pci, virtio-blk-s390, and virtio-blk-ccw all duplicate the
>> qdev properties of their VirtIOBlock child. This approach does not work
>> well with string or pointer properties since we must be careful about
>> leaking or double-freeing them.
>>
>> Use the QOM alias property to forward property accesses to the
>> VirtIOBlock child. This way no duplication is necessary.
>>
>> Remember to stop calling virtio_blk_set_conf() so that we don't clobber
>> the values already set on the VirtIOBlock instance.
>
>
> Which properties are _not_ being added? This is probably needed for all
> other virtio devices so a generic solution would be nice.
I think your idea is something like:
def qdev_add_alias_properties(obj, dev):
for qdev_prop in dev:
object_property_add_alias(obj, qdev_prop.name, dev, qdev_prop.name)
That way we don't explicitly list all properties and duplicate code
when fixing up net, rng, serial, scsi, etc.
I took a quick look at net, rng, and serial. This approach should
work because the VirtIODevice qdev properties need to be exposed
wholesale on the transport device.
If that's what you're hinting at, I'll try it in v2.
Stefan
- [Qemu-devel] [PATCH 1/7] qom: add object_property_add_alias(), (continued)
- [Qemu-devel] [PATCH 3/7] virtio-blk: move x-data-plane qdev property to virtio-blk.h, Stefan Hajnoczi, 2014/05/21
- [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Stefan Hajnoczi, 2014/05/21
- Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Paolo Bonzini, 2014/05/21
- Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Andreas Färber, 2014/05/22
- Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Stefan Hajnoczi, 2014/05/22
- Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Andreas Färber, 2014/05/22
- Re: [Qemu-devel] [PATCH 4/7] virtio-blk: use aliases instead of duplicate qdev properties, Peter Crosthwaite, 2014/05/22
[Qemu-devel] [PATCH 6/7] virtio: fix virtio-blk child refcount in transports, Stefan Hajnoczi, 2014/05/21
[Qemu-devel] [PATCH 5/7] virtio-blk: drop virtio_blk_set_conf(), Stefan Hajnoczi, 2014/05/21
[Qemu-devel] [PATCH 7/7] virtio-blk: move qdev properties into virtio-blk.c, Stefan Hajnoczi, 2014/05/21