TESTS: Change all tests to use 'block_size' instead of hardcoded 512
This should allow the testst to work corectly on block devices with 4k blocksize too.
This commit is contained in:
@@ -28,6 +28,8 @@ int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss
|
||||
struct scsi_task *task;
|
||||
int full_size;
|
||||
struct scsi_inquiry_standard *inq;
|
||||
struct scsi_readcapacity10 *rc10;
|
||||
uint32_t block_size;
|
||||
int ret, i, lun;
|
||||
|
||||
printf("0103_read10_rdprotect:\n");
|
||||
@@ -83,6 +85,29 @@ int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss
|
||||
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
/* find the size of the LUN */
|
||||
task = iscsi_readcapacity10_sync(iscsi, lun, 0, 0);
|
||||
if (task == NULL) {
|
||||
printf("Failed to send readcapacity10 command: %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
goto finished;
|
||||
}
|
||||
if (task->status != SCSI_STATUS_GOOD) {
|
||||
printf("Readcapacity command: failed with sense. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
}
|
||||
rc10 = scsi_datain_unmarshall(task);
|
||||
if (rc10 == NULL) {
|
||||
printf("failed to unmarshall readcapacity10 data. %s\n", iscsi_get_error(iscsi));
|
||||
ret = -1;
|
||||
scsi_free_scsi_task(task);
|
||||
goto finished;
|
||||
}
|
||||
block_size = rc10->block_size;
|
||||
scsi_free_scsi_task(task);
|
||||
|
||||
|
||||
ret = 0;
|
||||
|
||||
@@ -104,7 +129,7 @@ int T0103_read10_rdprotect(const char *initiator, const char *url, int data_loss
|
||||
task->cdb[8] = 1;
|
||||
task->cdb_size = 10;
|
||||
task->xfer_dir = SCSI_XFER_READ;
|
||||
task->expxferlen = 512;
|
||||
task->expxferlen = block_size;
|
||||
|
||||
if (iscsi_scsi_command_sync(iscsi, lun, task, NULL) == NULL) {
|
||||
printf("[FAILED]\n");
|
||||
|
||||
Reference in New Issue
Block a user