diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-11 08:30:34 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2013-03-11 08:30:34 -0500 |
commit | fe3cc14fd83e0c8f376d849ccd0fc3433388442d (patch) | |
tree | 8a354b91eab8a1ac16b4186f9fbb2a75772b75fe /migration-unix.c | |
parent | bba18e23f7266d63734fd31045fec7794cc34a38 (diff) | |
parent | ee0b44aa9d9450e873a761ca2030b2fa3ec52eb0 (diff) |
Merge remote-tracking branch 'quintela/migration.next' into staging
# By Paolo Bonzini (40) and others
# Via Juan Quintela
* quintela/migration.next: (46 commits)
page_cache: dup memory on insert
page_cache: fix memory leak
Fix cache_resize to keep old entry age
Fix page_cache leak in cache_resize
migration: inline migrate_fd_close
migration: eliminate s->migration_file
migration: move contents of migration_close to migrate_fd_cleanup
migration: move rate limiting to QEMUFile
migration: small changes around rate-limiting
migration: use qemu_ftell to compute bandwidth
migration: use QEMUFile for writing outgoing migration data
migration: use QEMUFile for migration channel lifetime
qemu-file: simplify and export qemu_ftell
qemu-file: add writable socket QEMUFile
qemu-file: check exit status when closing a pipe QEMUFile
qemu-file: fsync a writable stdio QEMUFile
migration: merge qemu_popen_cmd with qemu_popen
migration: use qemu_file_rate_limit consistently
migration: remove useless qemu_file_get_error check
migration: detect error before sleeping
...
Diffstat (limited to 'migration-unix.c')
-rw-r--r-- | migration-unix.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/migration-unix.c b/migration-unix.c index 218835a7a4..94b7022fc8 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -29,49 +29,24 @@ do { } while (0) #endif -static int unix_errno(MigrationState *s) -{ - return errno; -} - -static int unix_write(MigrationState *s, const void * buf, size_t size) -{ - return write(s->fd, buf, size); -} - -static int unix_close(MigrationState *s) -{ - int r = 0; - DPRINTF("unix_close\n"); - if (close(s->fd) < 0) { - r = -errno; - } - return r; -} - static void unix_wait_for_connect(int fd, void *opaque) { MigrationState *s = opaque; if (fd < 0) { DPRINTF("migrate connect error\n"); - s->fd = -1; + s->file = NULL; migrate_fd_error(s); } else { DPRINTF("migrate connect success\n"); - s->fd = fd; - socket_set_block(s->fd); + s->file = qemu_fopen_socket(fd, "wb"); migrate_fd_connect(s); } } void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp) { - s->get_error = unix_errno; - s->write = unix_write; - s->close = unix_close; - - s->fd = unix_nonblocking_connect(path, unix_wait_for_connect, s, errp); + unix_nonblocking_connect(path, unix_wait_for_connect, s, errp); } static void unix_accept_incoming_migration(void *opaque) @@ -95,7 +70,7 @@ static void unix_accept_incoming_migration(void *opaque) goto out; } - f = qemu_fopen_socket(c); + f = qemu_fopen_socket(c, "rb"); if (f == NULL) { fprintf(stderr, "could not qemu_fopen socket\n"); goto out; |