Patchwork [10/12] migration: move qemu_fclose to process_incoming_migration

login
register
mail settings
Submitter Paolo Bonzini
Date Oct. 18, 2012, 10:22 a.m.
Message ID <1350555758-29988-11-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/192283/
State New
Headers show

Comments

Paolo Bonzini - Oct. 18, 2012, 10:22 a.m.
The common suffix is now just process_incoming_migration.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 migration-exec.c | 1 -
 migration-fd.c   | 1 -
 migration-tcp.c  | 1 -
 migration-unix.c | 1 -
 migration.c      | 6 +++++-
 5 file modificati, 5 inserzioni(+), 5 rimozioni(-)
Orit Wasserman - Oct. 28, 2012, 9:56 a.m.
On 10/18/2012 12:22 PM, Paolo Bonzini wrote:
> The common suffix is now just process_incoming_migration.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  migration-exec.c | 1 -
>  migration-fd.c   | 1 -
>  migration-tcp.c  | 1 -
>  migration-unix.c | 1 -
>  migration.c      | 6 +++++-
>  5 file modificati, 5 inserzioni(+), 5 rimozioni(-)
> 
> diff --git a/migration-exec.c b/migration-exec.c
> index 1c562ab..89576d8 100644
> --- a/migration-exec.c
> +++ b/migration-exec.c
> @@ -97,7 +97,6 @@ static void exec_accept_incoming_migration(void *opaque)
>  
>      qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
>      process_incoming_migration(f);
> -    qemu_fclose(f);
>  }
>  
>  int exec_start_incoming_migration(const char *command)
> diff --git a/migration-fd.c b/migration-fd.c
> index 67ee3d1..ef7c9de 100644
> --- a/migration-fd.c
> +++ b/migration-fd.c
> @@ -102,7 +102,6 @@ static void fd_accept_incoming_migration(void *opaque)
>  
>      qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
>      process_incoming_migration(f);
> -    qemu_fclose(f);
>  }
>  
>  int fd_start_incoming_migration(const char *infd)
> diff --git a/migration-tcp.c b/migration-tcp.c
> index 463f7f6..f68692e 100644
> --- a/migration-tcp.c
> +++ b/migration-tcp.c
> @@ -110,7 +110,6 @@ static void tcp_accept_incoming_migration(void *opaque)
>      }
>  
>      process_incoming_migration(f);
> -    qemu_fclose(f);
>      return;
>  
>  out:
> diff --git a/migration-unix.c b/migration-unix.c
> index 46e04fc..f0411cf 100644
> --- a/migration-unix.c
> +++ b/migration-unix.c
> @@ -143,7 +143,6 @@ static void unix_accept_incoming_migration(void *opaque)
>      }
>  
>      process_incoming_migration(f);
> -    qemu_fclose(f);
>      return;
>  
>  out:
> diff --git a/migration.c b/migration.c
> index c1807e0..0d74753 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -88,7 +88,11 @@ int qemu_start_incoming_migration(const char *uri, Error **errp)
>  
>  void process_incoming_migration(QEMUFile *f)
>  {
> -    if (qemu_loadvm_state(f) < 0) {
> +    int ret;
> +
> +    ret = qemu_loadvm_state(f);
> +    qemu_fclose(f);
> +    if (ret < 0) {
>          fprintf(stderr, "load of migration failed\n");
>          exit(0);
>      }
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>

Patch

diff --git a/migration-exec.c b/migration-exec.c
index 1c562ab..89576d8 100644
--- a/migration-exec.c
+++ b/migration-exec.c
@@ -97,7 +97,6 @@  static void exec_accept_incoming_migration(void *opaque)
 
     qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
     process_incoming_migration(f);
-    qemu_fclose(f);
 }
 
 int exec_start_incoming_migration(const char *command)
diff --git a/migration-fd.c b/migration-fd.c
index 67ee3d1..ef7c9de 100644
--- a/migration-fd.c
+++ b/migration-fd.c
@@ -102,7 +102,6 @@  static void fd_accept_incoming_migration(void *opaque)
 
     qemu_set_fd_handler2(qemu_get_fd(f), NULL, NULL, NULL, NULL);
     process_incoming_migration(f);
-    qemu_fclose(f);
 }
 
 int fd_start_incoming_migration(const char *infd)
diff --git a/migration-tcp.c b/migration-tcp.c
index 463f7f6..f68692e 100644
--- a/migration-tcp.c
+++ b/migration-tcp.c
@@ -110,7 +110,6 @@  static void tcp_accept_incoming_migration(void *opaque)
     }
 
     process_incoming_migration(f);
-    qemu_fclose(f);
     return;
 
 out:
diff --git a/migration-unix.c b/migration-unix.c
index 46e04fc..f0411cf 100644
--- a/migration-unix.c
+++ b/migration-unix.c
@@ -143,7 +143,6 @@  static void unix_accept_incoming_migration(void *opaque)
     }
 
     process_incoming_migration(f);
-    qemu_fclose(f);
     return;
 
 out:
diff --git a/migration.c b/migration.c
index c1807e0..0d74753 100644
--- a/migration.c
+++ b/migration.c
@@ -88,7 +88,11 @@  int qemu_start_incoming_migration(const char *uri, Error **errp)
 
 void process_incoming_migration(QEMUFile *f)
 {
-    if (qemu_loadvm_state(f) < 0) {
+    int ret;
+
+    ret = qemu_loadvm_state(f);
+    qemu_fclose(f);
+    if (ret < 0) {
         fprintf(stderr, "load of migration failed\n");
         exit(0);
     }