qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Zhang, Chen" <chen.zhang@intel.com>
To: Eduardo Habkost <ehabkost@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: John Snow <jsnow@redhat.com>, Jason Wang <jasowang@redhat.com>,
	"Daniel P. Berrange" <berrange@redhat.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: RE: [PATCH v2 09/12] colo: Use class properties
Date: Fri, 13 Nov 2020 03:04:55 +0000	[thread overview]
Message-ID: <3ee0a0cdbdca455384114c8c2dfb251e@intel.com> (raw)
In-Reply-To: <20201111183823.283752-10-ehabkost@redhat.com>

Looks good for me, but Qemu still have lots of parts use object_property_add, do you have plan to change it?

Reviewed-by: Zhang Chen <chen.zhang@intel.com>

Thanks
Chen

> -----Original Message-----
> From: Eduardo Habkost <ehabkost@redhat.com>
> Sent: Thursday, November 12, 2020 2:38 AM
> To: qemu-devel@nongnu.org
> Cc: Daniel P. Berrange <berrange@redhat.com>; John Snow
> <jsnow@redhat.com>; Paolo Bonzini <pbonzini@redhat.com>; Zhang, Chen
> <chen.zhang@intel.com>; Li Zhijian <lizhijian@cn.fujitsu.com>; Jason Wang
> <jasowang@redhat.com>
> Subject: [PATCH v2 09/12] colo: Use class properties
> 
> 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



  reply	other threads:[~2020-11-13  3:06 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 18:38 [PATCH v2 00/12] qom: Convert some properties to class properties Eduardo Habkost
2020-11-11 18:38 ` [PATCH v2 01/12] vexpress: Register "secure" as class property Eduardo Habkost
2020-11-11 19:59   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 02/12] vexpress-a15: Register "virtualization" " Eduardo Habkost
2020-11-11 19:59   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 03/12] tmp421: Register properties as class properties Eduardo Habkost
2020-11-11 19:59   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 04/12] i386: Register feature bit " Eduardo Habkost
2020-12-15 14:11   ` Markus Armbruster
2020-12-15 15:01     ` Eduardo Habkost
2020-12-16  5:35       ` Markus Armbruster
2020-11-11 18:38 ` [PATCH v2 05/12] arm/virt: Register most " Eduardo Habkost
2020-11-11 20:03   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 06/12] virt: Register "its" as class property Eduardo Habkost
2020-11-11 20:03   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 07/12] arm/cpu64: Register "aarch64" " Eduardo Habkost
2020-11-11 20:04   ` Peter Maydell
2020-11-11 18:38 ` [PATCH v2 08/12] can_host: Use class properties Eduardo Habkost
2020-11-11 23:02   ` Pavel Pisa
2020-11-11 18:38 ` [PATCH v2 09/12] colo: " Eduardo Habkost
2020-11-13  3:04   ` Zhang, Chen [this message]
2020-12-11 20:59     ` Eduardo Habkost
2020-11-11 18:38 ` [PATCH v2 10/12] netfilter: Reorder functions Eduardo Habkost
2020-11-11 18:38 ` [PATCH v2 11/12] netfilter: Use class properties Eduardo Habkost
2020-11-11 18:38 ` [PATCH v2 12/12] input: " Eduardo Habkost
2020-11-11 21:48   ` Eduardo Habkost
2020-12-11 21:00 ` [PATCH v2 00/12] qom: Convert some properties to " Eduardo Habkost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ee0a0cdbdca455384114c8c2dfb251e@intel.com \
    --to=chen.zhang@intel.com \
    --cc=berrange@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).