static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,

                         const uint8_t *buf, int nb_sectors)

{

    int async_ret;

    BlockDriverAIOCB *acb;

    struct iovec iov;

    QEMUIOVector qiov;



    async_ret = NOT_DONE;

    iov.iov_base = (void *)buf;

    iov.iov_len = nb_sectors * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&qiov, &iov, 1);



    acb = bs->drv->bdrv_aio_writev(bs, sector_num, &qiov, nb_sectors,

                                   bdrv_rw_em_cb, &async_ret);

    if (acb == NULL) {

        async_ret = -1;

        goto fail;

    }

    while (async_ret == NOT_DONE) {

        qemu_aio_wait();

    }



fail:

    return async_ret;

}

static int bdrv_write_em(BlockDriverState *bs, int64_t sector_num,

                         const uint8_t *buf, int nb_sectors)

{

    int async_ret;

    BlockDriverAIOCB *acb;

    struct iovec iov;

    QEMUIOVector qiov;



    async_ret = NOT_DONE;

    iov.iov_base = (void *)buf;

    iov.iov_len = nb_sectors * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&qiov, &iov, 1);



    acb = bs->drv->bdrv_aio_writev(bs, sector_num, &qiov, nb_sectors,

                                   bdrv_rw_em_cb, &async_ret);

    if (acb == NULL) {

        async_ret = -1;

        goto fail;

    }

    while (async_ret == NOT_DONE) {

        qemu_aio_wait();

    }



fail:

    return async_ret;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,

                         const uint8_t *VAR_2, int VAR_3)

{

    int VAR_4;

    BlockDriverAIOCB *acb;

    struct iovec VAR_5;

    QEMUIOVector qiov;



    VAR_4 = NOT_DONE;

    VAR_5.iov_base = (void *)VAR_2;

    VAR_5.iov_len = VAR_3 * BDRV_SECTOR_SIZE;

    qemu_iovec_init_external(&qiov, &VAR_5, 1);



    acb = VAR_0->drv->bdrv_aio_writev(VAR_0, VAR_1, &qiov, VAR_3,

                                   bdrv_rw_em_cb, &VAR_4);

    if (acb == NULL) {

        VAR_4 = -1;

        goto fail;

    }

    while (VAR_4 == NOT_DONE) {

        qemu_aio_wait();

    }



fail:

    return VAR_4;

}

static int FUNC_0(BlockDriverState *VAR_0, int64_t VAR_1,
const uint8_t *VAR_2, int VAR_3)
{ int VAR_4; BlockDriverAIOCB *acb; struct iovec VAR_5; QEMUIOVector qiov; VAR_4 = NOT_DONE; VAR_5.iov_base = (void *)VAR_2; VAR_5.iov_len = VAR_3 * BDRV_SECTOR_SIZE; qemu_iovec_init_external(&qiov, &VAR_5, 1); acb = VAR_0->drv->bdrv_aio_writev(VAR_0, VAR_1, &qiov, VAR_3,
bdrv_rw_em_cb, &VAR_4); if (acb == NULL) { VAR_4 = -1; goto fail; } while (VAR_4 == NOT_DONE) { qemu_aio_wait(); } fail:
return VAR_4; }