Commit ff8d81d84a9f6dbff6f467880b40468547acb559
1 parent
88d2d9e0
Fix whitespace in migration code.
Replace tabs with spaces. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5527 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
45 additions
and
45 deletions
migration-tcp.c
| @@ -45,8 +45,8 @@ int debug_me = 0; | @@ -45,8 +45,8 @@ int debug_me = 0; | ||
| 45 | static void tcp_cleanup(FdMigrationState *s) | 45 | static void tcp_cleanup(FdMigrationState *s) |
| 46 | { | 46 | { |
| 47 | if (s->detach == 2) { | 47 | if (s->detach == 2) { |
| 48 | - monitor_resume(); | ||
| 49 | - s->detach = 0; | 48 | + monitor_resume(); |
| 49 | + s->detach = 0; | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); | 52 | qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); |
| @@ -54,11 +54,11 @@ static void tcp_cleanup(FdMigrationState *s) | @@ -54,11 +54,11 @@ static void tcp_cleanup(FdMigrationState *s) | ||
| 54 | if (s->file) { | 54 | if (s->file) { |
| 55 | debug_me = 1; | 55 | debug_me = 1; |
| 56 | dprintf("closing file\n"); | 56 | dprintf("closing file\n"); |
| 57 | - qemu_fclose(s->file); | 57 | + qemu_fclose(s->file); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | if (s->fd != -1) | 60 | if (s->fd != -1) |
| 61 | - close(s->fd); | 61 | + close(s->fd); |
| 62 | 62 | ||
| 63 | s->fd = -1; | 63 | s->fd = -1; |
| 64 | } | 64 | } |
| @@ -101,8 +101,8 @@ static int fd_close(void *opaque) | @@ -101,8 +101,8 @@ static int fd_close(void *opaque) | ||
| 101 | FdMigrationState *s = opaque; | 101 | FdMigrationState *s = opaque; |
| 102 | dprintf("fd_close\n"); | 102 | dprintf("fd_close\n"); |
| 103 | if (s->fd != -1) { | 103 | if (s->fd != -1) { |
| 104 | - close(s->fd); | ||
| 105 | - s->fd = -1; | 104 | + close(s->fd); |
| 105 | + s->fd = -1; | ||
| 106 | } | 106 | } |
| 107 | return 0; | 107 | return 0; |
| 108 | } | 108 | } |
| @@ -114,7 +114,7 @@ static void fd_wait_for_unfreeze(void *opaque) | @@ -114,7 +114,7 @@ static void fd_wait_for_unfreeze(void *opaque) | ||
| 114 | 114 | ||
| 115 | dprintf("wait for unfreeze\n"); | 115 | dprintf("wait for unfreeze\n"); |
| 116 | if (s->state != MIG_STATE_ACTIVE) | 116 | if (s->state != MIG_STATE_ACTIVE) |
| 117 | - return; | 117 | + return; |
| 118 | 118 | ||
| 119 | do { | 119 | do { |
| 120 | fd_set wfds; | 120 | fd_set wfds; |
| @@ -132,7 +132,7 @@ static void fd_put_ready(void *opaque) | @@ -132,7 +132,7 @@ static void fd_put_ready(void *opaque) | ||
| 132 | 132 | ||
| 133 | if (s->state != MIG_STATE_ACTIVE) { | 133 | if (s->state != MIG_STATE_ACTIVE) { |
| 134 | dprintf("put_ready returning because of non-active state\n"); | 134 | dprintf("put_ready returning because of non-active state\n"); |
| 135 | - return; | 135 | + return; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | dprintf("iterate\n"); | 138 | dprintf("iterate\n"); |
| @@ -142,8 +142,8 @@ static void fd_put_ready(void *opaque) | @@ -142,8 +142,8 @@ static void fd_put_ready(void *opaque) | ||
| 142 | 142 | ||
| 143 | bdrv_flush_all(); | 143 | bdrv_flush_all(); |
| 144 | qemu_savevm_state_complete(s->file); | 144 | qemu_savevm_state_complete(s->file); |
| 145 | - s->state = MIG_STATE_COMPLETED; | ||
| 146 | - tcp_cleanup(s); | 145 | + s->state = MIG_STATE_COMPLETED; |
| 146 | + tcp_cleanup(s); | ||
| 147 | } | 147 | } |
| 148 | } | 148 | } |
| 149 | 149 | ||
| @@ -162,7 +162,7 @@ static void tcp_connect_migrate(FdMigrationState *s) | @@ -162,7 +162,7 @@ static void tcp_connect_migrate(FdMigrationState *s) | ||
| 162 | ret = qemu_savevm_state_begin(s->file); | 162 | ret = qemu_savevm_state_begin(s->file); |
| 163 | if (ret < 0) { | 163 | if (ret < 0) { |
| 164 | dprintf("failed, %d\n", ret); | 164 | dprintf("failed, %d\n", ret); |
| 165 | - tcp_error(s); | 165 | + tcp_error(s); |
| 166 | return; | 166 | return; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| @@ -181,7 +181,7 @@ static void tcp_wait_for_connect(void *opaque) | @@ -181,7 +181,7 @@ static void tcp_wait_for_connect(void *opaque) | ||
| 181 | } while (ret == -1 && socket_error() == EINTR); | 181 | } while (ret == -1 && socket_error() == EINTR); |
| 182 | 182 | ||
| 183 | if (ret < 0) { | 183 | if (ret < 0) { |
| 184 | - tcp_error(s); | 184 | + tcp_error(s); |
| 185 | return; | 185 | return; |
| 186 | } | 186 | } |
| 187 | 187 | ||
| @@ -191,7 +191,7 @@ static void tcp_wait_for_connect(void *opaque) | @@ -191,7 +191,7 @@ static void tcp_wait_for_connect(void *opaque) | ||
| 191 | tcp_connect_migrate(s); | 191 | tcp_connect_migrate(s); |
| 192 | else { | 192 | else { |
| 193 | dprintf("error connecting %d\n", val); | 193 | dprintf("error connecting %d\n", val); |
| 194 | - tcp_error(s); | 194 | + tcp_error(s); |
| 195 | } | 195 | } |
| 196 | } | 196 | } |
| 197 | 197 | ||
| @@ -212,7 +212,7 @@ static void tcp_cancel(MigrationState *mig_state) | @@ -212,7 +212,7 @@ static void tcp_cancel(MigrationState *mig_state) | ||
| 212 | FdMigrationState *s = to_fms(mig_state); | 212 | FdMigrationState *s = to_fms(mig_state); |
| 213 | 213 | ||
| 214 | if (s->state != MIG_STATE_ACTIVE) | 214 | if (s->state != MIG_STATE_ACTIVE) |
| 215 | - return; | 215 | + return; |
| 216 | 216 | ||
| 217 | dprintf("cancelling migration\n"); | 217 | dprintf("cancelling migration\n"); |
| 218 | 218 | ||
| @@ -228,15 +228,15 @@ static void tcp_release(MigrationState *mig_state) | @@ -228,15 +228,15 @@ static void tcp_release(MigrationState *mig_state) | ||
| 228 | dprintf("releasing state\n"); | 228 | dprintf("releasing state\n"); |
| 229 | 229 | ||
| 230 | if (s->state == MIG_STATE_ACTIVE) { | 230 | if (s->state == MIG_STATE_ACTIVE) { |
| 231 | - s->state = MIG_STATE_CANCELLED; | ||
| 232 | - tcp_cleanup(s); | 231 | + s->state = MIG_STATE_CANCELLED; |
| 232 | + tcp_cleanup(s); | ||
| 233 | } | 233 | } |
| 234 | free(s); | 234 | free(s); |
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | MigrationState *tcp_start_outgoing_migration(const char *host_port, | 237 | MigrationState *tcp_start_outgoing_migration(const char *host_port, |
| 238 | - int64_t bandwidth_limit, | ||
| 239 | - int async) | 238 | + int64_t bandwidth_limit, |
| 239 | + int async) | ||
| 240 | { | 240 | { |
| 241 | struct sockaddr_in addr; | 241 | struct sockaddr_in addr; |
| 242 | FdMigrationState *s; | 242 | FdMigrationState *s; |
| @@ -259,7 +259,7 @@ MigrationState *tcp_start_outgoing_migration(const char *host_port, | @@ -259,7 +259,7 @@ MigrationState *tcp_start_outgoing_migration(const char *host_port, | ||
| 259 | s->fd = socket(PF_INET, SOCK_STREAM, 0); | 259 | s->fd = socket(PF_INET, SOCK_STREAM, 0); |
| 260 | if (s->fd == -1) { | 260 | if (s->fd == -1) { |
| 261 | qemu_free(s); | 261 | qemu_free(s); |
| 262 | - return NULL; | 262 | + return NULL; |
| 263 | } | 263 | } |
| 264 | 264 | ||
| 265 | socket_set_nonblock(s->fd); | 265 | socket_set_nonblock(s->fd); |
| @@ -267,7 +267,7 @@ MigrationState *tcp_start_outgoing_migration(const char *host_port, | @@ -267,7 +267,7 @@ MigrationState *tcp_start_outgoing_migration(const char *host_port, | ||
| 267 | if (s->detach == 1) { | 267 | if (s->detach == 1) { |
| 268 | dprintf("detaching from monitor\n"); | 268 | dprintf("detaching from monitor\n"); |
| 269 | monitor_suspend(); | 269 | monitor_suspend(); |
| 270 | - s->detach = 2; | 270 | + s->detach = 2; |
| 271 | } | 271 | } |
| 272 | 272 | ||
| 273 | do { | 273 | do { |
migration.c
| @@ -36,17 +36,17 @@ void do_migrate(int detach, const char *uri) | @@ -36,17 +36,17 @@ void do_migrate(int detach, const char *uri) | ||
| 36 | const char *p; | 36 | const char *p; |
| 37 | 37 | ||
| 38 | if (strstart(uri, "tcp:", &p)) | 38 | if (strstart(uri, "tcp:", &p)) |
| 39 | - s = tcp_start_outgoing_migration(p, max_throttle, detach); | 39 | + s = tcp_start_outgoing_migration(p, max_throttle, detach); |
| 40 | else | 40 | else |
| 41 | term_printf("unknown migration protocol: %s\n", uri); | 41 | term_printf("unknown migration protocol: %s\n", uri); |
| 42 | 42 | ||
| 43 | if (s == NULL) | 43 | if (s == NULL) |
| 44 | - term_printf("migration failed\n"); | 44 | + term_printf("migration failed\n"); |
| 45 | else { | 45 | else { |
| 46 | - if (current_migration) | ||
| 47 | - current_migration->release(current_migration); | 46 | + if (current_migration) |
| 47 | + current_migration->release(current_migration); | ||
| 48 | 48 | ||
| 49 | - current_migration = s; | 49 | + current_migration = s; |
| 50 | } | 50 | } |
| 51 | } | 51 | } |
| 52 | 52 | ||
| @@ -55,7 +55,7 @@ void do_migrate_cancel(void) | @@ -55,7 +55,7 @@ void do_migrate_cancel(void) | ||
| 55 | MigrationState *s = current_migration; | 55 | MigrationState *s = current_migration; |
| 56 | 56 | ||
| 57 | if (s) | 57 | if (s) |
| 58 | - s->cancel(s); | 58 | + s->cancel(s); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | void do_migrate_set_speed(const char *value) | 61 | void do_migrate_set_speed(const char *value) |
| @@ -66,13 +66,13 @@ void do_migrate_set_speed(const char *value) | @@ -66,13 +66,13 @@ void do_migrate_set_speed(const char *value) | ||
| 66 | d = strtod(value, &ptr); | 66 | d = strtod(value, &ptr); |
| 67 | switch (*ptr) { | 67 | switch (*ptr) { |
| 68 | case 'G': case 'g': | 68 | case 'G': case 'g': |
| 69 | - d *= 1024; | 69 | + d *= 1024; |
| 70 | case 'M': case 'm': | 70 | case 'M': case 'm': |
| 71 | - d *= 1024; | 71 | + d *= 1024; |
| 72 | case 'K': case 'k': | 72 | case 'K': case 'k': |
| 73 | - d *= 1024; | 73 | + d *= 1024; |
| 74 | default: | 74 | default: |
| 75 | - break; | 75 | + break; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | max_throttle = (uint32_t)d; | 78 | max_throttle = (uint32_t)d; |
| @@ -83,21 +83,21 @@ void do_info_migrate(void) | @@ -83,21 +83,21 @@ void do_info_migrate(void) | ||
| 83 | MigrationState *s = current_migration; | 83 | MigrationState *s = current_migration; |
| 84 | 84 | ||
| 85 | if (s) { | 85 | if (s) { |
| 86 | - term_printf("Migration status: "); | ||
| 87 | - switch (s->get_status(s)) { | ||
| 88 | - case MIG_STATE_ACTIVE: | ||
| 89 | - term_printf("active\n"); | ||
| 90 | - break; | ||
| 91 | - case MIG_STATE_COMPLETED: | ||
| 92 | - term_printf("completed\n"); | ||
| 93 | - break; | ||
| 94 | - case MIG_STATE_ERROR: | ||
| 95 | - term_printf("failed\n"); | ||
| 96 | - break; | ||
| 97 | - case MIG_STATE_CANCELLED: | ||
| 98 | - term_printf("cancelled\n"); | ||
| 99 | - break; | ||
| 100 | - } | 86 | + term_printf("Migration status: "); |
| 87 | + switch (s->get_status(s)) { | ||
| 88 | + case MIG_STATE_ACTIVE: | ||
| 89 | + term_printf("active\n"); | ||
| 90 | + break; | ||
| 91 | + case MIG_STATE_COMPLETED: | ||
| 92 | + term_printf("completed\n"); | ||
| 93 | + break; | ||
| 94 | + case MIG_STATE_ERROR: | ||
| 95 | + term_printf("failed\n"); | ||
| 96 | + break; | ||
| 97 | + case MIG_STATE_CANCELLED: | ||
| 98 | + term_printf("cancelled\n"); | ||
| 99 | + break; | ||
| 100 | + } | ||
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| 103 | 103 |