[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v7 6/8] virtio-blk : Add the virtio-blk devi
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC PATCH v7 6/8] virtio-blk : Add the virtio-blk device. |
Date: |
Tue, 11 Dec 2012 17:33:32 +0000 |
On 10 December 2012 16:45, <address@hidden> wrote:
> From: KONRAD Frederic <address@hidden>
>
> Create virtio-blk which extends virtio-device, so it can be connected on
> virtio-bus.
> +static int virtio_device_init(DeviceState *qdev)
> +{
This is a not a very well named function. It's blk specific
but the function name implies it is generic virtio.
> + VirtIODevice *vdev = VIRTIO_DEVICE(qdev);
> + VirtIOBlock *s = VIRTIO_BLK(qdev);
> +
> + VirtIOBlkConf *blk = &(s->blk);
> +
> + virtio_blk_common_init(qdev, blk, &s);
> +
> + virtio_bus_plug_device(vdev);
This doesn't look right. A subclass of VirtIODevice
shouldn't have to do anything specific to plug itself in.
You can make the VirtIODevice's DeviceClass::init function
do that. (compare the way PCIDevice's init function
handles registering the device with the bus and hotplugging
it if the bus does hotplug.)
-- PMM
[Qemu-devel] [RFC PATCH v7 5/8] virtio-device : Refactor virtio-device., fred . konrad, 2012/12/10
[Qemu-devel] [RFC PATCH v7 4/8] virtio-pci : Refactor virtio-pci device., fred . konrad, 2012/12/10
[Qemu-devel] [RFC PATCH v7 6/8] virtio-blk : Add the virtio-blk device., fred . konrad, 2012/12/10
- Re: [Qemu-devel] [RFC PATCH v7 6/8] virtio-blk : Add the virtio-blk device.,
Peter Maydell <=
[Qemu-devel] [RFC PATCH v7 2/8] virtio-bus : Introduce virtio-bus, fred . konrad, 2012/12/10
[Qemu-devel] [RFC PATCH v7 8/8] virtio-blk : QOM modifications., fred . konrad, 2012/12/10
Re: [Qemu-devel] [RFC PATCH v7 0/8] Virtio refactoring., Peter Maydell, 2012/12/11