TESTS: Read standard inq page before we spawn the tests
We dont need to call inq so often from the tests if we read the standard page once before the tests begin
This commit is contained in:
@@ -26,8 +26,6 @@ int T0103_read10_rdprotect(const char *initiator, const char *url)
|
||||
{
|
||||
struct iscsi_context *iscsi;
|
||||
struct scsi_task *task;
|
||||
int full_size;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
int ret, i, lun;
|
||||
|
||||
printf("0103_read10_rdprotect:\n");
|
||||
@@ -45,44 +43,11 @@ int T0103_read10_rdprotect(const char *initiator, const char *url)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* See how big this inquiry data is */
|
||||
task = iscsi_inquiry_sync(iscsi, lun, 0, 0, 64);
|
||||
if (task == NULL || task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
full_size = scsi_datain_getfullsize(task);
|
||||
if (full_size > task->datain.size) {
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
/* we need more data for the full list */
|
||||
if ((task = iscsi_inquiry_sync(iscsi, lun, 0, 0, full_size)) == NULL) {
|
||||
printf("Inquiry command failed : %s\n", iscsi_get_error(iscsi));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
inq = scsi_datain_unmarshall(task);
|
||||
if (inq == NULL) {
|
||||
printf("failed to unmarshall inquiry datain blob\n");
|
||||
scsi_free_scsi_task(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (inq->device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
if (device_type != SCSI_INQUIRY_PERIPHERAL_DEVICE_TYPE_DIRECT_ACCESS) {
|
||||
printf("LUN is not SBC device. Skipping test\n");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (inq->protect) {
|
||||
printf("LUN is formatted with protection information. Skipping test\n");
|
||||
scsi_free_scsi_task(task);
|
||||
return -2;
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user