s390/stattrib: Make SaveVMHandlers data static
PATCH 1/1 s390/stattrib: Make SaveVMHandlers data static
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
hw/s390x/s390-stattrib.c +13 -13
@@ -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,
Signature · 1 line
2.14.3
Quoted 40 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)hw/s390x/s390-stattrib.c +10
-9@@ -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;
hw/s390x/s390-stattrib.c static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value, · line 386
Quoted 10 lines
hw/s390x/s390-stattrib.c +3
-4- 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.
Signature · 3 lines
Thanks, David / dhildenb
Claudio Imbrenda
Reviewed-byQuoted 48 lines · On Mon, 12 Feb 2018 16:52:08 +0100 David Hildenbrand <[email protected]> wrote:
Quoted 47 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)hw/s390x/s390-stattrib.c +13
-13@@ -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);
Quoted 7 lines
hw/s390x/s390-stattrib.c static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value, · line 386
Quoted 3 lines
hw/s390x/s390-stattrib.c +0
-0object_property_add_bool(obj, "migration-enabled", s390_stattrib_get_migration_enabled,Looks sane to me.
Reviewed-by David Hildenbrand <[email protected]>
Quoted 40 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)hw/s390x/s390-stattrib.c +10
-9@@ -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;
hw/s390x/s390-stattrib.c static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value, · line 386
Quoted 10 lines
hw/s390x/s390-stattrib.c +3
-4- 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,
Quoted 16 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)hw/s390x/s390-stattrib.c +0
-0@@ -365,22 +365,22 @@ static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value, s->migration_enabled = value; }
hw/s390x/s390-stattrib.c static inline void s390_stattrib_set_migration_enabled(Object *obj, bool value, · line 376
Quoted 10 lines
hw/s390x/s390-stattrib.c +9
-0+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, +};
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~
Cornelia Huck
AppliedQuoted 8 lines · On Mon, 12 Feb 2018 15:49:03 +0000 "Dr. David Alan Gilbert (git)"…
From: "Dr. David Alan Gilbert" <[email protected]>
There's no need for this to be dynamic, make it static.
Signed-off-by Dr. David Alan Gilbert <[email protected]>--- hw/s390x/s390-stattrib.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
Thanks, applied.