qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v6 21/27] redirect: remove bootindex property from q


From: arei.gonglei
Subject: [Qemu-devel] [PATCH v6 21/27] redirect: remove bootindex property from qdev to qom
Date: Sat, 30 Aug 2014 18:00:21 +0800

From: Gonglei <address@hidden>

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 <address@hidden>
---
 hw/usb/redirect.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 92dd353..ad97834 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -2469,7 +2469,6 @@ static Property usbredir_properties[] = {
     DEFINE_PROP_CHR("chardev", USBRedirDevice, cs),
     DEFINE_PROP_UINT8("debug", USBRedirDevice, debug, usbredirparser_warning),
     DEFINE_PROP_STRING("filter", USBRedirDevice, filter_str),
-    DEFINE_PROP_INT32("bootindex", USBRedirDevice, bootindex, -1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -2494,11 +2493,38 @@ static void usbredir_class_initfn(ObjectClass *klass, 
void *data)
     set_bit(DEVICE_CATEGORY_MISC, dc->categories);
 }
 
+static void usbredir_get_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    USBDevice *udev = USB_DEVICE(obj);
+    USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+
+    get_bootindex(&dev->bootindex, v, name, errp);
+}
+
+static void usbredir_set_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    USBDevice *udev = USB_DEVICE(obj);
+    USBRedirDevice *dev = DO_UPCAST(USBRedirDevice, dev, udev);
+
+    set_bootindex(&dev->bootindex, v, name, errp);
+}
+
+static void usbredir_instance_init(Object *obj)
+{
+    object_property_add(obj, "bootindex", "int",
+                        usbredir_get_bootindex,
+                        usbredir_set_bootindex, NULL, NULL, NULL);
+    object_property_set_int(obj, -1, "bootindex", NULL);
+}
+
 static const TypeInfo usbredir_dev_info = {
     .name          = "usb-redir",
     .parent        = TYPE_USB_DEVICE,
     .instance_size = sizeof(USBRedirDevice),
     .class_init    = usbredir_class_initfn,
+    .instance_init = usbredir_instance_init,
 };
 
 static void usbredir_register_types(void)
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]