static void paio_cancel(BlockDriverAIOCB *blockacb)

{

    struct qemu_paiocb *acb = (struct qemu_paiocb *)blockacb;

    int active = 0;



    mutex_lock(&lock);

    if (!acb->active) {

        TAILQ_REMOVE(&request_list, acb, node);

        acb->ret = -ECANCELED;

    } else if (acb->ret == -EINPROGRESS) {

        active = 1;

    }

    mutex_unlock(&lock);



    if (active) {

        /* fail safe: if the aio could not be canceled, we wait for

           it */

        while (qemu_paio_error(acb) == EINPROGRESS)

            ;

    }



    paio_remove(acb);

}

static void paio_cancel(BlockDriverAIOCB *blockacb)

{

    struct qemu_paiocb *acb = (struct qemu_paiocb *)blockacb;

    int active = 0;



    mutex_lock(&lock);

    if (!acb->active) {

        TAILQ_REMOVE(&request_list, acb, node);

        acb->ret = -ECANCELED;

    } else if (acb->ret == -EINPROGRESS) {

        active = 1;

    }

    mutex_unlock(&lock);



    if (active) {

        



        while (qemu_paio_error(acb) == EINPROGRESS)

            ;

    }



    paio_remove(acb);

}

static void FUNC_0(BlockDriverAIOCB *VAR_0)

{

    struct qemu_paiocb *VAR_1 = (struct qemu_paiocb *)VAR_0;

    int VAR_2 = 0;



    mutex_lock(&lock);

    if (!VAR_1->VAR_2) {

        TAILQ_REMOVE(&request_list, VAR_1, node);

        VAR_1->ret = -ECANCELED;

    } else if (VAR_1->ret == -EINPROGRESS) {

        VAR_2 = 1;

    }

    mutex_unlock(&lock);



    if (VAR_2) {

        



        while (qemu_paio_error(VAR_1) == EINPROGRESS)

            ;

    }



    paio_remove(VAR_1);

}

static void FUNC_0(BlockDriverAIOCB *VAR_0)
{ struct qemu_paiocb *VAR_1 = (struct qemu_paiocb *)VAR_0; int VAR_2 = 0; mutex_lock(&lock); if (!VAR_1->VAR_2) { TAILQ_REMOVE(&request_list, VAR_1, node); VAR_1->ret = -ECANCELED; } else if (VAR_1->ret == -EINPROGRESS) { VAR_2 = 1; } mutex_unlock(&lock); if (VAR_2) { while (qemu_paio_error(VAR_1) == EINPROGRESS)
; } paio_remove(VAR_1); }