temp: redo the write10/12/16 commands to the new saner api
Signed-off-by: Ronnie Sahlberg <sahlberg@localhost>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
8aefc7d579
commit
8ffd78c117
+51
-747
@@ -3519,61 +3519,15 @@ verify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write10(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
write10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
{
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
|
struct iscsi_data d;
|
||||||
|
int ret;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE10 LBA:%d blocks:%d "
|
logging(LOG_VERBOSE, "Send WRITE10 (Expecting %s) LBA:%d blocks:%d "
|
||||||
"wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
"wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
||||||
lba, datalen / blocksize, wrprotect,
|
scsi_status_str(status),
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write10_sync(iscsi, lun, lba,
|
|
||||||
data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE10 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 command: "
|
|
||||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE10 returned SUCCESS.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE10 (Expecting INVALID_FIELD_IN_CDB) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
lba, datalen / blocksize, wrprotect,
|
||||||
dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
|
|
||||||
@@ -3582,263 +3536,31 @@ write10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
task = iscsi_write10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
task = scsi_cdb_write10(lba, datalen, blocksize, wrprotect,
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
if (task == NULL) {
|
assert(task != NULL);
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE10 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"INVALID_FIELD_IN_CDB. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
d.data = data;
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE10 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
d.size = datalen;
|
||||||
return 0;
|
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||||
|
|
||||||
|
ret = check_result("WRITE10", iscsi, task, status, key, ascq, num_ascq);
|
||||||
|
if (task) {
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
write12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
{
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
|
struct iscsi_data d;
|
||||||
|
int ret;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE10 (Expecting LBA_OUT_OF_RANGE) "
|
logging(LOG_VERBOSE, "Send WRITE12 (Expecting %s) LBA:%d blocks:%d "
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE10 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE10 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE10 (Expecting WRITE_PROTECTED) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE10 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 successful but should "
|
|
||||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 failed with wrong sense. "
|
|
||||||
"Should have failed with DATA_PRTOTECTION/"
|
|
||||||
"WRITE_PROTECTED. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE10 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE10 (Expecting MEDIUM_NOT_PRESENT) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write10_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE10 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 successful but should "
|
|
||||||
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
|
||||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE10 Should have failed "
|
|
||||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
|
||||||
"with %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE10 returned MEDIUM_NOT_PRESENT.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write12(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE12 LBA:%d blocks:%d "
|
|
||||||
"wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
"wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
||||||
lba, datalen / blocksize, wrprotect,
|
scsi_status_str(status),
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write12_sync(iscsi, lun, lba,
|
|
||||||
data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE12 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 command: "
|
|
||||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE12 returned SUCCESS.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE12 (Expecting INVALID_FIELD_IN_CDB) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
lba, datalen / blocksize, wrprotect,
|
||||||
dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
|
|
||||||
@@ -3847,53 +3569,31 @@ write12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
task = iscsi_write12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
task = scsi_cdb_write12(lba, datalen, blocksize, wrprotect,
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
if (task == NULL) {
|
assert(task != NULL);
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE12 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"INVALID_FIELD_IN_CDB. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
d.data = data;
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE12 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
d.size = datalen;
|
||||||
return 0;
|
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||||
|
|
||||||
|
ret = check_result("WRITE12", iscsi, task, status, key, ascq, num_ascq);
|
||||||
|
if (task) {
|
||||||
|
scsi_free_scsi_task(task);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
write12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
write16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq)
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
{
|
||||||
struct scsi_task *task;
|
struct scsi_task *task;
|
||||||
|
struct iscsi_data d;
|
||||||
|
int ret;
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE12 (Expecting LBA_OUT_OF_RANGE) "
|
logging(LOG_VERBOSE, "Send WRITE16 (Expecting %s) LBA:%" PRIu64
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
" blocks:%d wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
scsi_status_str(status),
|
||||||
lba, datalen / blocksize, wrprotect,
|
lba, datalen / blocksize, wrprotect,
|
||||||
dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
|
|
||||||
@@ -3902,415 +3602,19 @@ write12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
task = iscsi_write12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
task = scsi_cdb_write16(lba, datalen, blocksize, wrprotect,
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
dpo, fua, fua_nv, group);
|
||||||
if (task == NULL) {
|
assert(task != NULL);
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE12 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
d.data = data;
|
||||||
return -1;
|
d.size = datalen;
|
||||||
}
|
task = iscsi_scsi_command_sync(iscsi, lun, task, &d);
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
ret = check_result("WRITE16", iscsi, task, status, key, ascq, num_ascq);
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
if (task) {
|
||||||
scsi_free_scsi_task(task);
|
scsi_free_scsi_task(task);
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
}
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
return ret;
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE12 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write12_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE12 (Expecting WRITE_PROTECTED) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE12 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 successful but should "
|
|
||||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 failed with wrong sense. "
|
|
||||||
"Should have failed with DATA_PRTOTECTION/"
|
|
||||||
"WRITE_PROTECTED. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE12 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE12 (Expecting MEDIUM_NOT_PRESENT) "
|
|
||||||
"LBA:%d blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write12_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE12 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 successful but should "
|
|
||||||
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
|
||||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE12 Should have failed "
|
|
||||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
|
||||||
"with %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE12 returned MEDIUM_NOT_PRESENT.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write16(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE16 LBA:%" PRId64 " blocks:%d "
|
|
||||||
"wrprotect:%d dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write16_sync(iscsi, lun, lba,
|
|
||||||
data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 command: "
|
|
||||||
"failed with sense. %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE16 returned SUCCESS.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE16 (Expecting INVALID_FIELD_IN_CDB) "
|
|
||||||
"LBA:%" PRId64 " blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"INVALID_FIELD_IN_CDB. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE16 returned ILLEGAL_REQUEST/INVALID_FIELD_IB_CDB.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE16 (Expecting LBA_OUT_OF_RANGE) "
|
|
||||||
"LBA:%" PRId64 " blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should "
|
|
||||||
"have failed with ILLEGAL_REQUEST/LBA_OUT_OF_RANGE");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_LBA_OUT_OF_RANGE) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 failed with wrong sense. "
|
|
||||||
"Should have failed with ILLEGAL_REQUEST/"
|
|
||||||
"LBA_OUT_OF_RANGE. Sense:%s\n", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE16 returned ILLEGAL_REQUEST/LBA_OUT_OF_RANGE.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE16 (Expecting WRITE_PROTECTED) "
|
|
||||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should "
|
|
||||||
"have failed with DATA_PROTECTION/WRITE_PROTECTED");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_DATA_PROTECTION
|
|
||||||
|| task->sense.ascq != SCSI_SENSE_ASCQ_WRITE_PROTECTED) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 failed with wrong sense. "
|
|
||||||
"Should have failed with DATA_PRTOTECTION/"
|
|
||||||
"WRITE_PROTECTED. Sense:%s\n",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE16 returned DATA_PROTECTION/WRITE_PROTECTED.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
write16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba,
|
|
||||||
uint32_t datalen, int blocksize, int wrprotect,
|
|
||||||
int dpo, int fua, int fua_nv, int group,
|
|
||||||
unsigned char *data)
|
|
||||||
{
|
|
||||||
struct scsi_task *task;
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Send WRITE16 (Expecting MEDIUM_NOT_PRESENT) "
|
|
||||||
"LBA:%" PRIu64 " blocks:%d wrprotect:%d "
|
|
||||||
"dpo:%d fua:%d fua_nv:%d group:%d",
|
|
||||||
lba, datalen / blocksize, wrprotect,
|
|
||||||
dpo, fua, fua_nv, group);
|
|
||||||
|
|
||||||
if (!data_loss) {
|
|
||||||
printf("--dataloss flag is not set in. Skipping write\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
task = iscsi_write16_sync(iscsi, lun, lba, data, datalen, blocksize,
|
|
||||||
wrprotect, dpo, fua, fua_nv, group);
|
|
||||||
if (task == NULL) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] Failed to send WRITE16 command: %s",
|
|
||||||
iscsi_get_error(iscsi));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_GOOD) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 successful but should "
|
|
||||||
"have failed with NOT_READY/MEDIUM_NOT_PRESENT*");
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (task->status == SCSI_STATUS_CHECK_CONDITION
|
|
||||||
&& task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST
|
|
||||||
&& task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE) {
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
if (task->status != SCSI_STATUS_CHECK_CONDITION
|
|
||||||
|| task->sense.key != SCSI_SENSE_NOT_READY
|
|
||||||
|| (task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN
|
|
||||||
&& task->sense.ascq != SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_CLOSED)) {
|
|
||||||
logging(LOG_NORMAL, "[FAILED] WRITE16 Should have failed "
|
|
||||||
"with NOT_READY/MEDIUM_NOT_PRESENT* But failed "
|
|
||||||
"with %s", iscsi_get_error(iscsi));
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
scsi_free_scsi_task(task);
|
|
||||||
logging(LOG_VERBOSE, "[OK] WRITE16 returned MEDIUM_NOT_PRESENT.");
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|||||||
@@ -311,21 +311,9 @@ int unmap_nomedium(struct iscsi_context *iscsi, int lun, int anchor, struct unma
|
|||||||
int verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
int verify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int verify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
int verify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int verify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
int verify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int vprotect, int dpo, int bytchk, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int write10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
int write10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int write10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
int write12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int write10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
int write16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
|
||||||
int write10_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write10_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write12_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write12_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write12_writeprotected(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write12_nomedium(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write16_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write16_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write16_writeprotected(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int write16_nomedium(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int fua, int fua_nv, int group, unsigned char *data);
|
|
||||||
int writesame10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
int writesame10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||||
int writesame10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
int writesame10_lbaoutofrange(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||||
int writesame10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
int writesame10_invalidfieldincdb(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data);
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ test_compareandwrite_miscompare(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -124,7 +125,8 @@ test_compareandwrite_miscompare(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Change byte 27 from the end to 'C' so that it does not match.");
|
logging(LOG_VERBOSE, "Change byte 27 from the end to 'C' so that it does not match.");
|
||||||
|
|||||||
@@ -55,7 +55,8 @@ test_compareandwrite_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -123,7 +124,8 @@ test_compareandwrite_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
if (i > maxbl) {
|
if (i > maxbl) {
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ test_get_lba_status_unmap_single(void)
|
|||||||
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
|
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
|
||||||
"pattern and thus map the blocks", 256 + lbppb);
|
"pattern and thus map the blocks", 256 + lbppb);
|
||||||
ret = write10(iscsic, tgt_lun, 0, (256 + lbppb) * block_size,
|
ret = write10(iscsic, tgt_lun, 0, (256 + lbppb) * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
for (i = 0; i + lbppb <= 256; i += lbppb) {
|
for (i = 0; i + lbppb <= 256; i += lbppb) {
|
||||||
@@ -92,7 +93,8 @@ test_get_lba_status_unmap_single(void)
|
|||||||
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
|
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
|
||||||
"pattern and thus map the blocks", (256 + lbppb));
|
"pattern and thus map the blocks", (256 + lbppb));
|
||||||
ret = write10(iscsic, tgt_lun, 0, (256 + lbppb) * block_size,
|
ret = write10(iscsic, tgt_lun, 0, (256 + lbppb) * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %" PRIu64 " blocks at LBA 0", i);
|
logging(LOG_VERBOSE, "Unmap %" PRIu64 " blocks at LBA 0", i);
|
||||||
list[0].lba = 0;
|
list[0].lba = 0;
|
||||||
|
|||||||
@@ -76,7 +76,8 @@ void test_iscsi_datasn_invalid(void)
|
|||||||
iscsi_set_timeout(iscsic, 3);
|
iscsi_set_timeout(iscsic, 3);
|
||||||
|
|
||||||
ret = write10(iscsic, tgt_lun, 100, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 100, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -98,7 +99,8 @@ void test_iscsi_datasn_invalid(void)
|
|||||||
iscsi_set_timeout(iscsic, 3);
|
iscsi_set_timeout(iscsic, 3);
|
||||||
|
|
||||||
ret = write10(iscsic, tgt_lun, 100, block_size,
|
ret = write10(iscsic, tgt_lun, 100, block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -120,7 +122,8 @@ void test_iscsi_datasn_invalid(void)
|
|||||||
iscsi_set_timeout(iscsic, 3);
|
iscsi_set_timeout(iscsic, 3);
|
||||||
|
|
||||||
ret = write10(iscsic, tgt_lun, 100, block_size,
|
ret = write10(iscsic, tgt_lun, 100, block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -143,7 +146,8 @@ void test_iscsi_datasn_invalid(void)
|
|||||||
iscsi_set_timeout(iscsic, 3);
|
iscsi_set_timeout(iscsic, 3);
|
||||||
|
|
||||||
ret = write10(iscsic, tgt_lun, 100, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 100, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
|
|||||||
@@ -166,18 +166,21 @@ test_nomedia_sbc(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 when medium is ejected.");
|
logging(LOG_VERBOSE, "Test WRITE10 when medium is ejected.");
|
||||||
ret = write10_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write10(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_NO_MEDIUM);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 when medium is ejected.");
|
logging(LOG_VERBOSE, "Test WRITE12 when medium is ejected.");
|
||||||
ret = write12_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write12(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_NO_MEDIUM);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 when medium is ejected.");
|
logging(LOG_VERBOSE, "Test WRITE16 when medium is ejected.");
|
||||||
ret = write16_nomedium(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write16(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_NO_MEDIUM);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITEVERIFY10 when medium is ejected.");
|
logging(LOG_VERBOSE, "Test WRITEVERIFY10 when medium is ejected.");
|
||||||
|
|||||||
@@ -48,7 +48,8 @@ test_orwrite_verify(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
|
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
|
||||||
memset(buf, 0, block_size * i);
|
memset(buf, 0, block_size * i);
|
||||||
ret = write10(iscsic, tgt_lun, 0, i * block_size,
|
ret = write10(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
|
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
|
||||||
@@ -99,7 +100,8 @@ test_orwrite_verify(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
|
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
|
||||||
memset(buf, 0, block_size * i);
|
memset(buf, 0, block_size * i);
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
ret = write16(iscsic, tgt_lun, num_blocks - i, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
|
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
|
||||||
|
|||||||
@@ -41,18 +41,21 @@ test_readonly_sbc(void)
|
|||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 fails with WRITE_PROTECTED");
|
logging(LOG_VERBOSE, "Test WRITE10 fails with WRITE_PROTECTED");
|
||||||
ret = write10_writeprotected(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write10(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_WRITE_PROTECTED);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 fails with WRITE_PROTECTED");
|
logging(LOG_VERBOSE, "Test WRITE12 fails with WRITE_PROTECTED");
|
||||||
ret = write12_writeprotected(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write12(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_WRITE_PROTECTED);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 fails with WRITE_PROTECTED");
|
logging(LOG_VERBOSE, "Test WRITE16 fails with WRITE_PROTECTED");
|
||||||
ret = write16_writeprotected(iscsic, tgt_lun, 0, block_size, block_size,
|
ret = write16(iscsic, tgt_lun, 0, block_size, block_size,
|
||||||
0, 0, 0, 0, 0, buf);
|
0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_WRITE_PROTECTED);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE_SAME10 fails with WRITE_PROTECTED");
|
logging(LOG_VERBOSE, "Test WRITE_SAME10 fails with WRITE_PROTECTED");
|
||||||
|
|||||||
@@ -196,7 +196,8 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
|
|||||||
|
|
||||||
memset(buf, 'a', 256 * block_size);
|
memset(buf, 'a', 256 * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,8 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
|
|||||||
|
|
||||||
memset(buf, 'a', 256 * block_size);
|
memset(buf, 'a', 256 * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ init_lun_with_data(uint64_t lba)
|
|||||||
|
|
||||||
memset(buf, 'a', 256 * block_size);
|
memset(buf, 'a', 256 * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
ret = write16(iscsic, tgt_lun, lba, 256 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
|
|||||||
|
|
||||||
memset(buf, 'a', 256 * block_size);
|
memset(buf, 'a', 256 * block_size);
|
||||||
ret = write10(iscsic, tgt_lun, lba, 256 * block_size,
|
ret = write10(iscsic, tgt_lun, lba, 256 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ test_write10_0blocks(void)
|
|||||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==0");
|
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==0");
|
||||||
ret = write10(iscsic, tgt_lun, 0, 0, block_size,
|
ret = write10(iscsic, tgt_lun, 0, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -47,19 +48,22 @@ test_write10_0blocks(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 0-blocks one block past end-of-LUN");
|
logging(LOG_VERBOSE, "Test WRITE10 0-blocks one block past end-of-LUN");
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
ret = write10(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==2^31");
|
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==2^31");
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0,
|
ret = write10(iscsic, tgt_lun, 0x80000000, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==-1");
|
logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==-1");
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
ret = write10(iscsic, tgt_lun, -1, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ test_write10_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
|
ret = write10(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -61,9 +61,9 @@ test_write10_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
|
ret = write10(iscsic, tgt_lun, 0x80000000,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +73,9 @@ test_write10_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
ret = write10(iscsic, tgt_lun, -1, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,9 +85,9 @@ test_write10_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
|
ret = write10(iscsic, tgt_lun, num_blocks - 1,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ test_write10_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 0, 0, 0, buf,
|
||||||
0, 1, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -51,28 +51,28 @@ test_write10_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==0");
|
logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==0");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 0, 0, buf,
|
||||||
0, 0, 1, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==1");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 1, 0, buf,
|
||||||
0, 0, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with FUA==0 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE10 with FUA==0 FUA_NV==1");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 0, 1, 0, buf,
|
||||||
0, 0, 0, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1 FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE10 with DPO==1 FUA==1 FUA_NV==1");
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 1, 1, 0, buf,
|
||||||
0, 1, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,8 @@ test_write10_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -316,7 +317,8 @@ test_write10_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ test_write10_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10(iscsic, tgt_lun, 0, i * block_size,
|
ret = write10(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
@@ -58,7 +59,8 @@ test_write10_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ test_write10_wrprotect(void)
|
|||||||
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
||||||
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
||||||
for (i = 1; i < 8; i++) {
|
for (i = 1; i < 8; i++) {
|
||||||
ret = write10_invalidfieldincdb(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size,
|
||||||
i, 0, 0, 0, 0, buf);
|
i, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_INVALID_FIELD_IN_CDB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE10 is not implemented.");
|
||||||
CU_PASS("WRITE10 is not implemented.");
|
CU_PASS("WRITE10 is not implemented.");
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ test_write12_0blocks(void)
|
|||||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==0");
|
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==0");
|
||||||
ret = write12(iscsic, tgt_lun, 0, 0, block_size,
|
ret = write12(iscsic, tgt_lun, 0, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
||||||
CU_PASS("WRITE12 is not implemented.");
|
CU_PASS("WRITE12 is not implemented.");
|
||||||
@@ -47,19 +48,22 @@ test_write12_0blocks(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 0-blocks one block past end-of-LUN");
|
logging(LOG_VERBOSE, "Test WRITE12 0-blocks one block past end-of-LUN");
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
ret = write12(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==2^31");
|
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==2^31");
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, 0x80000000, 0,
|
ret = write12(iscsic, tgt_lun, 0x80000000, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==-1");
|
logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==-1");
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
ret = write12(iscsic, tgt_lun, -1, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ test_write12_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
|
ret = write12(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
||||||
CU_PASS("WRITE12 is not implemented.");
|
CU_PASS("WRITE12 is not implemented.");
|
||||||
@@ -61,9 +61,9 @@ test_write12_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, 0x80000000,
|
ret = write12(iscsic, tgt_lun, 0x80000000,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,8 +73,9 @@ test_write12_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
ret = write12(iscsic, tgt_lun, -1, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,9 +85,9 @@ test_write12_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
|
ret = write12(iscsic, tgt_lun, num_blocks - 1,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,8 +39,8 @@ test_write12_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 0, 0, 0, buf,
|
||||||
0, 1, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
||||||
CU_PASS("WRITE12 is not implemented.");
|
CU_PASS("WRITE12 is not implemented.");
|
||||||
@@ -51,28 +51,28 @@ test_write12_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==0");
|
logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==0");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 0, 0, buf,
|
||||||
0, 0, 1, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==1");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 1, 0, buf,
|
||||||
0, 0, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with FUA==0 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE12 with FUA==0 FUA_NV==1");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 0, 1, 0, buf,
|
||||||
0, 0, 0, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1 FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE12 with DPO==1 FUA==1 FUA_NV==1");
|
||||||
ret = write12(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 1, 1, 0, buf,
|
||||||
0, 1, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -242,7 +242,8 @@ test_write12_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -316,7 +317,8 @@ test_write12_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ test_write12_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12(iscsic, tgt_lun, 0, i * block_size,
|
ret = write12(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
||||||
CU_PASS("WRITE12 is not implemented.");
|
CU_PASS("WRITE12 is not implemented.");
|
||||||
@@ -57,7 +58,8 @@ test_write12_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write12(iscsic, tgt_lun, num_blocks - i,
|
ret = write12(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,9 +45,10 @@ test_write12_wrprotect(void)
|
|||||||
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
||||||
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
||||||
for (i = 1; i < 8; i++) {
|
for (i = 1; i < 8; i++) {
|
||||||
ret = write12_invalidfieldincdb(iscsic, tgt_lun, 0,
|
ret = write12(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size,
|
||||||
i, 0, 0, 0, 0, buf);
|
i, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_INVALID_FIELD_IN_CDB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE12 is not implemented.");
|
||||||
CU_PASS("WRITE12 is not implemented.");
|
CU_PASS("WRITE12 is not implemented.");
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ test_write16_0blocks(void)
|
|||||||
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
logging(LOG_VERBOSE, LOG_BLANK_LINE);
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0");
|
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0");
|
||||||
ret = write16(iscsic, tgt_lun, 0, 0, block_size,
|
ret = write16(iscsic, tgt_lun, 0, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -43,19 +44,22 @@ test_write16_0blocks(void)
|
|||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 0-blocks one block past end-of-LUN");
|
logging(LOG_VERBOSE, "Test WRITE16 0-blocks one block past end-of-LUN");
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1, 0,
|
ret = write16(iscsic, tgt_lun, num_blocks + 1, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==2^63");
|
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==2^63");
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL, 0,
|
ret = write16(iscsic, tgt_lun, 0x8000000000000000ULL, 0,
|
||||||
block_size, 0, 0, 0, 0, 0, NULL);
|
block_size, 0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==-1");
|
logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==-1");
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, -1, 0, block_size,
|
ret = write16(iscsic, tgt_lun, -1, 0, block_size,
|
||||||
0, 0, 0, 0, 0, NULL);
|
0, 0, 0, 0, 0, NULL,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ test_write16_beyond_eol(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks + 1 - i,
|
ret = write16(iscsic, tgt_lun, num_blocks + 1 - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -59,9 +59,9 @@ test_write16_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, 0x8000000000000000ULL,
|
ret = write16(iscsic, tgt_lun, 0x8000000000000000ULL,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,8 +71,9 @@ test_write16_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, -1, i * block_size,
|
ret = write16(iscsic, tgt_lun, -1, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,9 +83,9 @@ test_write16_beyond_eol(void)
|
|||||||
if (maximum_transfer_length && maximum_transfer_length < i) {
|
if (maximum_transfer_length && maximum_transfer_length < i) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16_lbaoutofrange(iscsic, tgt_lun, num_blocks - 1,
|
ret = write16(iscsic, tgt_lun, num_blocks - 1,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_LBA_OOB);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ test_write16_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1");
|
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 0, 0, 0, buf,
|
||||||
0, 1, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -52,28 +52,28 @@ test_write16_flags(void)
|
|||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==0");
|
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==0");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 0, 0, buf,
|
||||||
0, 0, 1, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==1");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 1, 1, 0, buf,
|
||||||
0, 0, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with FUA==0 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE16 with FUA==0 FUA_NV==1");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 0, 0, 1, 0, buf,
|
||||||
0, 0, 0, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1 FUA==1 FUA_NV==1");
|
logging(LOG_VERBOSE, "Test WRITE16 with DPO==1 FUA==1 FUA_NV==1");
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size, 0, 1, 1, 1, 0, buf,
|
||||||
0, 1, 1, 1, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,8 @@ test_write16_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -311,7 +312,8 @@ test_write16_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ test_write16_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
ret = write16(iscsic, tgt_lun, 0, i * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
@@ -59,7 +60,8 @@ test_write16_simple(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size, 0, 0, 0, 0, 0, buf);
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,9 +44,10 @@ test_write16_wrprotect(void)
|
|||||||
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
|
||||||
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
|
||||||
for (i = 1; i < 8; i++) {
|
for (i = 1; i < 8; i++) {
|
||||||
ret = write16_invalidfieldincdb(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
block_size, block_size,
|
block_size, block_size,
|
||||||
i, 0, 0, 0, 0, buf);
|
i, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_INVALID_FIELD_IN_CDB);
|
||||||
if (ret == -2) {
|
if (ret == -2) {
|
||||||
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented.");
|
||||||
CU_PASS("WRITE16 is not implemented.");
|
CU_PASS("WRITE16 is not implemented.");
|
||||||
|
|||||||
@@ -45,8 +45,8 @@ test_writesame10_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
||||||
@@ -83,8 +83,8 @@ test_writesame10_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
||||||
@@ -158,8 +158,8 @@ test_writesame10_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write10(iscsic, tgt_lun, 0,
|
ret = write10(iscsic, tgt_lun, 0,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ test_writesame10_unmap_until_end(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, block_size * i);
|
memset(buf, 0xff, block_size * i);
|
||||||
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
ret = write10(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i);
|
||||||
|
|||||||
@@ -47,9 +47,8 @@ test_writesame16_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
||||||
memset(buf, 0, block_size);
|
memset(buf, 0, block_size);
|
||||||
ret = writesame16(iscsic, tgt_lun, 0,
|
ret = writesame16(iscsic, tgt_lun, 0,
|
||||||
@@ -85,8 +84,8 @@ test_writesame16_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
||||||
@@ -156,8 +155,8 @@ test_writesame16_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
||||||
@@ -207,8 +206,8 @@ test_writesame16_unmap(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, i * block_size);
|
memset(buf, 0xff, i * block_size);
|
||||||
ret = write16(iscsic, tgt_lun, 0,
|
ret = write16(iscsic, tgt_lun, 0,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
||||||
|
|||||||
@@ -48,9 +48,8 @@ test_writesame16_unmap_until_end(void)
|
|||||||
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
|
||||||
memset(buf, 0xff, block_size * i);
|
memset(buf, 0xff, block_size * i);
|
||||||
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
ret = write16(iscsic, tgt_lun, num_blocks - i,
|
||||||
i * block_size, block_size,
|
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
|
||||||
0, 0, 0, 0, 0, buf);
|
EXPECT_STATUS_GOOD);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i);
|
||||||
ret = writesame16(iscsic, tgt_lun, num_blocks - i,
|
ret = writesame16(iscsic, tgt_lun, num_blocks - i,
|
||||||
0, i,
|
0, i,
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ test_writeverify10_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -320,7 +321,8 @@ test_writeverify10_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write10(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
@@ -246,7 +246,8 @@ test_writeverify12_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -320,7 +321,8 @@ test_writeverify12_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write12(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
@@ -247,7 +247,8 @@ test_writeverify16_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
logging(LOG_VERBOSE, "Write one block of 'b' but set iSCSI EDTL to 2 blocks.");
|
||||||
@@ -321,7 +322,8 @@ test_writeverify16_residuals(void)
|
|||||||
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
logging(LOG_VERBOSE, "Write two blocks of 'a'");
|
||||||
memset(buf, 'a', 10000);
|
memset(buf, 'a', 10000);
|
||||||
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
ret = write16(iscsic, tgt_lun, 0, 2 * block_size,
|
||||||
block_size, 0, 0, 0, 0, 0, buf);
|
block_size, 0, 0, 0, 0, 0, buf,
|
||||||
|
EXPECT_STATUS_GOOD);
|
||||||
CU_ASSERT_EQUAL(ret, 0);
|
CU_ASSERT_EQUAL(ret, 0);
|
||||||
|
|
||||||
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
logging(LOG_VERBOSE, "Write two blocks of 'b' but set iSCSI EDTL to 1 blocks.");
|
||||||
|
|||||||
Reference in New Issue
Block a user