static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)

{

    int ret;



    ret = laiocb->ret;

    if (ret != -ECANCELED) {

        if (ret == laiocb->nbytes) {

            ret = 0;

        } else if (ret >= 0) {

            /* Short reads mean EOF, pad with zeros. */

            if (laiocb->is_read) {

                qemu_iovec_memset(laiocb->qiov, ret, 0,

                    laiocb->qiov->size - ret);

            } else {

                ret = -ENOSPC;

            }

        }

    }



    laiocb->ret = ret;

    if (laiocb->co) {

        /* Jump and continue completion for foreign requests, don't do

         * anything for current request, it will be completed shortly. */

        if (laiocb->co != qemu_coroutine_self()) {

            qemu_coroutine_enter(laiocb->co);

        }

    } else {

        laiocb->common.cb(laiocb->common.opaque, ret);

        qemu_aio_unref(laiocb);

    }

}

static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)

{

    int ret;



    ret = laiocb->ret;

    if (ret != -ECANCELED) {

        if (ret == laiocb->nbytes) {

            ret = 0;

        } else if (ret >= 0) {

            

            if (laiocb->is_read) {

                qemu_iovec_memset(laiocb->qiov, ret, 0,

                    laiocb->qiov->size - ret);

            } else {

                ret = -ENOSPC;

            }

        }

    }



    laiocb->ret = ret;

    if (laiocb->co) {

        



        if (laiocb->co != qemu_coroutine_self()) {

            qemu_coroutine_enter(laiocb->co);

        }

    } else {

        laiocb->common.cb(laiocb->common.opaque, ret);

        qemu_aio_unref(laiocb);

    }

}

        if (laiocb->co != qemu_coroutine_self()) {
static void FUNC_0(struct qemu_laiocb *VAR_0)

{

    int VAR_1;



    VAR_1 = VAR_0->VAR_1;

    if (VAR_1 != -ECANCELED) {

        if (VAR_1 == VAR_0->nbytes) {

            VAR_1 = 0;

        } else if (VAR_1 >= 0) {

            

            if (VAR_0->is_read) {

                qemu_iovec_memset(VAR_0->qiov, VAR_1, 0,

                    VAR_0->qiov->size - VAR_1);

            } else {

                VAR_1 = -ENOSPC;

            }

        }

    }



    VAR_0->VAR_1 = VAR_1;

    if (VAR_0->co) {

        



        if (VAR_0->co != qemu_coroutine_self()) {

            qemu_coroutine_enter(VAR_0->co);

        }

    } else {

        VAR_0->common.cb(VAR_0->common.opaque, VAR_1);

        qemu_aio_unref(VAR_0);

    }

}

static void FUNC_0(struct qemu_laiocb *VAR_0)
{ int VAR_1; VAR_1 = VAR_0->VAR_1; if (VAR_1 != -ECANCELED) { if (VAR_1 == VAR_0->nbytes) { VAR_1 = 0; } else if (VAR_1 >= 0) { if (VAR_0->is_read) { qemu_iovec_memset(VAR_0->qiov, VAR_1, 0,
VAR_0->qiov->size - VAR_1); } else { VAR_1 = -ENOSPC; } } } VAR_0->VAR_1 = VAR_1; if (VAR_0->co) { if (VAR_0->co != qemu_coroutine_self()) { qemu_coroutine_enter(VAR_0->co); } } else { VAR_0->common.cb(VAR_0->common.opaque, VAR_1); qemu_aio_unref(VAR_0); } }