]> git.proxmox.com Git - qemu.git/blobdiff - migration-fd.c
usb-musb: Take a DeviceState* in init function
[qemu.git] / migration-fd.c
index 0cc74ad8b20bd282fc245d0d024fe17aa4b05cea..aee690aaed1388a2f7e7122e8b653eeed1e7db96 100644 (file)
@@ -16,7 +16,6 @@
 #include "migration.h"
 #include "monitor.h"
 #include "qemu-char.h"
-#include "sysemu.h"
 #include "buffered_file.h"
 #include "block.h"
 #include "qemu_socket.h"
@@ -60,7 +59,7 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon,
 {
     FdMigrationState *s;
 
-    s = qemu_mallocz(sizeof(*s));
+    s = g_malloc0(sizeof(*s));
 
     s->fd = monitor_get_fd(mon, fdname);
     if (s->fd == -1) {
@@ -97,28 +96,16 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon,
 err_after_open:
     close(s->fd);
 err_after_alloc:
-    qemu_free(s);
+    g_free(s);
     return NULL;
 }
 
 static void fd_accept_incoming_migration(void *opaque)
 {
     QEMUFile *f = opaque;
-    int ret;
 
-    ret = qemu_loadvm_state(f);
-    if (ret < 0) {
-        fprintf(stderr, "load of migration failed\n");
-        goto err;
-    }
-    qemu_announce_self();
-    DPRINTF("successfully loaded vm state\n");
-    /* we've successfully migrated, close the fd */
+    process_incoming_migration(f);
     qemu_set_fd_handler2(qemu_stdio_fd(f), NULL, NULL, NULL, NULL);
-    if (autostart)
-        vm_start();
-
-err:
     qemu_fclose(f);
 }
 
@@ -136,8 +123,7 @@ int fd_start_incoming_migration(const char *infd)
         return -errno;
     }
 
-    qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL,
-                        (void *)(unsigned long)f);
+    qemu_set_fd_handler2(fd, NULL, fd_accept_incoming_migration, NULL, f);
 
     return 0;
 }