qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
@ 2018-02-12 15:49 Dr. David Alan Gilbert (git)
  2018-02-12 15:52 ` David Hildenbrand
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-02-12 15:49 UTC (permalink / raw)
  To: qemu-devel, rth, agraf, david

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

There's no need for this to be dynamic, make it static.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
index a1d2135a60..adf07ef312 100644
--- a/hw/s390x/s390-stattrib.c
+++ b/hw/s390x/s390-stattrib.c
@@ -365,22 +365,22 @@ static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value,
     s->migration_enabled = value;
 }
 
+static SaveVMHandlers savevm_s390_stattrib_handlers = {
+    .save_setup = cmma_save_setup,
+    .save_live_iterate = cmma_save_iterate,
+    .save_live_complete_precopy = cmma_save_complete,
+    .save_live_pending = cmma_save_pending,
+    .save_cleanup = cmma_save_cleanup,
+    .load_state = cmma_load,
+    .is_active = cmma_active,
+};
+
 static void s390_stattrib_instance_init(Object *obj)
 {
     S390StAttribState *sas = S390_STATTRIB(obj);
-    SaveVMHandlers *ops;
-
-    /* ops will always be freed by qemu when unregistering */
-    ops = g_new0(SaveVMHandlers, 1);
-
-    ops->save_setup = cmma_save_setup;
-    ops->save_live_iterate = cmma_save_iterate;
-    ops->save_live_complete_precopy = cmma_save_complete;
-    ops->save_live_pending = cmma_save_pending;
-    ops->save_cleanup = cmma_save_cleanup;
-    ops->load_state = cmma_load;
-    ops->is_active = cmma_active;
-    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0, ops, sas);
+
+    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0,
+                         &savevm_s390_stattrib_handlers, sas);
 
     object_property_add_bool(obj, "migration-enabled",
                              s390_stattrib_get_migration_enabled,
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
  2018-02-12 15:49 [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static Dr. David Alan Gilbert (git)
@ 2018-02-12 15:52 ` David Hildenbrand
  2018-02-12 16:45   ` Claudio Imbrenda
  2018-02-12 16:19 ` Thomas Huth
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: David Hildenbrand @ 2018-02-12 15:52 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, rth, agraf
  Cc: Cornelia Huck, qemu-s390x

On 12.02.2018 16:49, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> There's no need for this to be dynamic, make it static.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index a1d2135a60..adf07ef312 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -365,22 +365,22 @@ static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value,
>      s->migration_enabled = value;
>  }
>  
> +static SaveVMHandlers savevm_s390_stattrib_handlers = {
> +    .save_setup = cmma_save_setup,
> +    .save_live_iterate = cmma_save_iterate,
> +    .save_live_complete_precopy = cmma_save_complete,
> +    .save_live_pending = cmma_save_pending,
> +    .save_cleanup = cmma_save_cleanup,
> +    .load_state = cmma_load,
> +    .is_active = cmma_active,
> +};
> +
>  static void s390_stattrib_instance_init(Object *obj)
>  {
>      S390StAttribState *sas = S390_STATTRIB(obj);
> -    SaveVMHandlers *ops;
> -
> -    /* ops will always be freed by qemu when unregistering */
> -    ops = g_new0(SaveVMHandlers, 1);
> -
> -    ops->save_setup = cmma_save_setup;
> -    ops->save_live_iterate = cmma_save_iterate;
> -    ops->save_live_complete_precopy = cmma_save_complete;
> -    ops->save_live_pending = cmma_save_pending;
> -    ops->save_cleanup = cmma_save_cleanup;
> -    ops->load_state = cmma_load;
> -    ops->is_active = cmma_active;
> -    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0, ops, sas);
> +
> +    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0,
> +                         &savevm_s390_stattrib_handlers, sas);
>  
>      object_property_add_bool(obj, "migration-enabled",
>                               s390_stattrib_get_migration_enabled,
> 

Looks sane to me.

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
  2018-02-12 15:49 [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static Dr. David Alan Gilbert (git)
  2018-02-12 15:52 ` David Hildenbrand
@ 2018-02-12 16:19 ` Thomas Huth
  2018-02-12 17:06 ` Richard Henderson
  2018-02-13  9:23 ` Cornelia Huck
  3 siblings, 0 replies; 6+ messages in thread
From: Thomas Huth @ 2018-02-12 16:19 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel
  Cc: david, Cornelia Huck, Qemu-s390x list, Claudio Imbrenda

On 12.02.2018 16:49, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> There's no need for this to be dynamic, make it static.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index a1d2135a60..adf07ef312 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -365,22 +365,22 @@ static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value,
>      s->migration_enabled = value;
>  }
>  
> +static SaveVMHandlers savevm_s390_stattrib_handlers = {
> +    .save_setup = cmma_save_setup,
> +    .save_live_iterate = cmma_save_iterate,
> +    .save_live_complete_precopy = cmma_save_complete,
> +    .save_live_pending = cmma_save_pending,
> +    .save_cleanup = cmma_save_cleanup,
> +    .load_state = cmma_load,
> +    .is_active = cmma_active,
> +};
> +
>  static void s390_stattrib_instance_init(Object *obj)
>  {
>      S390StAttribState *sas = S390_STATTRIB(obj);
> -    SaveVMHandlers *ops;
> -
> -    /* ops will always be freed by qemu when unregistering */
> -    ops = g_new0(SaveVMHandlers, 1);
> -
> -    ops->save_setup = cmma_save_setup;
> -    ops->save_live_iterate = cmma_save_iterate;
> -    ops->save_live_complete_precopy = cmma_save_complete;
> -    ops->save_live_pending = cmma_save_pending;
> -    ops->save_cleanup = cmma_save_cleanup;
> -    ops->load_state = cmma_load;
> -    ops->is_active = cmma_active;
> -    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0, ops, sas);
> +
> +    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0,
> +                         &savevm_s390_stattrib_handlers, sas);
>  
>      object_property_add_bool(obj, "migration-enabled",
>                               s390_stattrib_get_migration_enabled,
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
  2018-02-12 15:52 ` David Hildenbrand
@ 2018-02-12 16:45   ` Claudio Imbrenda
  0 siblings, 0 replies; 6+ messages in thread
From: Claudio Imbrenda @ 2018-02-12 16:45 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Dr. David Alan Gilbert (git), qemu-devel, rth, agraf, qemu-s390x,
	Cornelia Huck

On Mon, 12 Feb 2018 16:52:08 +0100
David Hildenbrand <david@redhat.com> wrote:

> On 12.02.2018 16:49, Dr. David Alan Gilbert (git) wrote:
> > From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> > 
> > There's no need for this to be dynamic, make it static.
> > 
> > Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> > ---
> >  hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
> >  1 file changed, 13 insertions(+), 13 deletions(-)
> > 
> > diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> > index a1d2135a60..adf07ef312 100644
> > --- a/hw/s390x/s390-stattrib.c
> > +++ b/hw/s390x/s390-stattrib.c
> > @@ -365,22 +365,22 @@ static inline void
> > s390_stattrib_set_migration_enabled(Object *obj, bool value,
> > s->migration_enabled = value; }
> >  
> > +static SaveVMHandlers savevm_s390_stattrib_handlers = {
> > +    .save_setup = cmma_save_setup,
> > +    .save_live_iterate = cmma_save_iterate,
> > +    .save_live_complete_precopy = cmma_save_complete,
> > +    .save_live_pending = cmma_save_pending,
> > +    .save_cleanup = cmma_save_cleanup,
> > +    .load_state = cmma_load,
> > +    .is_active = cmma_active,
> > +};
> > +
> >  static void s390_stattrib_instance_init(Object *obj)
> >  {
> >      S390StAttribState *sas = S390_STATTRIB(obj);
> > -    SaveVMHandlers *ops;
> > -
> > -    /* ops will always be freed by qemu when unregistering */
> > -    ops = g_new0(SaveVMHandlers, 1);
> > -
> > -    ops->save_setup = cmma_save_setup;
> > -    ops->save_live_iterate = cmma_save_iterate;
> > -    ops->save_live_complete_precopy = cmma_save_complete;
> > -    ops->save_live_pending = cmma_save_pending;
> > -    ops->save_cleanup = cmma_save_cleanup;
> > -    ops->load_state = cmma_load;
> > -    ops->is_active = cmma_active;
> > -    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0, ops, sas);
> > +
> > +    register_savevm_live(NULL, TYPE_S390_STATTRIB, 0, 0,
> > +                         &savevm_s390_stattrib_handlers, sas);
> >  
> >      object_property_add_bool(obj, "migration-enabled",
> >                               s390_stattrib_get_migration_enabled,
> >   
> 
> Looks sane to me.
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>


Reviewed-by: Claudio Imbrenda <imbrenda@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
  2018-02-12 15:49 [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static Dr. David Alan Gilbert (git)
  2018-02-12 15:52 ` David Hildenbrand
  2018-02-12 16:19 ` Thomas Huth
@ 2018-02-12 17:06 ` Richard Henderson
  2018-02-13  9:23 ` Cornelia Huck
  3 siblings, 0 replies; 6+ messages in thread
From: Richard Henderson @ 2018-02-12 17:06 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git), qemu-devel, agraf, david

On 02/12/2018 07:49 AM, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> There's no need for this to be dynamic, make it static.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)
> 
> diff --git a/hw/s390x/s390-stattrib.c b/hw/s390x/s390-stattrib.c
> index a1d2135a60..adf07ef312 100644
> --- a/hw/s390x/s390-stattrib.c
> +++ b/hw/s390x/s390-stattrib.c
> @@ -365,22 +365,22 @@ static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value,
>      s->migration_enabled = value;
>  }
>  
> +static SaveVMHandlers savevm_s390_stattrib_handlers = {
> +    .save_setup = cmma_save_setup,
> +    .save_live_iterate = cmma_save_iterate,
> +    .save_live_complete_precopy = cmma_save_complete,
> +    .save_live_pending = cmma_save_pending,
> +    .save_cleanup = cmma_save_cleanup,
> +    .load_state = cmma_load,
> +    .is_active = cmma_active,
> +};

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

Bonus points for the follow-on to make this const.  I realize that
register_savevm_live is not currently prepared for this, so pushing the
qualifier down will take some doing.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static
  2018-02-12 15:49 [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static Dr. David Alan Gilbert (git)
                   ` (2 preceding siblings ...)
  2018-02-12 17:06 ` Richard Henderson
@ 2018-02-13  9:23 ` Cornelia Huck
  3 siblings, 0 replies; 6+ messages in thread
From: Cornelia Huck @ 2018-02-13  9:23 UTC (permalink / raw)
  To: Dr. David Alan Gilbert (git); +Cc: qemu-devel, rth, agraf, david, qemu-s390x

On Mon, 12 Feb 2018 15:49:03 +0000
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:

> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> 
> There's no need for this to be dynamic, make it static.
> 
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  hw/s390x/s390-stattrib.c | 26 +++++++++++++-------------
>  1 file changed, 13 insertions(+), 13 deletions(-)

Thanks, applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-13  9:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-12 15:49 [Qemu-devel] [PATCH] s390/stattrib: Make SaveVMHandlers data static Dr. David Alan Gilbert (git)
2018-02-12 15:52 ` David Hildenbrand
2018-02-12 16:45   ` Claudio Imbrenda
2018-02-12 16:19 ` Thomas Huth
2018-02-12 17:06 ` Richard Henderson
2018-02-13  9:23 ` Cornelia Huck

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).