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

{

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

    uint8_t resp_data[36];

    int rc, len, alen;



    /* We dont do EVPD. Also check that page_code is 0 */

    if ((cdb[1] & 0x01) || (cdb[1] & 0x01) || cdb[2] != 0) {

        /* Send INVALID FIELD IN CDB */

        vscsi_makeup_sense(s, req, ILLEGAL_REQUEST, 0x24, 0);

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

        return;

    }

    alen = cdb[3];

    alen = (alen << 8) | cdb[4];

    len = MIN(alen, 36);



    /* Fake up inquiry using PQ=3 */

    memset(resp_data, 0, 36);

    resp_data[0] = 0x7f;   /* Not capable of supporting a device here */

    resp_data[2] = 0x06;   /* SPS-4 */

    resp_data[3] = 0x02;   /* Resp data format */

    resp_data[4] = 36 - 5; /* Additional length */

    resp_data[7] = 0x10;   /* Sync transfers */

    memcpy(&resp_data[16], "QEMU EMPTY      ", 16);

    memcpy(&resp_data[8], "QEMU    ", 8);



    req->writing = 0;

    vscsi_preprocess_desc(req);

    rc = vscsi_srp_transfer_data(s, req, 0, resp_data, len);

    if (rc < 0) {

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

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

    } else {

        vscsi_send_rsp(s, req, 0, 36 - rc, 0);

    }

}

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

{

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

    uint8_t resp_data[36];

    int rc, len, alen;



    

    if ((cdb[1] & 0x01) || (cdb[1] & 0x01) || cdb[2] != 0) {

        

        vscsi_makeup_sense(s, req, ILLEGAL_REQUEST, 0x24, 0);

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

        return;

    }

    alen = cdb[3];

    alen = (alen << 8) | cdb[4];

    len = MIN(alen, 36);



    

    memset(resp_data, 0, 36);

    resp_data[0] = 0x7f;   

    resp_data[2] = 0x06;   

    resp_data[3] = 0x02;   

    resp_data[4] = 36 - 5; 

    resp_data[7] = 0x10;   

    memcpy(&resp_data[16], "QEMU EMPTY      ", 16);

    memcpy(&resp_data[8], "QEMU    ", 8);



    req->writing = 0;

    vscsi_preprocess_desc(req);

    rc = vscsi_srp_transfer_data(s, req, 0, resp_data, len);

    if (rc < 0) {

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

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

    } else {

        vscsi_send_rsp(s, req, 0, 36 - rc, 0);

    }

}

static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1)

{

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

    uint8_t resp_data[36];

    int VAR_2, VAR_3, VAR_4;



    

    if ((cdb[1] & 0x01) || (cdb[1] & 0x01) || cdb[2] != 0) {

        

        vscsi_makeup_sense(VAR_0, VAR_1, ILLEGAL_REQUEST, 0x24, 0);

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

        return;

    }

    VAR_4 = cdb[3];

    VAR_4 = (VAR_4 << 8) | cdb[4];

    VAR_3 = MIN(VAR_4, 36);



    

    memset(resp_data, 0, 36);

    resp_data[0] = 0x7f;   

    resp_data[2] = 0x06;   

    resp_data[3] = 0x02;   

    resp_data[4] = 36 - 5; 

    resp_data[7] = 0x10;   

    memcpy(&resp_data[16], "QEMU EMPTY      ", 16);

    memcpy(&resp_data[8], "QEMU    ", 8);



    VAR_1->writing = 0;

    vscsi_preprocess_desc(VAR_1);

    VAR_2 = vscsi_srp_transfer_data(VAR_0, VAR_1, 0, resp_data, VAR_3);

    if (VAR_2 < 0) {

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

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

    } else {

        vscsi_send_rsp(VAR_0, VAR_1, 0, 36 - VAR_2, 0);

    }

}

static void FUNC_0(VSCSIState *VAR_0, vscsi_req *VAR_1)
{ uint8_t *cdb = VAR_1->iu.srp.cmd.cdb; uint8_t resp_data[36]; int VAR_2, VAR_3, VAR_4; if ((cdb[1] & 0x01) || (cdb[1] & 0x01) || cdb[2] != 0) { vscsi_makeup_sense(VAR_0, VAR_1, ILLEGAL_REQUEST, 0x24, 0); vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0); return; } VAR_4 = cdb[3]; VAR_4 = (VAR_4 << 8) | cdb[4]; VAR_3 = MIN(VAR_4, 36); memset(resp_data, 0, 36); resp_data[0] = 0x7f; resp_data[2] = 0x06; resp_data[3] = 0x02; resp_data[4] = 36 - 5; resp_data[7] = 0x10; memcpy(&resp_data[16], "QEMU EMPTY      ", 16); memcpy(&resp_data[8], "QEMU    ", 8); VAR_1->writing = 0; vscsi_preprocess_desc(VAR_1); VAR_2 = vscsi_srp_transfer_data(VAR_0, VAR_1, 0, resp_data, VAR_3); if (VAR_2 < 0) { vscsi_makeup_sense(VAR_0, VAR_1, HARDWARE_ERROR, 0, 0); vscsi_send_rsp(VAR_0, VAR_1, CHECK_CONDITION, 0, 0); } else { vscsi_send_rsp(VAR_0, VAR_1, 0, 36 - VAR_2, 0); } }