int nbd_client_session_co_discard(NbdClientSession *client, int64_t sector_num,

    int nb_sectors)

{

    struct nbd_request request;

    struct nbd_reply reply;

    ssize_t ret;



    if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) {

        return 0;

    }

    request.type = NBD_CMD_TRIM;

    request.from = sector_num * 512;

    request.len = nb_sectors * 512;



    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(client, &request, NULL, 0);

    if (ret < 0) {

        reply.error = -ret;

    } else {

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

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;



}

int nbd_client_session_co_discard(NbdClientSession *client, int64_t sector_num,

    int nb_sectors)

{

    struct nbd_request request;

    struct nbd_reply reply;

    ssize_t ret;



    if (!(client->nbdflags & NBD_FLAG_SEND_TRIM)) {

        return 0;

    }

    request.type = NBD_CMD_TRIM;

    request.from = sector_num * 512;

    request.len = nb_sectors * 512;



    nbd_coroutine_start(client, &request);

    ret = nbd_co_send_request(client, &request, NULL, 0);

    if (ret < 0) {

        reply.error = -ret;

    } else {

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

    }

    nbd_coroutine_end(client, &request);

    return -reply.error;



}

    struct nbd_request request;     struct nbd_request request;     struct nbd_request request;     struct nbd_request request;     request.type = NBD_CMD_TRIM;     struct nbd_request request;
int FUNC_0(NbdClientSession *VAR_0, int64_t VAR_1,

    int VAR_2)

{

    struct nbd_request VAR_3;

    struct nbd_reply VAR_4;

    ssize_t ret;



    if (!(VAR_0->nbdflags & NBD_FLAG_SEND_TRIM)) {

        return 0;

    }

    VAR_3.type = NBD_CMD_TRIM;

    VAR_3.from = VAR_1 * 512;

    VAR_3.len = VAR_2 * 512;



    nbd_coroutine_start(VAR_0, &VAR_3);

    ret = nbd_co_send_request(VAR_0, &VAR_3, NULL, 0);

    if (ret < 0) {

        VAR_4.error = -ret;

    } else {

        nbd_co_receive_reply(VAR_0, &VAR_3, &VAR_4, NULL, 0);

    }

    nbd_coroutine_end(VAR_0, &VAR_3);

    return -VAR_4.error;



}

int FUNC_0(NbdClientSession *VAR_0, int64_t VAR_1,
int VAR_2)
{ struct nbd_request VAR_3; struct nbd_reply VAR_4; ssize_t ret; if (!(VAR_0->nbdflags & NBD_FLAG_SEND_TRIM)) { return 0; } VAR_3.type = NBD_CMD_TRIM; VAR_3.from = VAR_1 * 512; VAR_3.len = VAR_2 * 512; nbd_coroutine_start(VAR_0, &VAR_3); ret = nbd_co_send_request(VAR_0, &VAR_3, NULL, 0); if (ret < 0) { VAR_4.error = -ret; } else { nbd_co_receive_reply(VAR_0, &VAR_3, &VAR_4, NULL, 0); } nbd_coroutine_end(VAR_0, &VAR_3); return -VAR_4.error; }