aboutsummaryrefslogtreecommitdiff
path: root/hw/usb-msd.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-15 14:53:10 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2012-01-27 10:50:47 -0600
commit62aed76583fe8bf8e6ba5955b2ecfa3619ea3540 (patch)
treea536e59eab00a94fccfbb8b3ad8b32e902e77ea2 /hw/usb-msd.c
parent8f04ee0882aec9fe91fb70f767edf5dacff59835 (diff)
usb: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/usb-msd.c')
-rw-r--r--hw/usb-msd.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 186831d71b..ceb01e0eef 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -636,23 +636,28 @@ static const VMStateDescription vmstate_usb_msd = {
}
};
-static struct USBDeviceInfo msd_info = {
- .product_desc = "QEMU USB MSD",
- .qdev.name = "usb-storage",
- .qdev.fw_name = "storage",
- .qdev.size = sizeof(MSDState),
- .qdev.vmsd = &vmstate_usb_msd,
- .usb_desc = &desc,
- .init = usb_msd_initfn,
- .handle_packet = usb_generic_handle_packet,
- .cancel_packet = usb_msd_cancel_io,
- .handle_attach = usb_desc_attach,
- .handle_reset = usb_msd_handle_reset,
- .handle_control = usb_msd_handle_control,
- .handle_data = usb_msd_handle_data,
- .usbdevice_name = "disk",
- .usbdevice_init = usb_msd_init,
- .qdev.props = (Property[]) {
+static void usb_msd_class_initfn(ObjectClass *klass, void *data)
+{
+ USBDeviceClass *uc = USB_DEVICE_CLASS(klass);
+
+ uc->init = usb_msd_initfn;
+ uc->product_desc = "QEMU USB MSD";
+ uc->usb_desc = &desc;
+ uc->handle_packet = usb_generic_handle_packet;
+ uc->cancel_packet = usb_msd_cancel_io;
+ uc->handle_attach = usb_desc_attach;
+ uc->handle_reset = usb_msd_handle_reset;
+ uc->handle_control = usb_msd_handle_control;
+ uc->handle_data = usb_msd_handle_data;
+}
+
+static struct DeviceInfo msd_info = {
+ .name = "usb-storage",
+ .fw_name = "storage",
+ .size = sizeof(MSDState),
+ .vmsd = &vmstate_usb_msd,
+ .class_init= usb_msd_class_initfn,
+ .props = (Property[]) {
DEFINE_BLOCK_PROPERTIES(MSDState, conf),
DEFINE_PROP_STRING("serial", MSDState, serial),
DEFINE_PROP_BIT("removable", MSDState, removable, 0, false),
@@ -662,6 +667,6 @@ static struct USBDeviceInfo msd_info = {
static void usb_msd_register_devices(void)
{
- usb_qdev_register(&msd_info);
+ usb_qdev_register(&msd_info, "disk", usb_msd_init);
}
device_init(usb_msd_register_devices)