From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=42031 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsAQh-00039p-FK for qemu-devel@nongnu.org; Wed, 23 Feb 2011 03:50:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsAQf-0002KM-VP for qemu-devel@nongnu.org; Wed, 23 Feb 2011 03:50:39 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:59120) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsAQf-0002KG-Ol for qemu-devel@nongnu.org; Wed, 23 Feb 2011 03:50:37 -0500 Received: by wyb29 with SMTP id 29so3427315wyb.4 for ; Wed, 23 Feb 2011 00:50:36 -0800 (PST) MIME-Version: 1.0 Sender: tamura.yoshiaki@gmail.com In-Reply-To: <04af1ac60cffc5b9bf4d3e0cfded8f8bd2978699.1298421307.git.quintela@redhat.com> References: <04af1ac60cffc5b9bf4d3e0cfded8f8bd2978699.1298421307.git.quintela@redhat.com> Date: Wed, 23 Feb 2011 17:50:36 +0900 Message-ID: Subject: Re: [Qemu-devel] [PATCH 21/22] migration: Export a function that tells if the migration has finished correctly From: Yoshiaki Tamura Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org 2011/2/23 Juan Quintela : > This will allows us to hide the status values. > > Signed-off-by: Juan Quintela > --- > =A0migration.c =A0 =A0 | =A0 =A04 ++-- > =A0migration.h =A0 =A0 | =A0 =A02 +- > =A0ui/spice-core.c | =A0 =A04 +--- > =A03 files changed, 4 insertions(+), 6 deletions(-) > > diff --git a/migration.c b/migration.c > index 312a029..383ebaf 100644 > --- a/migration.c > +++ b/migration.c > @@ -335,9 +335,9 @@ void remove_migration_state_change_notifier(Notifier = *notify) > =A0 =A0 notifier_list_remove(&migration_state_notifiers, notify); > =A0} > > -int get_migration_state(void) > +bool migration_has_finished(void) > =A0{ > - =A0 =A0return current_migration.state; > + =A0 =A0return current_migration.state =3D=3D MIG_STATE_COMPLETED; > =A0} > > =A0void migrate_fd_connect(MigrationState *s) > diff --git a/migration.h b/migration.h > index 6477b51..9457807 100644 > --- a/migration.h > +++ b/migration.h > @@ -82,6 +82,6 @@ void migrate_fd_connect(MigrationState *s); > > =A0void add_migration_state_change_notifier(Notifier *notify); > =A0void remove_migration_state_change_notifier(Notifier *notify); > -int get_migration_state(void); > +bool migration_has_finished(void); > > =A0#endif > diff --git a/ui/spice-core.c b/ui/spice-core.c > index 1aa1a5e..997603d 100644 > --- a/ui/spice-core.c > +++ b/ui/spice-core.c > @@ -422,9 +422,7 @@ void do_info_spice(Monitor *mon, QObject **ret_data) > > =A0static void migration_state_notifier(Notifier *notifier) > =A0{ > - =A0 =A0int state =3D get_migration_state(); > - > - =A0 =A0if (state =3D=3D MIG_STATE_COMPLETED) { > + =A0 =A0if (migration_has_finished()) { > =A0#if SPICE_SERVER_VERSION >=3D 0x000701 /* 0.7.1 */ > =A0 =A0 =A0 =A0 spice_server_migrate_switch(spice_server); > =A0#endif I agree to add migration_has_finished, but I don't see why we want to remove get_migration_state. Are we going to make migration_has_* for each state even migration gets complicated? Yoshi > -- > 1.7.4 > > >