From faff30d200680e486fd5d6b3e1c6826ab6e80d9d Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Wed, 19 Oct 2011 23:47:36 +0200 Subject: [PATCH 01/19] migration: s/dprintf/DPRINTF/ RH-Author: Juan Quintela Message-id: <433e248a16676fe2e184c2f73c1d91b71dcbdaf1.1319066770.git.quintela@redhat.com> Patchwork-id: 34430 O-Subject: [PATCH qemu-kvm RHEL-6.2 01/16] migration: s/dprintf/DPRINTF/ Bugzilla: 669581 RH-Acked-by: Amit Shah RH-Acked-by: Markus Armbruster RH-Acked-by: Orit Wasserman Reduces lots of conflicts with upstream. Signed-off-by: Juan Quintela --- block-migration.c | 10 +++++----- buffered_file.c | 40 ++++++++++++++++++++-------------------- migration-exec.c | 14 +++++++------- migration-fd.c | 14 +++++++------- migration-tcp.c | 14 +++++++------- migration-unix.c | 18 +++++++++--------- migration.c | 32 ++++++++++++++++---------------- 7 files changed, 71 insertions(+), 71 deletions(-) Signed-off-by: Michal Novotny --- block-migration.c | 10 +++++----- buffered_file.c | 40 ++++++++++++++++++++-------------------- migration-exec.c | 14 +++++++------- migration-fd.c | 14 +++++++------- migration-tcp.c | 14 +++++++------- migration-unix.c | 18 +++++++++--------- migration.c | 32 ++++++++++++++++---------------- 7 files changed, 71 insertions(+), 71 deletions(-) diff --git a/block-migration.c b/block-migration.c index fa15a99..4233a3f 100644 --- a/block-migration.c +++ b/block-migration.c @@ -33,10 +33,10 @@ //#define DEBUG_BLK_MIGRATION #ifdef DEBUG_BLK_MIGRATION -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("blk_migration: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -336,7 +336,7 @@ static void flush_blks(QEMUFile* f) { BlkMigBlock *blk; - dprintf("%s Enter submitted %d read_done %d transferred %d\n", + DPRINTF("%s Enter submitted %d read_done %d transferred %d\n", __FUNCTION__, block_mig_state.submitted, block_mig_state.read_done, block_mig_state.transferred); @@ -359,7 +359,7 @@ static void flush_blks(QEMUFile* f) assert(block_mig_state.read_done >= 0); } - dprintf("%s Exit submitted %d read_done %d transferred %d\n", __FUNCTION__, + DPRINTF("%s Exit submitted %d read_done %d transferred %d\n", __FUNCTION__, block_mig_state.submitted, block_mig_state.read_done, block_mig_state.transferred); } @@ -405,7 +405,7 @@ static void blk_mig_cleanup(Monitor *mon) static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) { - dprintf("Enter save live stage %d submitted %d transferred %d\n", + DPRINTF("Enter save live stage %d submitted %d transferred %d\n", stage, block_mig_state.submitted, block_mig_state.transferred); if (stage < 0) { diff --git a/buffered_file.c b/buffered_file.c index a89d760..1836e7e 100644 --- a/buffered_file.c +++ b/buffered_file.c @@ -39,10 +39,10 @@ typedef struct QEMUFileBuffered } QEMUFileBuffered; #ifdef DEBUG_BUFFERED_FILE -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("buffered-file: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -52,7 +52,7 @@ static void buffered_append(QEMUFileBuffered *s, if (size > (s->buffer_capacity - s->buffer_size)) { void *tmp; - dprintf("increasing buffer capacity from %zu by %zu\n", + DPRINTF("increasing buffer capacity from %zu by %zu\n", s->buffer_capacity, size + 1024); s->buffer_capacity += size + 1024; @@ -75,11 +75,11 @@ static void buffered_flush(QEMUFileBuffered *s) size_t offset = 0; if (s->has_error) { - dprintf("flush when error, bailing\n"); + DPRINTF("flush when error, bailing\n"); return; } - dprintf("flushing %zu byte(s) of data\n", s->buffer_size); + DPRINTF("flushing %zu byte(s) of data\n", s->buffer_size); while (offset < s->buffer_size) { ssize_t ret; @@ -87,22 +87,22 @@ static void buffered_flush(QEMUFileBuffered *s) ret = s->put_buffer(s->opaque, s->buffer + offset, s->buffer_size - offset); if (ret == -EAGAIN) { - dprintf("backend not ready, freezing\n"); + DPRINTF("backend not ready, freezing\n"); s->freeze_output = 1; break; } if (ret <= 0) { - dprintf("error flushing data, %zd\n", ret); + DPRINTF("error flushing data, %zd\n", ret); s->has_error = 1; break; } else { - dprintf("flushed %zd byte(s)\n", ret); + DPRINTF("flushed %zd byte(s)\n", ret); offset += ret; } } - dprintf("flushed %zu of %zu byte(s)\n", offset, s->buffer_size); + DPRINTF("flushed %zu of %zu byte(s)\n", offset, s->buffer_size); memmove(s->buffer, s->buffer + offset, s->buffer_size - offset); s->buffer_size -= offset; } @@ -113,53 +113,53 @@ static int buffered_put_buffer(void *opaque, const uint8_t *buf, int64_t pos, in int offset = 0; ssize_t ret; - dprintf("putting %d bytes at %" PRId64 "\n", size, pos); + DPRINTF("putting %d bytes at %" PRId64 "\n", size, pos); if (s->has_error) { - dprintf("flush when error, bailing\n"); + DPRINTF("flush when error, bailing\n"); return -EINVAL; } - dprintf("unfreezing output\n"); + DPRINTF("unfreezing output\n"); s->freeze_output = 0; buffered_flush(s); while (!s->freeze_output && offset < size) { if (s->bytes_xfer > s->xfer_limit) { - dprintf("transfer limit exceeded when putting\n"); + DPRINTF("transfer limit exceeded when putting\n"); break; } ret = s->put_buffer(s->opaque, buf + offset, size - offset); if (ret == -EAGAIN) { - dprintf("backend not ready, freezing\n"); + DPRINTF("backend not ready, freezing\n"); s->freeze_output = 1; break; } if (ret <= 0) { - dprintf("error putting\n"); + DPRINTF("error putting\n"); s->has_error = 1; offset = -EINVAL; break; } - dprintf("put %zd byte(s)\n", ret); + DPRINTF("put %zd byte(s)\n", ret); offset += ret; s->bytes_xfer += ret; } if (offset >= 0) { - dprintf("buffering %d bytes\n", size - offset); + DPRINTF("buffering %d bytes\n", size - offset); buffered_append(s, buf + offset, size - offset); offset = size; } if (pos == 0 && size == 0) { - dprintf("file is ready\n"); + DPRINTF("file is ready\n"); if (s->bytes_xfer <= s->xfer_limit) { - dprintf("notifying client\n"); + DPRINTF("notifying client\n"); s->put_ready(s->opaque); } } @@ -172,7 +172,7 @@ static int buffered_close(void *opaque) QEMUFileBuffered *s = opaque; int ret; - dprintf("closing\n"); + DPRINTF("closing\n"); while (!s->has_error && s->buffer_size) { buffered_flush(s); diff --git a/migration-exec.c b/migration-exec.c index 2a43c73..dc2b62f 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -24,10 +24,10 @@ //#define DEBUG_MIGRATION_EXEC #ifdef DEBUG_MIGRATION_EXEC -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-exec: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -44,7 +44,7 @@ static int file_write(FdMigrationState *s, const void * buf, size_t size) static int exec_close(FdMigrationState *s) { int ret = 0; - dprintf("exec_close\n"); + DPRINTF("exec_close\n"); if (s->opaque) { ret = qemu_fclose(s->opaque); s->opaque = NULL; @@ -74,13 +74,13 @@ MigrationState *exec_start_outgoing_migration(Monitor *mon, f = popen(command, "w"); if (f == NULL) { - dprintf("Unable to popen exec target\n"); + DPRINTF("Unable to popen exec target\n"); goto err_after_alloc; } s->fd = fileno(f); if (s->fd == -1) { - dprintf("Unable to retrieve file descriptor for popen'd handle\n"); + DPRINTF("Unable to retrieve file descriptor for popen'd handle\n"); goto err_after_open; } @@ -129,10 +129,10 @@ int exec_start_incoming_migration(const char *command) { QEMUFile *f; - dprintf("Attempting to start an incoming migration\n"); + DPRINTF("Attempting to start an incoming migration\n"); f = qemu_popen_cmd(command, "r"); if(f == NULL) { - dprintf("Unable to apply qemu wrapper to popen file\n"); + DPRINTF("Unable to apply qemu wrapper to popen file\n"); return -errno; } diff --git a/migration-fd.c b/migration-fd.c index 588299e..9feb8cd 100644 --- a/migration-fd.c +++ b/migration-fd.c @@ -24,10 +24,10 @@ //#define DEBUG_MIGRATION_FD #ifdef DEBUG_MIGRATION_FD -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-fd: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -43,7 +43,7 @@ static int fd_write(FdMigrationState *s, const void * buf, size_t size) static int fd_close(FdMigrationState *s) { - dprintf("fd_close\n"); + DPRINTF("fd_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -64,12 +64,12 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon, s->fd = monitor_get_fd(mon, fdname); if (s->fd == -1) { - dprintf("fd_migration: invalid file descriptor identifier\n"); + DPRINTF("fd_migration: invalid file descriptor identifier\n"); goto err_after_alloc; } if (fcntl(s->fd, F_SETFL, O_NONBLOCK) == -1) { - dprintf("Unable to set nonblocking mode on file descriptor\n"); + DPRINTF("Unable to set nonblocking mode on file descriptor\n"); goto err_after_open; } @@ -115,12 +115,12 @@ int fd_start_incoming_migration(const char *infd) int fd; QEMUFile *f; - dprintf("Attempting to start an incoming migration via fd\n"); + DPRINTF("Attempting to start an incoming migration via fd\n"); fd = strtol(infd, NULL, 0); f = qemu_fdopen(fd, "rb"); if(f == NULL) { - dprintf("Unable to apply qemu wrapper to file descriptor\n"); + DPRINTF("Unable to apply qemu wrapper to file descriptor\n"); return -errno; } diff --git a/migration-tcp.c b/migration-tcp.c index 0de6c2e..20f2e37 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -22,10 +22,10 @@ //#define DEBUG_MIGRATION_TCP #ifdef DEBUG_MIGRATION_TCP -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-tcp: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -41,7 +41,7 @@ static int socket_write(FdMigrationState *s, const void * buf, size_t size) static int tcp_close(FdMigrationState *s) { - dprintf("tcp_close\n"); + DPRINTF("tcp_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -56,7 +56,7 @@ static void tcp_wait_for_connect(void *opaque) int val, ret; socklen_t valsize = sizeof(val); - dprintf("connect completed\n"); + DPRINTF("connect completed\n"); do { ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize); } while (ret == -1 && (s->get_error(s)) == EINTR); @@ -71,7 +71,7 @@ static void tcp_wait_for_connect(void *opaque) if (val == 0) migrate_fd_connect(s); else { - dprintf("error connecting %d\n", val); + DPRINTF("error connecting %d\n", val); migrate_fd_error(s); } } @@ -127,7 +127,7 @@ MigrationState *tcp_start_outgoing_migration(Monitor *mon, } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { - dprintf("connect failed\n"); + DPRINTF("connect failed\n"); close(s->fd); qemu_free(s); return NULL; @@ -149,7 +149,7 @@ static void tcp_accept_incoming_migration(void *opaque) c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); - dprintf("accepted migration\n"); + DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); diff --git a/migration-unix.c b/migration-unix.c index 7dd8abb..57232c0 100644 --- a/migration-unix.c +++ b/migration-unix.c @@ -22,10 +22,10 @@ //#define DEBUG_MIGRATION_UNIX #ifdef DEBUG_MIGRATION_UNIX -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration-unix: " fmt, ## __VA_ARGS__); } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #endif @@ -41,7 +41,7 @@ static int unix_write(FdMigrationState *s, const void * buf, size_t size) static int unix_close(FdMigrationState *s) { - dprintf("unix_close\n"); + DPRINTF("unix_close\n"); if (s->fd != -1) { close(s->fd); s->fd = -1; @@ -55,7 +55,7 @@ static void unix_wait_for_connect(void *opaque) int val, ret; socklen_t valsize = sizeof(val); - dprintf("connect completed\n"); + DPRINTF("connect completed\n"); do { ret = getsockopt(s->fd, SOL_SOCKET, SO_ERROR, (void *) &val, &valsize); } while (ret == -1 && (s->get_error(s)) == EINTR); @@ -70,7 +70,7 @@ static void unix_wait_for_connect(void *opaque) if (val == 0) migrate_fd_connect(s); else { - dprintf("error connecting %d\n", val); + DPRINTF("error connecting %d\n", val); migrate_fd_error(s); } } @@ -106,7 +106,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon, s->bandwidth_limit = bandwidth_limit; s->fd = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { - dprintf("Unable to open socket"); + DPRINTF("Unable to open socket"); goto err_after_alloc; } @@ -122,7 +122,7 @@ MigrationState *unix_start_outgoing_migration(Monitor *mon, } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { - dprintf("connect failed\n"); + DPRINTF("connect failed\n"); goto err_after_open; } @@ -155,7 +155,7 @@ static void unix_accept_incoming_migration(void *opaque) c = qemu_accept(s, (struct sockaddr *)&addr, &addrlen); } while (c == -1 && socket_error() == EINTR); - dprintf("accepted migration\n"); + DPRINTF("accepted migration\n"); if (c == -1) { fprintf(stderr, "could not accept migration connection\n"); @@ -181,7 +181,7 @@ int unix_start_incoming_migration(const char *path) struct sockaddr_un un; int sock; - dprintf("Attempting to start an incoming migration\n"); + DPRINTF("Attempting to start an incoming migration\n"); sock = qemu_socket(PF_UNIX, SOCK_STREAM, 0); if (sock < 0) { diff --git a/migration.c b/migration.c index a1c2877..a62dcb7 100644 --- a/migration.c +++ b/migration.c @@ -24,7 +24,7 @@ //#define DEBUG_MIGRATION #ifdef DEBUG_MIGRATION -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { printf("migration: " fmt, ## __VA_ARGS__); } while (0) static int64_t start, stop; #define START_MIGRATION_CLOCK() do { start = qemu_get_clock(rt_clock); } while (0) @@ -32,7 +32,7 @@ static int64_t start, stop; do { stop = qemu_get_clock(rt_clock) - start; \ } while (0) #else -#define dprintf(fmt, ...) \ +#define DPRINTF(fmt, ...) \ do { } while (0) #define START_MIGRATION_CLOCK() do {} while (0) #define STOP_MIGRATION_CLOCK() do {} while (0) @@ -75,7 +75,7 @@ void process_incoming_migration(QEMUFile *f) exit(1); } qemu_announce_self(); - dprintf("successfully loaded vm state\n"); + DPRINTF("successfully loaded vm state\n"); if (drives_reopen() != 0) { fprintf(stderr, "reopening of drives failed\n"); @@ -152,7 +152,7 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data) s->cancel(s); STOP_MIGRATION_CLOCK(); - dprintf("canceled after %lu milliseconds\n", stop); + DPRINTF("canceled after %lu milliseconds\n", stop); return 0; } @@ -281,7 +281,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon) { s->mon = mon; if (monitor_suspend(mon) == 0) { - dprintf("suspending monitor\n"); + DPRINTF("suspending monitor\n"); } else { monitor_printf(mon, "terminal does not allow synchronous " "migration, continuing detached\n"); @@ -290,7 +290,7 @@ void migrate_fd_monitor_suspend(FdMigrationState *s, Monitor *mon) void migrate_fd_error(FdMigrationState *s) { - dprintf("setting error state\n"); + DPRINTF("setting error state\n"); s->state = MIG_STATE_ERROR; migrate_fd_cleanup(s); notifier_list_notify(&migration_state_notifiers); @@ -303,7 +303,7 @@ int migrate_fd_cleanup(FdMigrationState *s) qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL); if (s->file) { - dprintf("closing file\n"); + DPRINTF("closing file\n"); if (qemu_fclose(s->file) != 0) { ret = -1; s->state = MIG_STATE_ERROR; @@ -368,11 +368,11 @@ void migrate_fd_connect(FdMigrationState *s) migrate_fd_wait_for_unfreeze, migrate_fd_close); - dprintf("beginning savevm\n"); + DPRINTF("beginning savevm\n"); ret = qemu_savevm_state_begin(s->mon, s->file, s->mig_state.blk, s->mig_state.shared); if (ret < 0) { - dprintf("failed, %d\n", ret); + DPRINTF("failed, %d\n", ret); migrate_fd_error(s); return; } @@ -385,16 +385,16 @@ void migrate_fd_put_ready(void *opaque) FdMigrationState *s = opaque; if (s->state != MIG_STATE_ACTIVE) { - dprintf("put_ready returning because of non-active state\n"); + DPRINTF("put_ready returning because of non-active state\n"); return; } - dprintf("iterate\n"); + DPRINTF("iterate\n"); if (qemu_savevm_state_iterate(s->mon, s->file) == 1) { int state; int old_vm_running = runstate_is_running(); - dprintf("done iterating\n"); + DPRINTF("done iterating\n"); vm_stop_force_state(RUN_STATE_FINISH_MIGRATE); qemu_aio_flush(); @@ -409,7 +409,7 @@ void migrate_fd_put_ready(void *opaque) } s->state = state; STOP_MIGRATION_CLOCK(); - dprintf("ended after %lu milliseconds\n", stop); + DPRINTF("ended after %lu milliseconds\n", stop); if (migrate_fd_cleanup(s) < 0) { if (old_vm_running) { @@ -436,7 +436,7 @@ void migrate_fd_cancel(MigrationState *mig_state) if (s->state != MIG_STATE_ACTIVE) return; - dprintf("cancelling migration\n"); + DPRINTF("cancelling migration\n"); s->state = MIG_STATE_CANCELLED; qemu_savevm_state_cancel(s->mon, s->file); @@ -448,7 +448,7 @@ void migrate_fd_release(MigrationState *mig_state) { FdMigrationState *s = migrate_to_fms(mig_state); - dprintf("releasing state\n"); + DPRINTF("releasing state\n"); if (s->state == MIG_STATE_ACTIVE) { s->state = MIG_STATE_CANCELLED; @@ -463,7 +463,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque) FdMigrationState *s = opaque; int ret; - dprintf("wait for unfreeze\n"); + DPRINTF("wait for unfreeze\n"); if (s->state != MIG_STATE_ACTIVE) return; -- 1.7.4.4