mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
qdev: set properties with device_class_set_props()
The following patch will need to handle properties registration during class_init time. Let's use a device_class_set_props() setter. spatch --macro-file scripts/cocci-macro-file.h --sp-file ./scripts/coccinelle/qdev-set-props.cocci --keep-comments --in-place --dir . @@ typedef DeviceClass; DeviceClass *d; expression val; @@ - d->props = val + device_class_set_props(d, val) Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20200110153039.1379601-20-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b77ade9bb3
commit
4f67d30b5e
399 changed files with 458 additions and 451 deletions
|
@ -2511,7 +2511,7 @@ static void megasas_class_init(ObjectClass *oc, void *data)
|
|||
e->osts = info->osts;
|
||||
e->product_name = info->product_name;
|
||||
e->product_version = info->product_version;
|
||||
dc->props = info->props;
|
||||
device_class_set_props(dc, info->props);
|
||||
dc->reset = megasas_scsi_reset;
|
||||
dc->vmsd = info->vmsd;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
|
|
|
@ -1431,7 +1431,7 @@ static void mptsas1068_class_init(ObjectClass *oc, void *data)
|
|||
pc->subsystem_vendor_id = PCI_VENDOR_ID_LSI_LOGIC;
|
||||
pc->subsystem_id = 0x8000;
|
||||
pc->class_id = PCI_CLASS_STORAGE_SCSI;
|
||||
dc->props = mptsas_properties;
|
||||
device_class_set_props(dc, mptsas_properties);
|
||||
dc->reset = mptsas_reset;
|
||||
dc->vmsd = &vmstate_mptsas;
|
||||
dc->desc = "LSI SAS 1068";
|
||||
|
|
|
@ -1728,7 +1728,7 @@ static void scsi_device_class_init(ObjectClass *klass, void *data)
|
|||
k->bus_type = TYPE_SCSI_BUS;
|
||||
k->realize = scsi_qdev_realize;
|
||||
k->unrealize = scsi_qdev_unrealize;
|
||||
k->props = scsi_props;
|
||||
device_class_set_props(k, scsi_props);
|
||||
}
|
||||
|
||||
static void scsi_dev_instance_init(Object *obj)
|
||||
|
|
|
@ -3036,7 +3036,7 @@ static void scsi_hd_class_initfn(ObjectClass *klass, void *data)
|
|||
sc->alloc_req = scsi_new_request;
|
||||
sc->unit_attention_reported = scsi_disk_unit_attention_reported;
|
||||
dc->desc = "virtual SCSI disk";
|
||||
dc->props = scsi_hd_properties;
|
||||
device_class_set_props(dc, scsi_hd_properties);
|
||||
dc->vmsd = &vmstate_scsi_disk_state;
|
||||
}
|
||||
|
||||
|
@ -3067,7 +3067,7 @@ static void scsi_cd_class_initfn(ObjectClass *klass, void *data)
|
|||
sc->alloc_req = scsi_new_request;
|
||||
sc->unit_attention_reported = scsi_disk_unit_attention_reported;
|
||||
dc->desc = "virtual SCSI CD-ROM";
|
||||
dc->props = scsi_cd_properties;
|
||||
device_class_set_props(dc, scsi_cd_properties);
|
||||
dc->vmsd = &vmstate_scsi_disk_state;
|
||||
}
|
||||
|
||||
|
@ -3106,7 +3106,7 @@ static void scsi_block_class_initfn(ObjectClass *klass, void *data)
|
|||
sdc->update_sense = scsi_block_update_sense;
|
||||
sdc->need_fua_emulation = scsi_block_no_fua;
|
||||
dc->desc = "SCSI block device passthrough";
|
||||
dc->props = scsi_block_properties;
|
||||
device_class_set_props(dc, scsi_block_properties);
|
||||
dc->vmsd = &vmstate_scsi_disk_state;
|
||||
}
|
||||
|
||||
|
@ -3146,7 +3146,7 @@ static void scsi_disk_class_initfn(ObjectClass *klass, void *data)
|
|||
dc->fw_name = "disk";
|
||||
dc->desc = "virtual SCSI disk or CD-ROM (legacy)";
|
||||
dc->reset = scsi_disk_reset;
|
||||
dc->props = scsi_disk_properties;
|
||||
device_class_set_props(dc, scsi_disk_properties);
|
||||
dc->vmsd = &vmstate_scsi_disk_state;
|
||||
}
|
||||
|
||||
|
|
|
@ -768,7 +768,7 @@ static void scsi_generic_class_initfn(ObjectClass *klass, void *data)
|
|||
dc->fw_name = "disk";
|
||||
dc->desc = "pass through generic scsi device (/dev/sg*)";
|
||||
dc->reset = scsi_generic_reset;
|
||||
dc->props = scsi_generic_properties;
|
||||
device_class_set_props(dc, scsi_generic_properties);
|
||||
dc->vmsd = &vmstate_scsi_device;
|
||||
}
|
||||
|
||||
|
|
|
@ -1267,7 +1267,7 @@ static void spapr_vscsi_class_init(ObjectClass *klass, void *data)
|
|||
k->dt_compatible = "IBM,v-scsi";
|
||||
k->signal_mask = 0x00000001;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
dc->props = spapr_vscsi_properties;
|
||||
device_class_set_props(dc, spapr_vscsi_properties);
|
||||
k->rtce_window_size = 0x10000000;
|
||||
dc->vmsd = &vmstate_spapr_vscsi;
|
||||
}
|
||||
|
|
|
@ -293,7 +293,7 @@ static void vhost_scsi_class_init(ObjectClass *klass, void *data)
|
|||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(klass);
|
||||
|
||||
dc->props = vhost_scsi_properties;
|
||||
device_class_set_props(dc, vhost_scsi_properties);
|
||||
dc->vmsd = &vmstate_virtio_vhost_scsi;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
vdc->realize = vhost_scsi_realize;
|
||||
|
|
|
@ -197,7 +197,7 @@ static void vhost_user_scsi_class_init(ObjectClass *klass, void *data)
|
|||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(klass);
|
||||
|
||||
dc->props = vhost_user_scsi_properties;
|
||||
device_class_set_props(dc, vhost_user_scsi_properties);
|
||||
dc->vmsd = &vmstate_vhost_scsi;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
vdc->realize = vhost_user_scsi_realize;
|
||||
|
|
|
@ -1006,7 +1006,7 @@ static void virtio_scsi_class_init(ObjectClass *klass, void *data)
|
|||
VirtioDeviceClass *vdc = VIRTIO_DEVICE_CLASS(klass);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
|
||||
dc->props = virtio_scsi_properties;
|
||||
device_class_set_props(dc, virtio_scsi_properties);
|
||||
dc->vmsd = &vmstate_virtio_scsi;
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
vdc->realize = virtio_scsi_device_realize;
|
||||
|
|
|
@ -1292,7 +1292,7 @@ static void pvscsi_class_init(ObjectClass *klass, void *data)
|
|||
&pvs_k->parent_dc_realize);
|
||||
dc->reset = pvscsi_reset;
|
||||
dc->vmsd = &vmstate_pvscsi;
|
||||
dc->props = pvscsi_properties;
|
||||
device_class_set_props(dc, pvscsi_properties);
|
||||
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
|
||||
hc->unplug = pvscsi_hot_unplug;
|
||||
hc->plug = pvscsi_hotplug;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue