From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqIvI-0003kg-Ve for qemu-devel@nongnu.org; Mon, 08 Aug 2011 02:02:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QqIvI-0004bE-1l for qemu-devel@nongnu.org; Mon, 08 Aug 2011 02:02:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QqIvH-0004b5-R9 for qemu-devel@nongnu.org; Mon, 08 Aug 2011 02:02:48 -0400 From: Markus Armbruster References: <1312384643-581-1-git-send-email-lcapitulino@redhat.com> <1312384643-581-4-git-send-email-lcapitulino@redhat.com> <20110804105457.77729a68@doriath> Date: Mon, 08 Aug 2011 08:02:35 +0200 In-Reply-To: <20110804105457.77729a68@doriath> (Luiz Capitulino's message of "Thu, 4 Aug 2011 10:54:57 -0300") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH 3/7] QemuState: Add additional states List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, jan.kiszka@web.de, avi@redhat.com, amit.shah@redhat.com Luiz Capitulino writes: > On Thu, 04 Aug 2011 11:02:06 +0200 > Markus Armbruster wrote: > >> Luiz Capitulino writes: >> >> > Currently, only vm_start() and vm_stop() change the VM state. That's, >> > the state is only changed when starting or stopping the VM. >> > >> > This commit adds the qemu_state_set() function, making it possible >> > to also do state transitions when qemu is stopped or running. >> > >> > Additional states are also added and the current state is stored. >> > This is going to be used by the next commits. [...] >> > diff --git a/vl.c b/vl.c >> > index faa7c5f..2619c8e 100644 >> > --- a/vl.c >> > +++ b/vl.c >> > @@ -320,6 +320,22 @@ static int default_driver_check(QemuOpts *opts, void *opaque) >> > } >> > >> > /***********************************************************/ >> > +/* QEMU state */ >> > + >> > +static QemuState qemu_current_state = QSTATE_NOSTATE; >> > + >> > +QemuState qemu_state_get(void) >> > +{ >> > + return qemu_current_state; >> > +} >> > + >> > +void qemu_state_set(QemuState state) >> > +{ >> > + assert(state < QSTATE_MAX); >> >> Beware, comparison is signed if QemuState is signed (implementation >> defined; QSTATE_MAX is int). > > It's unsigned here and I got the expected warning when I did: > > assert(state >= 0); > > Don't how to address that (besides dropping the check). It's not likely to catch anthing the compiler doesn't. If you want to check, and want to check thoroughly, then I'm afraid you need to cast state. >> > + qemu_current_state = state; >> > +} >> > + >> > +/***********************************************************/ >> [...]