[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 09/12] colo: Use class properties
From: |
Eduardo Habkost |
Subject: |
[PATCH v2 09/12] colo: Use class properties |
Date: |
Wed, 11 Nov 2020 13:38:20 -0500 |
Instance properties make introspection hard and are not shown by
"-object ...,help". Convert them to class properties.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
This was originally submitted as part of the series:
Subject: [PATCH 00/12] qom: Make all -object types use only class properties
Message-Id: <20201009160122.1662082-1-ehabkost@redhat.com>
https://lore.kernel.org/qemu-devel/20201009160122.1662082-1-ehabkost@redhat.com
---
Cc: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org
---
net/colo-compare.c | 57 +++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 28 deletions(-)
diff --git a/net/colo-compare.c b/net/colo-compare.c
index 3a45d64175..017e82dd8b 100644
--- a/net/colo-compare.c
+++ b/net/colo-compare.c
@@ -1375,6 +1375,35 @@ static void colo_compare_class_init(ObjectClass *oc,
void *data)
{
UserCreatableClass *ucc = USER_CREATABLE_CLASS(oc);
+ object_class_property_add_str(oc, "primary_in",
+ compare_get_pri_indev,
compare_set_pri_indev);
+ object_class_property_add_str(oc, "secondary_in",
+ compare_get_sec_indev,
compare_set_sec_indev);
+ object_class_property_add_str(oc, "outdev",
+ compare_get_outdev, compare_set_outdev);
+ object_class_property_add_link(oc, "iothread", TYPE_IOTHREAD,
+ offsetof(CompareState, iothread),
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_STRONG);
+ /* This parameter just for Xen COLO */
+ object_class_property_add_str(oc, "notify_dev",
+ compare_get_notify_dev,
compare_set_notify_dev);
+
+ object_class_property_add(oc, "compare_timeout", "uint32",
+ compare_get_timeout,
+ compare_set_timeout, NULL, NULL);
+
+ object_class_property_add(oc, "expired_scan_cycle", "uint32",
+ compare_get_expired_scan_cycle,
+ compare_set_expired_scan_cycle, NULL, NULL);
+
+ object_class_property_add(oc, "max_queue_size", "uint32",
+ get_max_queue_size,
+ set_max_queue_size, NULL, NULL);
+
+ object_class_property_add_bool(oc, "vnet_hdr_support",
compare_get_vnet_hdr,
+ compare_set_vnet_hdr);
+
ucc->complete = colo_compare_complete;
}
@@ -1382,35 +1411,7 @@ static void colo_compare_init(Object *obj)
{
CompareState *s = COLO_COMPARE(obj);
- object_property_add_str(obj, "primary_in",
- compare_get_pri_indev, compare_set_pri_indev);
- object_property_add_str(obj, "secondary_in",
- compare_get_sec_indev, compare_set_sec_indev);
- object_property_add_str(obj, "outdev",
- compare_get_outdev, compare_set_outdev);
- object_property_add_link(obj, "iothread", TYPE_IOTHREAD,
- (Object **)&s->iothread,
- object_property_allow_set_link,
- OBJ_PROP_LINK_STRONG);
- /* This parameter just for Xen COLO */
- object_property_add_str(obj, "notify_dev",
- compare_get_notify_dev, compare_set_notify_dev);
-
- object_property_add(obj, "compare_timeout", "uint32",
- compare_get_timeout,
- compare_set_timeout, NULL, NULL);
-
- object_property_add(obj, "expired_scan_cycle", "uint32",
- compare_get_expired_scan_cycle,
- compare_set_expired_scan_cycle, NULL, NULL);
-
- object_property_add(obj, "max_queue_size", "uint32",
- get_max_queue_size,
- set_max_queue_size, NULL, NULL);
-
s->vnet_hdr = false;
- object_property_add_bool(obj, "vnet_hdr_support", compare_get_vnet_hdr,
- compare_set_vnet_hdr);
}
static void colo_compare_finalize(Object *obj)
--
2.28.0
- [PATCH v2 00/12] qom: Convert some properties to class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 03/12] tmp421: Register properties as class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 02/12] vexpress-a15: Register "virtualization" as class property, Eduardo Habkost, 2020/11/11
- [PATCH v2 04/12] i386: Register feature bit properties as class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 06/12] virt: Register "its" as class property, Eduardo Habkost, 2020/11/11
- [PATCH v2 07/12] arm/cpu64: Register "aarch64" as class property, Eduardo Habkost, 2020/11/11
- [PATCH v2 09/12] colo: Use class properties,
Eduardo Habkost <=
- [PATCH v2 10/12] netfilter: Reorder functions, Eduardo Habkost, 2020/11/11
- [PATCH v2 08/12] can_host: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 11/12] netfilter: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 12/12] input: Use class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 05/12] arm/virt: Register most properties as class properties, Eduardo Habkost, 2020/11/11
- [PATCH v2 01/12] vexpress: Register "secure" as class property, Eduardo Habkost, 2020/11/11