Revision 8af7a3ab

b/hw/scsi-disk.c
784 784
    return toclen;
785 785
}
786 786

  
787
static int scsi_disk_emulate_command(SCSIRequest *req, uint8_t *outbuf)
787
static int scsi_disk_emulate_command(SCSIDiskReq *r, uint8_t *outbuf)
788 788
{
789
    SCSIRequest *req = &r->req;
789 790
    SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev);
790 791
    uint64_t nb_sectors;
791 792
    int buflen = 0;
......
943 944
    return buflen;
944 945

  
945 946
not_ready:
946
    scsi_req_set_status(req, CHECK_CONDITION, NOT_READY);
947
    return 0;
947
    scsi_command_complete(r, CHECK_CONDITION, NOT_READY);
948
    return -1;
948 949

  
949 950
illegal_request:
950
    scsi_req_set_status(req, CHECK_CONDITION, ILLEGAL_REQUEST);
951
    return 0;
951
    scsi_command_complete(r, CHECK_CONDITION, ILLEGAL_REQUEST);
952
    return -1;
952 953
}
953 954

  
954 955
/* Execute a scsi command.  Returns the length of the data expected by the
......
1056 1057
    case REPORT_LUNS:
1057 1058
    case VERIFY:
1058 1059
    case REZERO_UNIT:
1059
        rc = scsi_disk_emulate_command(&r->req, outbuf);
1060
        if (rc > 0) {
1061
            r->iov.iov_len = rc;
1062
        } else {
1063
            scsi_req_complete(&r->req);
1064
            scsi_remove_request(r);
1060
        rc = scsi_disk_emulate_command(r, outbuf);
1061
        if (rc < 0) {
1065 1062
            return 0;
1066 1063
        }
1064

  
1065
        r->iov.iov_len = rc;
1067 1066
        break;
1068 1067
    case READ_6:
1069 1068
    case READ_10:

Also available in: Unified diff