qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 3/7] QemuState: Add additional states


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 3/7] QemuState: Add additional states
Date: Mon, 08 Aug 2011 08:02:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Luiz Capitulino <address@hidden> writes:

> On Thu, 04 Aug 2011 11:02:06 +0200
> Markus Armbruster <address@hidden> wrote:
>
>> Luiz Capitulino <address@hidden> 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;
>> > +}
>> > +
>> > +/***********************************************************/
>> [...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]