Patchwork [v3] vmstate: Make vmstate_register() static inline

login
register
mail settings
Submitter Andreas Färber
Date Feb. 18, 2013, 8:47 p.m.
Message ID <1361220435-16956-1-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/221521/
State New
Headers show

Comments

Andreas Färber - Feb. 18, 2013, 8:47 p.m.
This avoids adding a duplicate stub for CONFIG_USER_ONLY.

Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/migration/vmstate.h |   12 ++++++++++--
 savevm.c                    |    7 -------
 2 Dateien geändert, 10 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-)
Eduardo Habkost - Feb. 19, 2013, 1:44 p.m.
On Mon, Feb 18, 2013 at 09:47:15PM +0100, Andreas Färber wrote:
> This avoids adding a duplicate stub for CONFIG_USER_ONLY.
> 
> Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

> ---
>  include/migration/vmstate.h |   12 ++++++++++--
>  savevm.c                    |    7 -------
>  2 Dateien geändert, 10 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-)
> 
> diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
> index f27276c..6d50f6e 100644
> --- a/include/migration/vmstate.h
> +++ b/include/migration/vmstate.h
> @@ -623,12 +623,20 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>                         void *opaque, int version_id);
>  void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
>                          void *opaque);
> -int vmstate_register(DeviceState *dev, int instance_id,
> -                     const VMStateDescription *vmsd, void *base);
> +
>  int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
>                                     const VMStateDescription *vmsd,
>                                     void *base, int alias_id,
>                                     int required_for_version);
> +
> +static inline int vmstate_register(DeviceState *dev, int instance_id,
> +                                   const VMStateDescription *vmsd,
> +                                   void *opaque)
> +{
> +    return vmstate_register_with_alias_id(dev, instance_id, vmsd,
> +                                          opaque, -1, 0);
> +}
> +
>  void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
>                          void *opaque);
>  
> diff --git a/savevm.c b/savevm.c
> index a8a53ef..9a4031a 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1380,13 +1380,6 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
>      return 0;
>  }
>  
> -int vmstate_register(DeviceState *dev, int instance_id,
> -                     const VMStateDescription *vmsd, void *opaque)
> -{
> -    return vmstate_register_with_alias_id(dev, instance_id, vmsd,
> -                                          opaque, -1, 0);
> -}
> -
>  void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
>                          void *opaque)
>  {
> -- 
> 1.7.10.4
>
Juan Quintela - Feb. 22, 2013, 1:05 p.m.
Andreas Färber <afaerber@suse.de> wrote:
> This avoids adding a duplicate stub for CONFIG_USER_ONLY.
>
> Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>

Reviewed-by: Juan Quintela <quintela@redhat.com>

Patch

diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
index f27276c..6d50f6e 100644
--- a/include/migration/vmstate.h
+++ b/include/migration/vmstate.h
@@ -623,12 +623,20 @@  int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
                        void *opaque, int version_id);
 void vmstate_save_state(QEMUFile *f, const VMStateDescription *vmsd,
                         void *opaque);
-int vmstate_register(DeviceState *dev, int instance_id,
-                     const VMStateDescription *vmsd, void *base);
+
 int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
                                    const VMStateDescription *vmsd,
                                    void *base, int alias_id,
                                    int required_for_version);
+
+static inline int vmstate_register(DeviceState *dev, int instance_id,
+                                   const VMStateDescription *vmsd,
+                                   void *opaque)
+{
+    return vmstate_register_with_alias_id(dev, instance_id, vmsd,
+                                          opaque, -1, 0);
+}
+
 void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
                         void *opaque);
 
diff --git a/savevm.c b/savevm.c
index a8a53ef..9a4031a 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1380,13 +1380,6 @@  int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
     return 0;
 }
 
-int vmstate_register(DeviceState *dev, int instance_id,
-                     const VMStateDescription *vmsd, void *opaque)
-{
-    return vmstate_register_with_alias_id(dev, instance_id, vmsd,
-                                          opaque, -1, 0);
-}
-
 void vmstate_unregister(DeviceState *dev, const VMStateDescription *vmsd,
                         void *opaque)
 {