int qemu_paio_cancel(int fd, struct qemu_paiocb *aiocb)

{

    int ret;



    pthread_mutex_lock(&lock);

    if (!aiocb->active) {

        TAILQ_REMOVE(&request_list, aiocb, node);

        aiocb->ret = -ECANCELED;

        ret = QEMU_PAIO_CANCELED;

    } else if (aiocb->ret == -EINPROGRESS)

        ret = QEMU_PAIO_NOTCANCELED;

    else

        ret = QEMU_PAIO_ALLDONE;

    pthread_mutex_unlock(&lock);



    return ret;

}

int qemu_paio_cancel(int fd, struct qemu_paiocb *aiocb)

{

    int ret;



    pthread_mutex_lock(&lock);

    if (!aiocb->active) {

        TAILQ_REMOVE(&request_list, aiocb, node);

        aiocb->ret = -ECANCELED;

        ret = QEMU_PAIO_CANCELED;

    } else if (aiocb->ret == -EINPROGRESS)

        ret = QEMU_PAIO_NOTCANCELED;

    else

        ret = QEMU_PAIO_ALLDONE;

    pthread_mutex_unlock(&lock);



    return ret;

}

int FUNC_0(int VAR_0, struct qemu_paiocb *VAR_1)

{

    int VAR_2;



    pthread_mutex_lock(&lock);

    if (!VAR_1->active) {

        TAILQ_REMOVE(&request_list, VAR_1, node);

        VAR_1->VAR_2 = -ECANCELED;

        VAR_2 = QEMU_PAIO_CANCELED;

    } else if (VAR_1->VAR_2 == -EINPROGRESS)

        VAR_2 = QEMU_PAIO_NOTCANCELED;

    else

        VAR_2 = QEMU_PAIO_ALLDONE;

    pthread_mutex_unlock(&lock);



    return VAR_2;

}

int FUNC_0(int VAR_0, struct qemu_paiocb *VAR_1)
{ int VAR_2; pthread_mutex_lock(&lock); if (!VAR_1->active) { TAILQ_REMOVE(&request_list, VAR_1, node); VAR_1->VAR_2 = -ECANCELED; VAR_2 = QEMU_PAIO_CANCELED; } else if (VAR_1->VAR_2 == -EINPROGRESS) VAR_2 = QEMU_PAIO_NOTCANCELED; else
VAR_2 = QEMU_PAIO_ALLDONE; pthread_mutex_unlock(&lock); return VAR_2; }