diff mbox

[20/36] migration: Make all posible migration functions static

Message ID 3790ccfbc3422b657920f40d8914969fbac5320c.1318326684.git.quintela@redhat.com
State New
Headers show

Commit Message

Juan Quintela Oct. 11, 2011, 10 a.m. UTC
I have to move two functions postions to avoid forward declarations

Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c |   72 +++++++++++++++++++++++++++++-----------------------------
 migration.h |   12 ---------
 2 files changed, 36 insertions(+), 48 deletions(-)

Comments

Anthony Liguori Oct. 17, 2011, 2:02 p.m. UTC | #1
On 10/11/2011 05:00 AM, Juan Quintela wrote:
> I have to move two functions postions to avoid forward declarations
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>   migration.c |   72 +++++++++++++++++++++++++++++-----------------------------
>   migration.h |   12 ---------
>   2 files changed, 36 insertions(+), 48 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index f80ad17..5a3e3ad 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -274,15 +274,7 @@ static void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon)
>       }
>   }
>
> -void migrate_fd_error(MigrationState *s)
> -{
> -    DPRINTF("setting error state\n");
> -    s->state = MIG_STATE_ERROR;
> -    notifier_list_notify(&migration_state_notifiers, NULL);
> -    migrate_fd_cleanup(s);
> -}
> -
> -int migrate_fd_cleanup(MigrationState *s)
> +static int migrate_fd_cleanup(MigrationState *s)
>   {
>       int ret = 0;
>
> @@ -308,7 +300,15 @@ int migrate_fd_cleanup(MigrationState *s)
>       return ret;
>   }
>
> -void migrate_fd_put_notify(void *opaque)
> +void migrate_fd_error(MigrationState *s)
> +{
> +    DPRINTF("setting error state\n");
> +    s->state = MIG_STATE_ERROR;
> +    notifier_list_notify(&migration_state_notifiers, NULL);
> +    migrate_fd_cleanup(s);
> +}
> +
> +static void migrate_fd_put_notify(void *opaque)
>   {
>       MigrationState *s = opaque;
>
> @@ -319,7 +319,8 @@ void migrate_fd_put_notify(void *opaque)
>       }
>   }
>
> -ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
> +static ssize_t migrate_fd_put_buffer(void *opaque, const void *data,
> +                                     size_t size)
>   {
>       MigrationState *s = opaque;
>       ssize_t ret;
> @@ -342,29 +343,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
>       return ret;
>   }
>
> -void migrate_fd_connect(MigrationState *s)
> -{
> -    int ret;
> -
> -    s->file = qemu_fopen_ops_buffered(s,
> -                                      s->bandwidth_limit,
> -                                      migrate_fd_put_buffer,
> -                                      migrate_fd_put_ready,
> -                                      migrate_fd_wait_for_unfreeze,
> -                                      migrate_fd_close);
> -
> -    DPRINTF("beginning savevm\n");
> -    ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared);
> -    if (ret<  0) {
> -        DPRINTF("failed, %d\n", ret);
> -        migrate_fd_error(s);
> -        return;
> -    }
> -
> -    migrate_fd_put_ready(s);
> -}
> -
> -void migrate_fd_put_ready(void *opaque)
> +static void migrate_fd_put_ready(void *opaque)
>   {
>       MigrationState *s = opaque;
>       int ret;
> @@ -436,7 +415,7 @@ static void migrate_fd_release(MigrationState *s)
>       g_free(s);
>   }
>
> -void migrate_fd_wait_for_unfreeze(void *opaque)
> +static void migrate_fd_wait_for_unfreeze(void *opaque)
>   {
>       MigrationState *s = opaque;
>       int ret;
> @@ -459,7 +438,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque)
>       }
>   }
>
> -int migrate_fd_close(void *opaque)
> +static int migrate_fd_close(void *opaque)
>   {
>       MigrationState *s = opaque;
>
> @@ -489,6 +468,27 @@ int get_migration_state(void)
>       }
>   }
>
> +void migrate_fd_connect(MigrationState *s)
> +{
> +    int ret;
> +
> +    s->file = qemu_fopen_ops_buffered(s,
> +                                      s->bandwidth_limit,
> +                                      migrate_fd_put_buffer,
> +                                      migrate_fd_put_ready,
> +                                      migrate_fd_wait_for_unfreeze,
> +                                      migrate_fd_close);
> +
> +    DPRINTF("beginning savevm\n");
> +    ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared);
> +    if (ret<  0) {
> +        DPRINTF("failed, %d\n", ret);
> +        migrate_fd_error(s);
> +        return;
> +    }
> +    migrate_fd_put_ready(s);
> +}
> +
>   MigrationState *migrate_new(Monitor *mon, int64_t bandwidth_limit,
>                                        int detach, int blk, int inc)
>   {
> diff --git a/migration.h b/migration.h
> index 5f933e8..892b636 100644
> --- a/migration.h
> +++ b/migration.h
> @@ -100,20 +100,8 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon,
>
>   void migrate_fd_error(MigrationState *s);
>
> -int migrate_fd_cleanup(MigrationState *s);
> -
> -void migrate_fd_put_notify(void *opaque);
> -
> -ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size);
> -
>   void migrate_fd_connect(MigrationState *s);
>
> -void migrate_fd_put_ready(void *opaque);
> -
> -void migrate_fd_wait_for_unfreeze(void *opaque);
> -
> -int migrate_fd_close(void *opaque);
> -
>   MigrationState *migrate_new(Monitor *mon, int64_t bandwidth_limit,
>                               int detach, int blk, int inc);
>
diff mbox

Patch

diff --git a/migration.c b/migration.c
index f80ad17..5a3e3ad 100644
--- a/migration.c
+++ b/migration.c
@@ -274,15 +274,7 @@  static void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon)
     }
 }

-void migrate_fd_error(MigrationState *s)
-{
-    DPRINTF("setting error state\n");
-    s->state = MIG_STATE_ERROR;
-    notifier_list_notify(&migration_state_notifiers, NULL);
-    migrate_fd_cleanup(s);
-}
-
-int migrate_fd_cleanup(MigrationState *s)
+static int migrate_fd_cleanup(MigrationState *s)
 {
     int ret = 0;

@@ -308,7 +300,15 @@  int migrate_fd_cleanup(MigrationState *s)
     return ret;
 }

-void migrate_fd_put_notify(void *opaque)
+void migrate_fd_error(MigrationState *s)
+{
+    DPRINTF("setting error state\n");
+    s->state = MIG_STATE_ERROR;
+    notifier_list_notify(&migration_state_notifiers, NULL);
+    migrate_fd_cleanup(s);
+}
+
+static void migrate_fd_put_notify(void *opaque)
 {
     MigrationState *s = opaque;

@@ -319,7 +319,8 @@  void migrate_fd_put_notify(void *opaque)
     }
 }

-ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
+static ssize_t migrate_fd_put_buffer(void *opaque, const void *data,
+                                     size_t size)
 {
     MigrationState *s = opaque;
     ssize_t ret;
@@ -342,29 +343,7 @@  ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
     return ret;
 }

-void migrate_fd_connect(MigrationState *s)
-{
-    int ret;
-
-    s->file = qemu_fopen_ops_buffered(s,
-                                      s->bandwidth_limit,
-                                      migrate_fd_put_buffer,
-                                      migrate_fd_put_ready,
-                                      migrate_fd_wait_for_unfreeze,
-                                      migrate_fd_close);
-
-    DPRINTF("beginning savevm\n");
-    ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared);
-    if (ret < 0) {
-        DPRINTF("failed, %d\n", ret);
-        migrate_fd_error(s);
-        return;
-    }
-    
-    migrate_fd_put_ready(s);
-}
-
-void migrate_fd_put_ready(void *opaque)
+static void migrate_fd_put_ready(void *opaque)
 {
     MigrationState *s = opaque;
     int ret;
@@ -436,7 +415,7 @@  static void migrate_fd_release(MigrationState *s)
     g_free(s);
 }

-void migrate_fd_wait_for_unfreeze(void *opaque)
+static void migrate_fd_wait_for_unfreeze(void *opaque)
 {
     MigrationState *s = opaque;
     int ret;
@@ -459,7 +438,7 @@  void migrate_fd_wait_for_unfreeze(void *opaque)
     }
 }

-int migrate_fd_close(void *opaque)
+static int migrate_fd_close(void *opaque)
 {
     MigrationState *s = opaque;

@@ -489,6 +468,27 @@  int get_migration_state(void)
     }
 }

+void migrate_fd_connect(MigrationState *s)
+{
+    int ret;
+
+    s->file = qemu_fopen_ops_buffered(s,
+                                      s->bandwidth_limit,
+                                      migrate_fd_put_buffer,
+                                      migrate_fd_put_ready,
+                                      migrate_fd_wait_for_unfreeze,
+                                      migrate_fd_close);
+
+    DPRINTF("beginning savevm\n");
+    ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared);
+    if (ret < 0) {
+        DPRINTF("failed, %d\n", ret);
+        migrate_fd_error(s);
+        return;
+    }
+    migrate_fd_put_ready(s);
+}
+
 MigrationState *migrate_new(Monitor *mon, int64_t bandwidth_limit,
                                      int detach, int blk, int inc)
 {
diff --git a/migration.h b/migration.h
index 5f933e8..892b636 100644
--- a/migration.h
+++ b/migration.h
@@ -100,20 +100,8 @@  MigrationState *fd_start_outgoing_migration(Monitor *mon,

 void migrate_fd_error(MigrationState *s);

-int migrate_fd_cleanup(MigrationState *s);
-
-void migrate_fd_put_notify(void *opaque);
-
-ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size);
-
 void migrate_fd_connect(MigrationState *s);

-void migrate_fd_put_ready(void *opaque);
-
-void migrate_fd_wait_for_unfreeze(void *opaque);
-
-int migrate_fd_close(void *opaque);
-
 MigrationState *migrate_new(Monitor *mon, int64_t bandwidth_limit,
                             int detach, int blk, int inc);