From patchwork Tue Sep 20 14:19:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 115595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 5AB21B7199 for ; Wed, 21 Sep 2011 02:12:30 +1000 (EST) Received: from localhost ([::1]:60505 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61CQ-0006V4-5V for incoming@patchwork.ozlabs.org; Tue, 20 Sep 2011 10:21:26 -0400 Received: from eggs.gnu.org ([140.186.70.92]:39204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61BL-0004mE-Kp for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R61BA-00089N-8x for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12419) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R61B9-000886-H3 for qemu-devel@nongnu.org; Tue, 20 Sep 2011 10:20:08 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8KEK6l4014542 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 20 Sep 2011 10:20:06 -0400 Received: from trasno.mitica (ovpn-113-56.phx2.redhat.com [10.3.113.56]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8KEJv9Z015328; Tue, 20 Sep 2011 10:20:05 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Tue, 20 Sep 2011 16:19:34 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 06/23] migration: Make all posible migration functions static X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org I have to move two functions postions to avoid forward declarations Signed-off-by: Juan Quintela --- migration.c | 72 +++++++++++++++++++++++++++++----------------------------- migration.h | 12 --------- 2 files changed, 36 insertions(+), 48 deletions(-) diff --git a/migration.c b/migration.c index b62a92a..96f00b7 100644 --- a/migration.c +++ b/migration.c @@ -273,15 +273,7 @@ static void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon) } } -void migrate_fd_error(MigrationState *s) -{ - DPRINTF("setting error state\n"); - s->state = MIG_STATE_ERROR; - notifier_list_notify(&migration_state_notifiers, NULL); - migrate_fd_cleanup(s); -} - -int migrate_fd_cleanup(MigrationState *s) +static int migrate_fd_cleanup(MigrationState *s) { int ret = 0; @@ -307,7 +299,15 @@ int migrate_fd_cleanup(MigrationState *s) return ret; } -void migrate_fd_put_notify(void *opaque) +void migrate_fd_error(MigrationState *s) +{ + DPRINTF("setting error state\n"); + s->state = MIG_STATE_ERROR; + notifier_list_notify(&migration_state_notifiers, NULL); + migrate_fd_cleanup(s); +} + +static void migrate_fd_put_notify(void *opaque) { MigrationState *s = opaque; @@ -318,7 +318,8 @@ void migrate_fd_put_notify(void *opaque) } } -ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) +static ssize_t migrate_fd_put_buffer(void *opaque, const void *data, + size_t size) { MigrationState *s = opaque; ssize_t ret; @@ -337,29 +338,7 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) return ret; } -void migrate_fd_connect(MigrationState *s) -{ - int ret; - - s->file = qemu_fopen_ops_buffered(s, - s->bandwidth_limit, - migrate_fd_put_buffer, - migrate_fd_put_ready, - migrate_fd_wait_for_unfreeze, - migrate_fd_close); - - DPRINTF("beginning savevm\n"); - ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared); - if (ret < 0) { - DPRINTF("failed, %d\n", ret); - migrate_fd_error(s); - return; - } - - migrate_fd_put_ready(s); -} - -void migrate_fd_put_ready(void *opaque) +static void migrate_fd_put_ready(void *opaque) { MigrationState *s = opaque; int ret; @@ -430,7 +409,7 @@ static void migrate_fd_release(MigrationState *s) g_free(s); } -void migrate_fd_wait_for_unfreeze(void *opaque) +static void migrate_fd_wait_for_unfreeze(void *opaque) { MigrationState *s = opaque; int ret; @@ -449,7 +428,7 @@ void migrate_fd_wait_for_unfreeze(void *opaque) } while (ret == -1 && (s->get_error(s)) == EINTR); } -int migrate_fd_close(void *opaque, bool flush) +static int migrate_fd_close(void *opaque, bool flush) { MigrationState *s = opaque; @@ -479,6 +458,27 @@ int get_migration_state(void) } } +void migrate_fd_connect(MigrationState *s) +{ + int ret; + + s->file = qemu_fopen_ops_buffered(s, + s->bandwidth_limit, + migrate_fd_put_buffer, + migrate_fd_put_ready, + migrate_fd_wait_for_unfreeze, + migrate_fd_close); + + DPRINTF("beginning savevm\n"); + ret = qemu_savevm_state_begin(s->mon, s->file, s->blk, s->shared); + if (ret < 0) { + DPRINTF("failed, %d\n", ret); + migrate_fd_error(s); + return; + } + migrate_fd_put_ready(s); +} + MigrationState *migrate_create_state(Monitor *mon, int64_t bandwidth_limit, int detach, int blk, int inc) { diff --git a/migration.h b/migration.h index bbb2d0b..f5de3da 100644 --- a/migration.h +++ b/migration.h @@ -100,20 +100,8 @@ MigrationState *fd_start_outgoing_migration(Monitor *mon, void migrate_fd_error(MigrationState *s); -int migrate_fd_cleanup(MigrationState *s); - -void migrate_fd_put_notify(void *opaque); - -ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size); - void migrate_fd_connect(MigrationState *s); -void migrate_fd_put_ready(void *opaque); - -void migrate_fd_wait_for_unfreeze(void *opaque); - -int migrate_fd_close(void *opaque, bool flush); - MigrationState *migrate_create_state(Monitor *mon, int64_t bandwidth_limit, int detach, int blk, int inc);