some compilation fixes

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2076 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2006-08-02 22:02:08 +00:00
parent 83f6409109
commit 979b67ad86

View File

@ -207,10 +207,11 @@ typedef struct RawAIOCB {
static int aio_sig_num = SIGUSR2; static int aio_sig_num = SIGUSR2;
static BlockDriverAIOCB *first_aio; /* AIO issued */ static BlockDriverAIOCB *first_aio; /* AIO issued */
static int aio_initialized = 0;
#ifndef QEMU_TOOL
static void aio_signal_handler(int signum) static void aio_signal_handler(int signum)
{ {
#ifndef QEMU_TOOL
CPUState *env = cpu_single_env; CPUState *env = cpu_single_env;
if (env) { if (env) {
/* stop the currently executing cpu because a timer occured */ /* stop the currently executing cpu because a timer occured */
@ -221,12 +222,15 @@ static void aio_signal_handler(int signum)
} }
#endif #endif
} }
#endif
} }
void qemu_aio_init(void) void qemu_aio_init(void)
{ {
struct sigaction act; struct sigaction act;
aio_initialized = 1;
sigfillset(&act.sa_mask); sigfillset(&act.sa_mask);
act.sa_flags = 0; /* do not restart syscalls to interrupt select() */ act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
act.sa_handler = aio_signal_handler; act.sa_handler = aio_signal_handler;
@ -242,7 +246,6 @@ void qemu_aio_init(void)
aio_init(&ai); aio_init(&ai);
} }
} }
#endif /* !QEMU_TOOL */
void qemu_aio_poll(void) void qemu_aio_poll(void)
{ {
@ -293,6 +296,9 @@ static sigset_t wait_oset;
void qemu_aio_wait_start(void) void qemu_aio_wait_start(void)
{ {
sigset_t set; sigset_t set;
if (!aio_initialized)
qemu_aio_init();
sigemptyset(&set); sigemptyset(&set);
sigaddset(&set, aio_sig_num); sigaddset(&set, aio_sig_num);
sigprocmask(SIG_BLOCK, &set, &wait_oset); sigprocmask(SIG_BLOCK, &set, &wait_oset);
@ -570,7 +576,7 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
} else { } else {
access_flags = GENERIC_READ; access_flags = GENERIC_READ;
} }
if (flags & BDRV_O_CREATE) { if (flags & BDRV_O_CREAT) {
create_flags = CREATE_ALWAYS; create_flags = CREATE_ALWAYS;
} else { } else {
create_flags = OPEN_EXISTING; create_flags = OPEN_EXISTING;
@ -632,15 +638,17 @@ static int raw_aio_new(BlockDriverAIOCB *acb)
if (!acb1) if (!acb1)
return -ENOMEM; return -ENOMEM;
acb->opaque = acb1; acb->opaque = acb1;
s->hevent = CreateEvent(NULL, TRUE, FALSE, NULL); s->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (!s->hevent) if (!s->hEvent)
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
static void raw_aio_cb(void *opaque) static void raw_aio_cb(void *opaque)
{ {
BlockDriverAIOCB *acb = acb1; BlockDriverAIOCB *acb = opaque;
BlockDriverState *bs = acb->bs;
BDRVRawState *s = bs->opaque;
RawAIOCB *acb1 = acb->opaque; RawAIOCB *acb1 = acb->opaque;
DWORD ret_count; DWORD ret_count;
int ret; int ret;
@ -659,7 +667,6 @@ static int raw_aio_read(BlockDriverAIOCB *acb, int64_t sector_num,
BlockDriverState *bs = acb->bs; BlockDriverState *bs = acb->bs;
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
RawAIOCB *acb1 = acb->opaque; RawAIOCB *acb1 = acb->opaque;
DWORD ret_count;
int ret; int ret;
int64_t offset; int64_t offset;
@ -682,7 +689,6 @@ static int raw_aio_write(BlockDriverAIOCB *acb, int64_t sector_num,
BlockDriverState *bs = acb->bs; BlockDriverState *bs = acb->bs;
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
RawAIOCB *acb1 = acb->opaque; RawAIOCB *acb1 = acb->opaque;
DWORD ret_count;
int ret; int ret;
int64_t offset; int64_t offset;
@ -734,8 +740,8 @@ static int raw_truncate(BlockDriverState *bs, int64_t offset)
BDRVRawState *s = bs->opaque; BDRVRawState *s = bs->opaque;
DWORD low, high; DWORD low, high;
low = length; low = offset;
high = length >> 32; high = offset >> 32;
if (!SetFilePointer(s->hfile, low, &high, FILE_BEGIN)) if (!SetFilePointer(s->hfile, low, &high, FILE_BEGIN))
return -EIO; return -EIO;
if (!SetEndOfFile(s->hfile)) if (!SetEndOfFile(s->hfile))