From d3042f83fe6cbf9a96c2acf4ca6d5cb43edca8ee Mon Sep 17 00:00:00 2001 From: Eduardo Habkost Date: Fri, 28 Oct 2011 14:22:50 -0200 Subject: [RHEL6 qemu-kvm PATCH 17/17] Revert "migration: s/dprintf/DPRINTF/" RH-Reverts: faff30d200680e486fd5d6b3e1c6826ab6e80d9d RH-Reverts-patchwork-id: 34430 Bugzilla-related: 669581 Signed-off-by: Eduardo Habkost --- 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 4233a3f..fa15a99 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 1836e7e..a89d760 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 dc2b62f..2a43c73 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 9feb8cd..588299e 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 20f2e37..0de6c2e 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 57232c0..7dd8abb 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 a62dcb7..a1c2877 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.3.2