pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)

{

    PVSCSIRequest *pvscsi_req = req->hba_private;

    PVSCSIState *s = pvscsi_req->dev;



    if (!pvscsi_req) {

        trace_pvscsi_command_complete_not_found(req->tag);

        return;

    }



    if (resid) {

        /* Short transfer.  */

        trace_pvscsi_command_complete_data_run();

        pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN;

    }



    pvscsi_req->cmp.scsiStatus = status;

    if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) {

        uint8_t sense[SCSI_SENSE_BUF_SIZE];

        int sense_len =

            scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense));



        trace_pvscsi_command_complete_sense_len(sense_len);

        pvscsi_write_sense(pvscsi_req, sense, sense_len);

    }

    qemu_sglist_destroy(&pvscsi_req->sgl);

    pvscsi_complete_request(s, pvscsi_req);

}

pvscsi_command_complete(SCSIRequest *req, uint32_t status, size_t resid)

{

    PVSCSIRequest *pvscsi_req = req->hba_private;

    PVSCSIState *s = pvscsi_req->dev;



    if (!pvscsi_req) {

        trace_pvscsi_command_complete_not_found(req->tag);

        return;

    }



    if (resid) {

        

        trace_pvscsi_command_complete_data_run();

        pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN;

    }



    pvscsi_req->cmp.scsiStatus = status;

    if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) {

        uint8_t sense[SCSI_SENSE_BUF_SIZE];

        int sense_len =

            scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense));



        trace_pvscsi_command_complete_sense_len(sense_len);

        pvscsi_write_sense(pvscsi_req, sense, sense_len);

    }

    qemu_sglist_destroy(&pvscsi_req->sgl);

    pvscsi_complete_request(s, pvscsi_req);

}

FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1, size_t VAR_2)

{

    PVSCSIRequest *pvscsi_req = VAR_0->hba_private;

    PVSCSIState *s = pvscsi_req->dev;



    if (!pvscsi_req) {

        trace_pvscsi_command_complete_not_found(VAR_0->tag);

        return;

    }



    if (VAR_2) {

        

        trace_pvscsi_command_complete_data_run();

        pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN;

    }



    pvscsi_req->cmp.scsiStatus = VAR_1;

    if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) {

        uint8_t sense[SCSI_SENSE_BUF_SIZE];

        int VAR_3 =

            scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense));



        trace_pvscsi_command_complete_sense_len(VAR_3);

        pvscsi_write_sense(pvscsi_req, sense, VAR_3);

    }

    qemu_sglist_destroy(&pvscsi_req->sgl);

    pvscsi_complete_request(s, pvscsi_req);

}

FUNC_0(SCSIRequest *VAR_0, uint32_t VAR_1, size_t VAR_2)
{ PVSCSIRequest *pvscsi_req = VAR_0->hba_private; PVSCSIState *s = pvscsi_req->dev; if (!pvscsi_req) { trace_pvscsi_command_complete_not_found(VAR_0->tag); return; } if (VAR_2) { trace_pvscsi_command_complete_data_run(); pvscsi_req->cmp.hostStatus = BTSTAT_DATARUN; } pvscsi_req->cmp.scsiStatus = VAR_1; if (pvscsi_req->cmp.scsiStatus == CHECK_CONDITION) { uint8_t sense[SCSI_SENSE_BUF_SIZE]; int VAR_3 =
scsi_req_get_sense(pvscsi_req->sreq, sense, sizeof(sense)); trace_pvscsi_command_complete_sense_len(VAR_3); pvscsi_write_sense(pvscsi_req, sense, VAR_3); } qemu_sglist_destroy(&pvscsi_req->sgl); pvscsi_complete_request(s, pvscsi_req); }