qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v6 10/27] eepro100: add bootindex to qom property


From: arei.gonglei
Subject: [Qemu-devel] [PATCH v6 10/27] eepro100: add bootindex to qom property
Date: Sat, 30 Aug 2014 18:00:10 +0800

From: Gonglei <address@hidden>

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-ooff-by: Gonglei <address@hidden>
---
 hw/net/eepro100.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/hw/net/eepro100.c b/hw/net/eepro100.c
index dcfaa48..5a29f20 100644
--- a/hw/net/eepro100.c
+++ b/hw/net/eepro100.c
@@ -1911,6 +1911,29 @@ static void eepro100_reset(DeviceState *dev)
     add_boot_device_path(s->conf.bootindex, dev, "/address@hidden");
 }
 
+static void eepro100_get_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj));
+
+    get_bootindex(&s->conf.bootindex, v, name, errp);
+}
+
+static void eepro100_set_bootindex(Object *obj, Visitor *v, void *opaque,
+                                   const char *name, Error **errp)
+{
+    EEPRO100State *s = DO_UPCAST(EEPRO100State, dev, PCI_DEVICE(obj));
+
+    set_bootindex(&s->conf.bootindex, v, name, errp);
+}
+
+static void eepro100_instance_init(Object *obj)
+{
+    object_property_add(obj, "bootindex", "int",
+                        eepro100_get_bootindex,
+                        eepro100_set_bootindex, NULL, NULL, NULL);
+}
+
 static E100PCIDeviceInfo e100_devices[] = {
     {
         .name = "i82550",
@@ -2110,7 +2133,8 @@ static void eepro100_register_types(void)
         type_info.parent = TYPE_PCI_DEVICE;
         type_info.class_init = eepro100_class_init;
         type_info.instance_size = sizeof(EEPRO100State);
-        
+        type_info.instance_init = eepro100_instance_init;
+
         type_register(&type_info);
     }
 }
-- 
1.7.12.4





reply via email to

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