BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs,

        QEMUWin32AIOState *aio, HANDLE hfile,

        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

        BlockDriverCompletionFunc *cb, void *opaque, int type)

{

    struct QEMUWin32AIOCB *waiocb;

    uint64_t offset = sector_num * 512;

    DWORD rc;



    waiocb = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque);

    waiocb->nbytes = nb_sectors * 512;

    waiocb->qiov = qiov;

    waiocb->is_read = (type == QEMU_AIO_READ);



    if (qiov->niov > 1) {

        waiocb->buf = qemu_blockalign(bs, qiov->size);

        if (type & QEMU_AIO_WRITE) {

            iov_to_buf(qiov->iov, qiov->niov, 0, waiocb->buf, qiov->size);

        }

        waiocb->is_linear = false;

    } else {

        waiocb->buf = qiov->iov[0].iov_base;

        waiocb->is_linear = true;

    }



    memset(&waiocb->ov, 0, sizeof(waiocb->ov));

    waiocb->ov.Offset = (DWORD)offset;

    waiocb->ov.OffsetHigh = (DWORD)(offset >> 32);

    waiocb->ov.hEvent = event_notifier_get_handle(&aio->e);



    aio->count++;



    if (type & QEMU_AIO_READ) {

        rc = ReadFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);

    } else {

        rc = WriteFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);

    }

    if(rc == 0 && GetLastError() != ERROR_IO_PENDING) {

        goto out_dec_count;

    }

    return &waiocb->common;



out_dec_count:

    aio->count--;

    qemu_aio_release(waiocb);

    return NULL;

}

BlockDriverAIOCB *win32_aio_submit(BlockDriverState *bs,

        QEMUWin32AIOState *aio, HANDLE hfile,

        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

        BlockDriverCompletionFunc *cb, void *opaque, int type)

{

    struct QEMUWin32AIOCB *waiocb;

    uint64_t offset = sector_num * 512;

    DWORD rc;



    waiocb = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque);

    waiocb->nbytes = nb_sectors * 512;

    waiocb->qiov = qiov;

    waiocb->is_read = (type == QEMU_AIO_READ);



    if (qiov->niov > 1) {

        waiocb->buf = qemu_blockalign(bs, qiov->size);

        if (type & QEMU_AIO_WRITE) {

            iov_to_buf(qiov->iov, qiov->niov, 0, waiocb->buf, qiov->size);

        }

        waiocb->is_linear = false;

    } else {

        waiocb->buf = qiov->iov[0].iov_base;

        waiocb->is_linear = true;

    }



    memset(&waiocb->ov, 0, sizeof(waiocb->ov));

    waiocb->ov.Offset = (DWORD)offset;

    waiocb->ov.OffsetHigh = (DWORD)(offset >> 32);

    waiocb->ov.hEvent = event_notifier_get_handle(&aio->e);



    aio->count++;



    if (type & QEMU_AIO_READ) {

        rc = ReadFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);

    } else {

        rc = WriteFile(hfile, waiocb->buf, waiocb->nbytes, NULL, &waiocb->ov);

    }

    if(rc == 0 && GetLastError() != ERROR_IO_PENDING) {

        goto out_dec_count;

    }

    return &waiocb->common;



out_dec_count:

    aio->count--;

    qemu_aio_release(waiocb);

    return NULL;

}

        waiocb->buf = qemu_blockalign(bs, qiov->size);
BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,

        QEMUWin32AIOState *aio, HANDLE hfile,

        int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,

        BlockDriverCompletionFunc *cb, void *opaque, int type)

{

    struct QEMUWin32AIOCB *VAR_0;

    uint64_t offset = sector_num * 512;

    DWORD rc;



    VAR_0 = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque);

    VAR_0->nbytes = nb_sectors * 512;

    VAR_0->qiov = qiov;

    VAR_0->is_read = (type == QEMU_AIO_READ);



    if (qiov->niov > 1) {

        VAR_0->buf = qemu_blockalign(bs, qiov->size);

        if (type & QEMU_AIO_WRITE) {

            iov_to_buf(qiov->iov, qiov->niov, 0, VAR_0->buf, qiov->size);

        }

        VAR_0->is_linear = false;

    } else {

        VAR_0->buf = qiov->iov[0].iov_base;

        VAR_0->is_linear = true;

    }



    memset(&VAR_0->ov, 0, sizeof(VAR_0->ov));

    VAR_0->ov.Offset = (DWORD)offset;

    VAR_0->ov.OffsetHigh = (DWORD)(offset >> 32);

    VAR_0->ov.hEvent = event_notifier_get_handle(&aio->e);



    aio->count++;



    if (type & QEMU_AIO_READ) {

        rc = ReadFile(hfile, VAR_0->buf, VAR_0->nbytes, NULL, &VAR_0->ov);

    } else {

        rc = WriteFile(hfile, VAR_0->buf, VAR_0->nbytes, NULL, &VAR_0->ov);

    }

    if(rc == 0 && GetLastError() != ERROR_IO_PENDING) {

        goto out_dec_count;

    }

    return &VAR_0->common;



out_dec_count:

    aio->count--;

    qemu_aio_release(VAR_0);

    return NULL;

}

BlockDriverAIOCB *FUNC_0(BlockDriverState *bs,
QEMUWin32AIOState *aio, HANDLE hfile,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque, int type)
{ struct QEMUWin32AIOCB *VAR_0; uint64_t offset = sector_num * 512; DWORD rc; VAR_0 = qemu_aio_get(&win32_aiocb_info, bs, cb, opaque); VAR_0->nbytes = nb_sectors * 512; VAR_0->qiov = qiov; VAR_0->is_read = (type == QEMU_AIO_READ); if (qiov->niov > 1) { VAR_0->buf = qemu_blockalign(bs, qiov->size); if (type & QEMU_AIO_WRITE) { iov_to_buf(qiov->iov, qiov->niov, 0, VAR_0->buf, qiov->size); } VAR_0->is_linear = false; } else { VAR_0->buf = qiov->iov[0].iov_base; VAR_0->is_linear = true; } memset(&VAR_0->ov, 0, sizeof(VAR_0->ov)); VAR_0->ov.Offset = (DWORD)offset; VAR_0->ov.OffsetHigh = (DWORD)(offset >> 32); VAR_0->ov.hEvent = event_notifier_get_handle(&aio->e); aio->count++; if (type & QEMU_AIO_READ) { rc = ReadFile(hfile, VAR_0->buf, VAR_0->nbytes, NULL, &VAR_0->ov); } else { rc = WriteFile(hfile, VAR_0->buf, VAR_0->nbytes, NULL, &VAR_0->ov); } if(rc == 0 && GetLastError() != ERROR_IO_PENDING) { goto out_dec_count; } return &VAR_0->common; out_dec_count:
aio->count--; qemu_aio_release(VAR_0); return NULL; }