int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,

                          uint64_t bytes, QEMUIOVector *qiov, int flags)

{

    NbdClientSession *client = nbd_get_client_session(bs);

    struct nbd_request request = {

        .type = NBD_CMD_WRITE,

        .from = offset,

        .len = bytes,

    };

    struct nbd_reply reply;

    ssize_t ret;



    if (flags & BDRV_REQ_FUA) {

        assert(client->nbdflags & NBD_FLAG_SEND_FUA);

        request.type |= NBD_CMD_FLAG_FUA;

    }



    assert(bytes <= NBD_MAX_BUFFER_SIZE);



    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(bs, &request, qiov);

    if (ret < 0) {

        reply.error = -ret;

    } else {

        nbd_co_receive_reply(client, &request, &reply, NULL);

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;

}

int nbd_client_co_pwritev(BlockDriverState *bs, uint64_t offset,

                          uint64_t bytes, QEMUIOVector *qiov, int flags)

{

    NbdClientSession *client = nbd_get_client_session(bs);

    struct nbd_request request = {

        .type = NBD_CMD_WRITE,

        .from = offset,

        .len = bytes,

    };

    struct nbd_reply reply;

    ssize_t ret;



    if (flags & BDRV_REQ_FUA) {

        assert(client->nbdflags & NBD_FLAG_SEND_FUA);

        request.type |= NBD_CMD_FLAG_FUA;

    }



    assert(bytes <= NBD_MAX_BUFFER_SIZE);



    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(bs, &request, qiov);

    if (ret < 0) {

        reply.error = -ret;

    } else {

        nbd_co_receive_reply(client, &request, &reply, NULL);

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;

}

int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,

                          uint64_t VAR_2, QEMUIOVector *VAR_3, int VAR_4)

{

    NbdClientSession *client = nbd_get_client_session(VAR_0);

    struct nbd_request VAR_5 = {

        .type = NBD_CMD_WRITE,

        .from = VAR_1,

        .len = VAR_2,

    };

    struct nbd_reply VAR_6;

    ssize_t ret;



    if (VAR_4 & BDRV_REQ_FUA) {

        assert(client->nbdflags & NBD_FLAG_SEND_FUA);

        VAR_5.type |= NBD_CMD_FLAG_FUA;

    }



    assert(VAR_2 <= NBD_MAX_BUFFER_SIZE);



    nbd_coroutine_start(client, &VAR_5);

    ret = nbd_co_send_request(VAR_0, &VAR_5, VAR_3);

    if (ret < 0) {

        VAR_6.error = -ret;

    } else {

        nbd_co_receive_reply(client, &VAR_5, &VAR_6, NULL);

    }

    nbd_coroutine_end(client, &VAR_5);

    return -VAR_6.error;

}

int FUNC_0(BlockDriverState *VAR_0, uint64_t VAR_1,
uint64_t VAR_2, QEMUIOVector *VAR_3, int VAR_4)
{ NbdClientSession *client = nbd_get_client_session(VAR_0); struct nbd_request VAR_5 = { .type = NBD_CMD_WRITE,
.from = VAR_1,
.len = VAR_2,
}; struct nbd_reply VAR_6; ssize_t ret; if (VAR_4 & BDRV_REQ_FUA) { assert(client->nbdflags & NBD_FLAG_SEND_FUA); VAR_5.type |= NBD_CMD_FLAG_FUA; } assert(VAR_2 <= NBD_MAX_BUFFER_SIZE); nbd_coroutine_start(client, &VAR_5); ret = nbd_co_send_request(VAR_0, &VAR_5, VAR_3); if (ret < 0) { VAR_6.error = -ret; } else { nbd_co_receive_reply(client, &VAR_5, &VAR_6, NULL); } nbd_coroutine_end(client, &VAR_5); return -VAR_6.error; }