static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)

{

    SCSIDevice *sdev = req->sdev;

    uint8_t *cdb = req->iu.srp.cmd.cdb;

    int n;



    cdb[0] = 3;

    cdb[1] = 0;

    cdb[2] = 0;

    cdb[3] = 0;

    cdb[4] = 96;

    cdb[5] = 0;

    req->sensing = 1;

    n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun);

    dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag);

    if (n < 0) {

        fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n");

        sdev->info->cancel_io(sdev, req->qtag);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);

        vscsi_put_req(s, req);

        return;

    } else if (n == 0) {

        return;

    }

    sdev->info->read_data(sdev, req->qtag);

}

static void vscsi_send_request_sense(VSCSIState *s, vscsi_req *req)

{

    SCSIDevice *sdev = req->sdev;

    uint8_t *cdb = req->iu.srp.cmd.cdb;

    int n;



    cdb[0] = 3;

    cdb[1] = 0;

    cdb[2] = 0;

    cdb[3] = 0;

    cdb[4] = 96;

    cdb[5] = 0;

    req->sensing = 1;

    n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun);

    dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag);

    if (n < 0) {

        fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n");

        sdev->info->cancel_io(sdev, req->qtag);

        vscsi_makeup_sense(s, req, HARDWARE_ERROR, 0, 0);

        vscsi_send_rsp(s, req, CHECK_CONDITION, 0, 0);

        vscsi_put_req(s, req);

        return;

    } else if (n == 0) {

        return;

    }

    sdev->info->read_data(sdev, req->qtag);

}

    n = sdev->info->send_command(sdev, req->qtag, cdb, req->lun);         sdev->info->cancel_io(sdev, req->qtag);     sdev->info->read_data(sdev, req->qtag);         sdev->info->cancel_io(sdev, req->qtag);
static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1)

{

    SCSIDevice *sdev = VAR_1->sdev;

    uint8_t *cdb = VAR_1->iu.srp.cmd.cdb;

    int VAR_2;



    cdb[0] = 3;

    cdb[1] = 0;

    cdb[2] = 0;

    cdb[3] = 0;

    cdb[4] = 96;

    cdb[5] = 0;

    VAR_1->sensing = 1;

    VAR_2 = sdev->info->send_command(sdev, VAR_1->qtag, cdb, VAR_1->lun);

    dprintf("VSCSI: Queued request sense tag 0x%x\VAR_2", VAR_1->qtag);

    if (VAR_2 < 0) {

        fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\VAR_2");

        sdev->info->cancel_io(sdev, VAR_1->qtag);

        vscsi_makeup_sense(VAR_0, VAR_1, HARDWARE_ERROR, 0, 0);

        vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0);

        vscsi_put_req(VAR_0, VAR_1);

        return;

    } else if (VAR_2 == 0) {

        return;

    }

    sdev->info->read_data(sdev, VAR_1->qtag);

}

static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1)
{ SCSIDevice *sdev = VAR_1->sdev; uint8_t *cdb = VAR_1->iu.srp.cmd.cdb; int VAR_2; cdb[0] = 3; cdb[1] = 0; cdb[2] = 0; cdb[3] = 0; cdb[4] = 96; cdb[5] = 0; VAR_1->sensing = 1; VAR_2 = sdev->info->send_command(sdev, VAR_1->qtag, cdb, VAR_1->lun); dprintf("VSCSI: Queued request sense tag 0x%x\VAR_2", VAR_1->qtag); if (VAR_2 < 0) { fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\VAR_2"); sdev->info->cancel_io(sdev, VAR_1->qtag); vscsi_makeup_sense(VAR_0, VAR_1, HARDWARE_ERROR, 0, 0); vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0); vscsi_put_req(VAR_0, VAR_1); return; } else if (VAR_2 == 0) { return; } sdev->info->read_data(sdev, VAR_1->qtag); }