diff mbox series

[05/24] vhost-user: Register "chardev" as class property

Message ID 20200921221045.699690-6-ehabkost@redhat.com (mailing list archive)
State New, archived
Headers show
Series qom: Convert some properties to class properties | expand

Commit Message

Eduardo Habkost Sept. 21, 2020, 10:10 p.m. UTC
Class properties make QOM introspection simpler and easier, as
they don't require an object to be instantiated.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: qemu-devel@nongnu.org
---
 backends/vhost-user.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Marc-André Lureau Oct. 8, 2020, 6:58 a.m. UTC | #1
On Tue, Sep 22, 2020 at 2:13 AM Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev,
> set_chardev);
>  }
>
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };
> --
> 2.26.2
>
>
>
Igor Mammedov Oct. 23, 2020, 6:16 p.m. UTC | #2
On Mon, 21 Sep 2020 18:10:26 -0400
Eduardo Habkost <ehabkost@redhat.com> wrote:

> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>  
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
>  }
>  
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };
Michael S. Tsirkin Oct. 30, 2020, 8:56 a.m. UTC | #3
On Mon, Sep 21, 2020 at 06:10:26PM -0400, Eduardo Habkost wrote:
> Class properties make QOM introspection simpler and easier, as
> they don't require an object to be instantiated.
> 
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

> ---
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: qemu-devel@nongnu.org
> ---
>  backends/vhost-user.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/backends/vhost-user.c b/backends/vhost-user.c
> index 9e6e1985465..858fdeae26c 100644
> --- a/backends/vhost-user.c
> +++ b/backends/vhost-user.c
> @@ -175,9 +175,9 @@ static char *get_chardev(Object *obj, Error **errp)
>      return NULL;
>  }
>  
> -static void vhost_user_backend_init(Object *obj)
> +static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
>  {
> -    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
> +    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
>  }
>  
>  static void vhost_user_backend_finalize(Object *obj)
> @@ -195,7 +195,7 @@ static const TypeInfo vhost_user_backend_info = {
>      .name = TYPE_VHOST_USER_BACKEND,
>      .parent = TYPE_OBJECT,
>      .instance_size = sizeof(VhostUserBackend),
> -    .instance_init = vhost_user_backend_init,
> +    .class_init = vhost_user_backend_class_init,
>      .instance_finalize = vhost_user_backend_finalize,
>      .class_size = sizeof(VhostUserBackendClass),
>  };
> -- 
> 2.26.2
diff mbox series

Patch

diff --git a/backends/vhost-user.c b/backends/vhost-user.c
index 9e6e1985465..858fdeae26c 100644
--- a/backends/vhost-user.c
+++ b/backends/vhost-user.c
@@ -175,9 +175,9 @@  static char *get_chardev(Object *obj, Error **errp)
     return NULL;
 }
 
-static void vhost_user_backend_init(Object *obj)
+static void vhost_user_backend_class_init(ObjectClass *oc, void *data)
 {
-    object_property_add_str(obj, "chardev", get_chardev, set_chardev);
+    object_class_property_add_str(oc, "chardev", get_chardev, set_chardev);
 }
 
 static void vhost_user_backend_finalize(Object *obj)
@@ -195,7 +195,7 @@  static const TypeInfo vhost_user_backend_info = {
     .name = TYPE_VHOST_USER_BACKEND,
     .parent = TYPE_OBJECT,
     .instance_size = sizeof(VhostUserBackend),
-    .instance_init = vhost_user_backend_init,
+    .class_init = vhost_user_backend_class_init,
     .instance_finalize = vhost_user_backend_finalize,
     .class_size = sizeof(VhostUserBackendClass),
 };