From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33777) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KI-0001Lk-0v for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R75KG-0004rS-Na for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:62935) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R75KF-0004r5-Qp for qemu-devel@nongnu.org; Fri, 23 Sep 2011 08:57:56 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8NCvtBL016053 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 23 Sep 2011 08:57:55 -0400 From: Juan Quintela Date: Fri, 23 Sep 2011 14:57:01 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 12/23] migration: Remove get_status() accessor List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org It is only used inside migration.c, and fields on that struct are accessed all around the place on that file. Signed-off-by: Juan Quintela --- migration.c | 16 +++++----------- migration.h | 1 - 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/migration.c b/migration.c index 48c05b9..7cb0404 100644 --- a/migration.c +++ b/migration.c @@ -92,7 +92,7 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data) int ret; if (current_migration && - current_migration->get_status(current_migration) == MIG_STATE_ACTIVE) { + current_migration->state == MIG_STATE_ACTIVE) { monitor_printf(mon, "migration already in progress\n"); return -1; } @@ -137,7 +137,7 @@ int do_migrate_cancel(Monitor *mon, const QDict *qdict, QObject **ret_data) { MigrationState *s = current_migration; - if (s && s->get_status(s) == MIG_STATE_ACTIVE) { + if (s && s->state == MIG_STATE_ACTIVE) { s->cancel(s); } return 0; @@ -236,7 +236,7 @@ void do_info_migrate(Monitor *mon, QObject **ret_data) if (current_migration) { MigrationState *s = current_migration; - switch (s->get_status(current_migration)) { + switch (s->state) { case MIG_STATE_NONE: /* no migration has happened ever */ break; @@ -387,7 +387,7 @@ static void migrate_fd_put_ready(void *opaque) } else { migrate_fd_completed(s); } - if (s->get_status(s) != MIG_STATE_COMPLETED) { + if (s->state != MIG_STATE_COMPLETED) { if (old_vm_running) { vm_start(); } @@ -395,11 +395,6 @@ static void migrate_fd_put_ready(void *opaque) } } -static int migrate_fd_get_status(MigrationState *s) -{ - return s->state; -} - static void migrate_fd_cancel(MigrationState *s) { if (s->state != MIG_STATE_ACTIVE) @@ -461,7 +456,7 @@ void remove_migration_state_change_notifier(Notifier *notify) int get_migration_state(void) { if (current_migration) { - return migrate_fd_get_status(current_migration); + return current_migration->state; } else { return MIG_STATE_ERROR; } @@ -496,7 +491,6 @@ static MigrationState *migrate_create_state(Monitor *mon, MigrationState *s = g_malloc0(sizeof(*s)); s->cancel = migrate_fd_cancel; - s->get_status = migrate_fd_get_status; s->blk = blk; s->shared = inc; s->mon = NULL; diff --git a/migration.h b/migration.h index 9ea1ad6..6d8d1ad 100644 --- a/migration.h +++ b/migration.h @@ -39,7 +39,6 @@ struct MigrationState int (*close)(MigrationState *s); int (*write)(MigrationState *s, const void *buff, size_t size); void (*cancel)(MigrationState *s); - int (*get_status)(MigrationState *s); void *opaque; int blk; int shared; -- 1.7.6.2