static void laio_cancel(BlockDriverAIOCB *blockacb)

{

    struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;

    struct io_event event;

    int ret;



    if (laiocb->ret != -EINPROGRESS)

        return;



    /*

     * Note that as of Linux 2.6.31 neither the block device code nor any

     * filesystem implements cancellation of AIO request.

     * Thus the polling loop below is the normal code path.

     */

    ret = io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event);

    if (ret == 0) {

        laiocb->ret = -ECANCELED;

        return;

    }



    /*

     * We have to wait for the iocb to finish.

     *

     * The only way to get the iocb status update is by polling the io context.

     * We might be able to do this slightly more optimal by removing the

     * O_NONBLOCK flag.

     */

    while (laiocb->ret == -EINPROGRESS) {

        qemu_laio_completion_cb(&laiocb->ctx->e);

    }

}

static void laio_cancel(BlockDriverAIOCB *blockacb)

{

    struct qemu_laiocb *laiocb = (struct qemu_laiocb *)blockacb;

    struct io_event event;

    int ret;



    if (laiocb->ret != -EINPROGRESS)

        return;



    









    ret = io_cancel(laiocb->ctx->ctx, &laiocb->iocb, &event);

    if (ret == 0) {

        laiocb->ret = -ECANCELED;

        return;

    }



    













    while (laiocb->ret == -EINPROGRESS) {

        qemu_laio_completion_cb(&laiocb->ctx->e);

    }

}

    if (laiocb->ret != -EINPROGRESS)     if (ret == 0) {         laiocb->ret = -ECANCELED;     while (laiocb->ret == -EINPROGRESS) {         qemu_laio_completion_cb(&laiocb->ctx->e);
static void FUNC_0(BlockDriverAIOCB *VAR_0)

{

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

    struct io_event VAR_2;

    int VAR_3;



    if (VAR_1->VAR_3 != -EINPROGRESS)

        return;



    









    VAR_3 = io_cancel(VAR_1->ctx->ctx, &VAR_1->iocb, &VAR_2);

    if (VAR_3 == 0) {

        VAR_1->VAR_3 = -ECANCELED;

        return;

    }



    













    while (VAR_1->VAR_3 == -EINPROGRESS) {

        qemu_laio_completion_cb(&VAR_1->ctx->e);

    }

}

static void FUNC_0(BlockDriverAIOCB *VAR_0)
{ struct qemu_laiocb *VAR_1 = (struct qemu_laiocb *)VAR_0; struct io_event VAR_2; int VAR_3; if (VAR_1->VAR_3 != -EINPROGRESS)
return; VAR_3 = io_cancel(VAR_1->ctx->ctx, &VAR_1->iocb, &VAR_2); if (VAR_3 == 0) { VAR_1->VAR_3 = -ECANCELED; return; } while (VAR_1->VAR_3 == -EINPROGRESS) { qemu_laio_completion_cb(&VAR_1->ctx->e); } }