[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in
From: |
Michael S. Tsirkin |
Subject: |
Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports |
Date: |
Mon, 29 Sep 2014 15:33:32 +0300 |
On Mon, Sep 29, 2014 at 12:09:06PM +0000, Gonglei (Arei) wrote:
> > From: Cornelia Huck [mailto:address@hidden
> > Sent: Monday, September 29, 2014 6:53 PM
> > Subject: Re: [PATCH RESEND 0/9] virtio: fix virtio child recount in
> > transports
> >
> > On Sat, 27 Sep 2014 10:37:23 +0000
> > "Gonglei (Arei)" <address@hidden> wrote:
> >
> > > > > One thing I noticed is that the various devices end up with similar
> > > > > code in the end:
> > > > >
> > > > > object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_WHATEVER);
> > > > > object_property_add_child(obj, "virtio-backend",
> > > > OBJECT(&dev->vdev),
> > > > > NULL);
> > > > > object_unref(OBJECT(&dev->vdev));
> > > > > qdev_alias_all_properties(DEVICE(&dev->vdev), obj);
> > > > >
> > > > > Would it make sense to add a helper function for that?
> > > >
> > >
> > > Sorry, I'm afraid this is not helpful. Because dev and dev->vdev is
> > > different
> > > for different virtio devices, like VirtIOBlkPCI(and its vdev is
> > > VirtIOBlock),
> > > VirtIONetPCI(and its vdev is VirtIONet). They have no the same parameters
> > > for above code segment. :)
> >
> > Hm...
> >
> > void virtio_instance_init_common(Object *proxydev,
> > DeviceState *vdev,
> > size_t vdevsize,
> > const char *vdevname)
> > {
> > object_initialize(vdev, vdevsize, vdevname);
> > object_property_add_child(proxydev, "virtio-backend", OBJECT(vdev),
> > NULL);
> > object_unref(OBJECT(vdev));
> > qdev_alias_all_properties(vdev, proxydev);
> > }
> >
> > and have the initializers call
> >
> > virtio_instance_init_common(obj, DEVICE(&dev->vdev), sizeof(dev->vdev),
> > TYPE_WHATEVER);
> >
> > ?
>
> OK, it looks good that pass all parameters to one wrapper function.
> Will do this in next version.
>
> Thanks, Cornelia. :)
>
> Best regards,
> -Gonglei
I'm fine with doing the cleanup as a patch on top.
Cornelia, fine with you?
- [Qemu-devel] [PATCH RESEND 5/9] virtio-serial: use aliases instead of duplicate qdev properties, (continued)
- [Qemu-devel] [PATCH RESEND 5/9] virtio-serial: use aliases instead of duplicate qdev properties, arei.gonglei, 2014/09/26
- [Qemu-devel] [PATCH RESEND 4/9] virtio/vhost-scsi: fix virtio-scsi/vhost-scsi child refcount in transports, arei.gonglei, 2014/09/26
- [Qemu-devel] [PATCH RESEND 8/9] virtio-rng: fix virtio-rng child refcount in transports, arei.gonglei, 2014/09/26
- [Qemu-devel] [PATCH RESEND 1/9] virtio-net: use aliases instead of duplicate qdev properties, arei.gonglei, 2014/09/26
- [Qemu-devel] [PATCH RESEND 6/9] virtio-serial: fix virtio-serial child refcount in transports, arei.gonglei, 2014/09/26
- Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports, Cornelia Huck, 2014/09/26
- Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports, Paolo Bonzini, 2014/09/29
- Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports, Gonglei (Arei), 2014/09/29
Re: [Qemu-devel] [PATCH RESEND 0/9] virtio: fix virtio child recount in transports, Cornelia Huck, 2014/09/29