static void nbd_co_receive_reply(NBDClientSession *s,

                                 NBDRequest *request,

                                 NBDReply *reply,

                                 QEMUIOVector *qiov)

{

    int ret;



    /* Wait until we're woken up by nbd_read_reply_entry.  */

    qemu_coroutine_yield();

    *reply = s->reply;

    if (reply->handle != request->handle ||

        !s->ioc) {

        reply->error = EIO;

    } else {

        if (qiov && reply->error == 0) {

            ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov, request->len,

                               true, NULL);

            if (ret != request->len) {

                reply->error = EIO;

            }

        }



        /* Tell the read handler to read another header.  */

        s->reply.handle = 0;

    }

}

static void nbd_co_receive_reply(NBDClientSession *s,

                                 NBDRequest *request,

                                 NBDReply *reply,

                                 QEMUIOVector *qiov)

{

    int ret;



    

    qemu_coroutine_yield();

    *reply = s->reply;

    if (reply->handle != request->handle ||

        !s->ioc) {

        reply->error = EIO;

    } else {

        if (qiov && reply->error == 0) {

            ret = nbd_wr_syncv(s->ioc, qiov->iov, qiov->niov, request->len,

                               true, NULL);

            if (ret != request->len) {

                reply->error = EIO;

            }

        }



        

        s->reply.handle = 0;

    }

}

static void FUNC_0(NBDClientSession *VAR_0,

                                 NBDRequest *VAR_1,

                                 NBDReply *VAR_2,

                                 QEMUIOVector *VAR_3)

{

    int VAR_4;



    

    qemu_coroutine_yield();

    *VAR_2 = VAR_0->VAR_2;

    if (VAR_2->handle != VAR_1->handle ||

        !VAR_0->ioc) {

        VAR_2->error = EIO;

    } else {

        if (VAR_3 && VAR_2->error == 0) {

            VAR_4 = nbd_wr_syncv(VAR_0->ioc, VAR_3->iov, VAR_3->niov, VAR_1->len,

                               true, NULL);

            if (VAR_4 != VAR_1->len) {

                VAR_2->error = EIO;

            }

        }



        

        VAR_0->VAR_2.handle = 0;

    }

}

static void FUNC_0(NBDClientSession *VAR_0,
NBDRequest *VAR_1,
NBDReply *VAR_2,
QEMUIOVector *VAR_3)
{ int VAR_4; qemu_coroutine_yield(); *VAR_2 = VAR_0->VAR_2; if (VAR_2->handle != VAR_1->handle ||
!VAR_0->ioc) { VAR_2->error = EIO; } else { if (VAR_3 && VAR_2->error == 0) { VAR_4 = nbd_wr_syncv(VAR_0->ioc, VAR_3->iov, VAR_3->niov, VAR_1->len,
true, NULL); if (VAR_4 != VAR_1->len) { VAR_2->error = EIO; } } VAR_0->VAR_2.handle = 0; } }