From 44fb6337b9568ccb9f0d6dfb357eeb69f66d8527 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Tue, 7 Oct 2014 16:00:28 +0800 Subject: scsi: add bootindex to qom property Add a qom property with the same name 'bootindex', when we remove it form qdev property, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei Reviewed-by: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/scsi/scsi-bus.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'hw/scsi/scsi-bus.c') diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 0f3e0395f5..59e8f90b96 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -2016,6 +2016,16 @@ static void scsi_device_class_init(ObjectClass *klass, void *data) k->props = scsi_props; } +static void scsi_dev_instance_init(Object *obj) +{ + DeviceState *dev = DEVICE(obj); + SCSIDevice *s = DO_UPCAST(SCSIDevice, qdev, dev); + + device_add_bootindex_property(obj, &s->conf.bootindex, + "bootindex", NULL, + &s->qdev, NULL); +} + static const TypeInfo scsi_device_type_info = { .name = TYPE_SCSI_DEVICE, .parent = TYPE_DEVICE, @@ -2023,6 +2033,7 @@ static const TypeInfo scsi_device_type_info = { .abstract = true, .class_size = sizeof(SCSIDeviceClass), .class_init = scsi_device_class_init, + .instance_init = scsi_dev_instance_init, }; static void scsi_register_types(void) -- cgit v1.2.3 From 8dece34f26dbb8995c8e857052ccd084937d6a66 Mon Sep 17 00:00:00 2001 From: Gonglei Date: Tue, 7 Oct 2014 16:00:31 +0800 Subject: block: remove bootindex property from qdev to qom Remove bootindex form qdev property to qom, things will continue to work just fine, and we can use qom features which are not supported by qdev property. Signed-off-by: Gonglei Reviewed-by: Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/scsi/scsi-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/scsi/scsi-bus.c') diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 59e8f90b96..e7b1cf6730 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -231,7 +231,8 @@ SCSIDevice *scsi_bus_legacy_add_drive(SCSIBus *bus, BlockDriverState *bdrv, dev = qdev_create(&bus->qbus, driver); qdev_prop_set_uint32(dev, "scsi-id", unit); if (bootindex >= 0) { - qdev_prop_set_int32(dev, "bootindex", bootindex); + object_property_set_int(OBJECT(dev), bootindex, "bootindex", + &error_abort); } if (object_property_find(OBJECT(dev), "removable", NULL)) { qdev_prop_set_bit(dev, "removable", removable); -- cgit v1.2.3