diff mbox

[v8,14/30] spapr_lian: add bootindex to qom property

Message ID 1410350664-1376-15-git-send-email-arei.gonglei@huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) Sept. 10, 2014, 12:04 p.m. UTC
From: Gonglei <arei.gonglei@huawei.com>

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 <arei.gonglei@huawei.com>
---
 hw/net/spapr_llan.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
diff mbox

Patch

diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
index 23c47d3..b89496a 100644
--- a/hw/net/spapr_llan.c
+++ b/hw/net/spapr_llan.c
@@ -226,6 +226,29 @@  static int spapr_vlan_init(VIOsPAPRDevice *sdev)
     return 0;
 }
 
+static void spapr_vlan_get_bootindex(Object *obj, Visitor *v, void *opaque,
+                                     const char *name, Error **errp)
+{
+    VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(obj);
+
+    get_bootindex(&dev->nicconf.bootindex, v, name, errp);
+}
+
+static void spapr_vlan_set_bootindex(Object *obj, Visitor *v, void *opaque,
+                                     const char *name, Error **errp)
+{
+    VIOsPAPRVLANDevice *dev = VIO_SPAPR_VLAN_DEVICE(obj);
+
+    set_bootindex(&dev->nicconf.bootindex, v, name, errp);
+}
+
+static void spapr_vlan_instance_init(Object *obj)
+{
+    object_property_add(obj, "bootindex", "int",
+                        spapr_vlan_get_bootindex,
+                        spapr_vlan_set_bootindex, NULL, NULL, NULL);
+}
+
 void spapr_vlan_create(VIOsPAPRBus *bus, NICInfo *nd)
 {
     DeviceState *dev;
@@ -553,6 +576,7 @@  static const TypeInfo spapr_vlan_info = {
     .parent        = TYPE_VIO_SPAPR_DEVICE,
     .instance_size = sizeof(VIOsPAPRVLANDevice),
     .class_init    = spapr_vlan_class_init,
+    .instance_init = spapr_vlan_instance_init,
 };
 
 static void spapr_vlan_register_types(void)