Replace the VMSTOP macros with a proper state type

Today, when notifying a VM state change with vm_state_notify(),
we pass a VMSTOP macro as the 'reason' argument. This is not ideal
because the VMSTOP macros tell why qemu stopped and not exactly
what the current VM state is.

One example to demonstrate this problem is that vm_start() calls
vm_state_notify() with reason=0, which turns out to be VMSTOP_USER.

This commit fixes that by replacing the VMSTOP macros with a proper
state type called RunState.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
Luiz Capitulino 2011-07-29 14:26:33 -03:00
parent bff046f86b
commit 1dfb4dd993
24 changed files with 91 additions and 76 deletions

View file

@ -1103,7 +1103,7 @@ static void ahci_irq_set(void *opaque, int n, int level)
{
}
static void ahci_dma_restart_cb(void *opaque, int running, int reason)
static void ahci_dma_restart_cb(void *opaque, int running, RunState state)
{
}

View file

@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op)
s->bus->dma->ops->set_unit(s->bus->dma, s->unit);
s->bus->error_status = op;
bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read);
vm_stop(VMSTOP_DISKFULL);
vm_stop(RSTATE_IO_ERROR);
} else {
if (op & BM_STATUS_DMA_RETRY) {
dma_buf_commit(s, 0);
@ -1910,7 +1910,7 @@ static int ide_nop_int(IDEDMA *dma, int x)
return 0;
}
static void ide_nop_restart(void *opaque, int x, int y)
static void ide_nop_restart(void *opaque, int x, RunState y)
{
}

View file

@ -9,6 +9,7 @@
#include <hw/ide.h>
#include "iorange.h"
#include "dma.h"
#include "sysemu.h"
/* debug IDE devices */
//#define DEBUG_IDE
@ -387,7 +388,7 @@ typedef void EndTransferFunc(IDEState *);
typedef void DMAStartFunc(IDEDMA *, IDEState *, BlockDriverCompletionFunc *);
typedef int DMAFunc(IDEDMA *);
typedef int DMAIntFunc(IDEDMA *, int);
typedef void DMARestartFunc(void *, int, int);
typedef void DMARestartFunc(void *, int, RunState);
struct unreported_events {
bool eject_request;

View file

@ -222,7 +222,7 @@ static void bmdma_restart_bh(void *opaque)
}
}
static void bmdma_restart_cb(void *opaque, int running, int reason)
static void bmdma_restart_cb(void *opaque, int running, RunState state)
{
IDEDMA *dma = opaque;
BMDMAState *bm = DO_UPCAST(BMDMAState, dma, dma);