OSDN Git Service

virtio: add class_size to VirtioPCIDeviceTypeInfo
authorGerd Hoffmann <kraxel@redhat.com>
Thu, 7 Mar 2019 08:02:42 +0000 (09:02 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 11 Mar 2019 07:04:12 +0000 (08:04 +0100)
Needed when VirtioPCIClass subclasses have their own
class struct with some extra fields.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 20190307080244.9011-2-kraxel@redhat.com

hw/virtio/virtio-pci.c
hw/virtio/virtio-pci.h

index e978bfe..cb44e19 100644 (file)
@@ -1935,6 +1935,7 @@ void virtio_pci_types_register(const VirtioPCIDeviceTypeInfo *t)
         .parent        = t->parent ? t->parent : TYPE_VIRTIO_PCI,
         .instance_size = t->instance_size,
         .instance_init = t->instance_init,
+        .class_size    = t->class_size,
         .class_init    = virtio_pci_base_class_init,
         .class_data    = (void *)t,
         .abstract      = true,
index bd223a6..1858185 100644 (file)
@@ -230,6 +230,7 @@ typedef struct VirtioPCIDeviceTypeInfo {
 
     /* Same as TypeInfo fields: */
     size_t instance_size;
+    size_t class_size;
     void (*instance_init)(Object *obj);
     void (*class_init)(ObjectClass *klass, void *data);
 } VirtioPCIDeviceTypeInfo;