static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)

{

    vscsi_req *req;

    int done;



    req = vscsi_get_req(s);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Failed to get a request !\n");

        return;

    }



    /* We only support a limited number of descriptors, we know

     * the ibmvscsi driver uses up to 10 max, so it should fit

     * in our 256 bytes IUs. If not we'll have to increase the size

     * of the structure.

     */

    if (crq->s.IU_length > sizeof(union viosrp_iu)) {

        fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",

                crq->s.IU_length);

        return;

    }



    /* XXX Handle failure differently ? */

    if (spapr_tce_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,

                           crq->s.IU_length)) {

        fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");

        g_free(req);

    }

    memcpy(&req->crq, crq, sizeof(vscsi_crq));



    if (crq->s.format == VIOSRP_MAD_FORMAT) {

        done = vscsi_handle_mad_req(s, req);

    } else {

        done = vscsi_handle_srp_req(s, req);

    }



    if (done) {

        vscsi_put_req(req);

    }

}

static void vscsi_got_payload(VSCSIState *s, vscsi_crq *crq)

{

    vscsi_req *req;

    int done;



    req = vscsi_get_req(s);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Failed to get a request !\n");

        return;

    }



    









    if (crq->s.IU_length > sizeof(union viosrp_iu)) {

        fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",

                crq->s.IU_length);

        return;

    }



    

    if (spapr_tce_dma_read(&s->vdev, crq->s.IU_data_ptr, &req->iu,

                           crq->s.IU_length)) {

        fprintf(stderr, "vscsi_got_payload: DMA read failure !\n");

        g_free(req);

    }

    memcpy(&req->crq, crq, sizeof(vscsi_crq));



    if (crq->s.format == VIOSRP_MAD_FORMAT) {

        done = vscsi_handle_mad_req(s, req);

    } else {

        done = vscsi_handle_srp_req(s, req);

    }



    if (done) {

        vscsi_put_req(req);

    }

}

        g_free(req);
static void FUNC_0(VSCSIState *VAR_0, vscsi_crq *VAR_1)

{

    vscsi_req *req;

    int VAR_2;



    req = vscsi_get_req(VAR_0);

    if (req == NULL) {

        fprintf(stderr, "VSCSI: Failed to get a request !\n");

        return;

    }



    









    if (VAR_1->VAR_0.IU_length > sizeof(union viosrp_iu)) {

        fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",

                VAR_1->VAR_0.IU_length);

        return;

    }



    

    if (spapr_tce_dma_read(&VAR_0->vdev, VAR_1->VAR_0.IU_data_ptr, &req->iu,

                           VAR_1->VAR_0.IU_length)) {

        fprintf(stderr, "FUNC_0: DMA read failure !\n");

        g_free(req);

    }

    memcpy(&req->VAR_1, VAR_1, sizeof(vscsi_crq));



    if (VAR_1->VAR_0.format == VIOSRP_MAD_FORMAT) {

        VAR_2 = vscsi_handle_mad_req(VAR_0, req);

    } else {

        VAR_2 = vscsi_handle_srp_req(VAR_0, req);

    }



    if (VAR_2) {

        vscsi_put_req(req);

    }

}

static void FUNC_0(VSCSIState *VAR_0, vscsi_crq *VAR_1)
{ vscsi_req *req; int VAR_2; req = vscsi_get_req(VAR_0); if (req == NULL) { fprintf(stderr, "VSCSI: Failed to get a request !\n"); return; } if (VAR_1->VAR_0.IU_length > sizeof(union viosrp_iu)) { fprintf(stderr, "VSCSI: SRP IU too long (%d bytes) !\n",
VAR_1->VAR_0.IU_length); return; } if (spapr_tce_dma_read(&VAR_0->vdev, VAR_1->VAR_0.IU_data_ptr, &req->iu,
VAR_1->VAR_0.IU_length)) { fprintf(stderr, "FUNC_0: DMA read failure !\n"); g_free(req); } memcpy(&req->VAR_1, VAR_1, sizeof(vscsi_crq)); if (VAR_1->VAR_0.format == VIOSRP_MAD_FORMAT) { VAR_2 = vscsi_handle_mad_req(VAR_0, req); } else { VAR_2 = vscsi_handle_srp_req(VAR_0, req); } if (VAR_2) { vscsi_put_req(req); } }