From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnn8-0004Gq-H5 for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RFnn6-0003L4-1Z for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:46 -0400 Received: from mail-yx0-f174.google.com ([209.85.213.174]:49333) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RFnn5-0003Kn-TL for qemu-devel@nongnu.org; Mon, 17 Oct 2011 10:03:43 -0400 Received: by yxp4 with SMTP id 4so3858901yxp.5 for ; Mon, 17 Oct 2011 07:03:43 -0700 (PDT) Message-ID: <4E9C35BC.4030003@codemonkey.ws> Date: Mon, 17 Oct 2011 09:03:40 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <336a3c5cc754339152f09baa96788f1b00b706f9.1318326684.git.quintela@redhat.com> In-Reply-To: <336a3c5cc754339152f09baa96788f1b00b706f9.1318326684.git.quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 22/36] migration: Introduce MIG_STATE_SETUP List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org On 10/11/2011 05:00 AM, Juan Quintela wrote: > Use MIG_STATE_ACTIVE only when migration has really started. Use this > new state to setup migration parameters. > > Signed-off-by: Juan Quintela > --- > migration.c | 6 +++++- > migration.h | 11 +++++++---- > 2 files changed, 12 insertions(+), 5 deletions(-) > > diff --git a/migration.c b/migration.c > index e93f3f7..a01bf4f 100644 > --- a/migration.c > +++ b/migration.c > @@ -239,6 +239,9 @@ void do_info_migrate(Monitor *mon, QObject **ret_data) > MigrationState *s = current_migration; > > switch (s->get_status(current_migration)) { > + case MIG_STATE_SETUP: > + /* no migration has happened ever */ > + break; > case MIG_STATE_ACTIVE: > qdict = qdict_new(); > qdict_put(qdict, "status", qstring_from_str("active")); > @@ -478,6 +481,7 @@ void migrate_fd_connect(MigrationState *s) > { > int ret; > > + s->state = MIG_STATE_ACTIVE; > s->file = qemu_fopen_ops_buffered(s, > s->bandwidth_limit, > migrate_fd_put_buffer, > @@ -507,7 +511,7 @@ static MigrationState *migrate_new(Monitor *mon, int64_t bandwidth_limit, > s->shared = inc; > s->mon = NULL; > s->bandwidth_limit = bandwidth_limit; > - s->state = MIG_STATE_ACTIVE; > + s->state = MIG_STATE_SETUP; > > if (!detach) { > migrate_fd_monitor_suspend(s, mon); > diff --git a/migration.h b/migration.h > index 14c3ebc..3165140 100644 > --- a/migration.h > +++ b/migration.h > @@ -18,10 +18,13 @@ > #include "qemu-common.h" > #include "notify.h" > > -#define MIG_STATE_ERROR -1 > -#define MIG_STATE_COMPLETED 0 > -#define MIG_STATE_CANCELLED 1 > -#define MIG_STATE_ACTIVE 2 > +enum migration_state { CODING_STYLE. Regards, Anthony Liguori > + MIG_STATE_ERROR, > + MIG_STATE_SETUP, > + MIG_STATE_CANCELLED, > + MIG_STATE_ACTIVE, > + MIG_STATE_COMPLETED, > +}; > > typedef struct MigrationState MigrationState; >