TESTS: change the function signatures for the helpers

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
Ronnie Sahlberg
2014-09-18 18:19:04 -07:00
parent 9b768f7de9
commit 072291c852
169 changed files with 1071 additions and 1030 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -235,71 +235,71 @@ static inline int pr_type_is_all_registrants(
}
}
int prin_task(struct iscsi_context *iscsi, int lun, int service_action,
int prin_task(struct scsi_device *sdev, int service_action,
int success_expected);
int prin_read_keys(struct iscsi_context *iscsi, int lun, struct scsi_task **tp,
int prin_read_keys(struct scsi_device *sdev, struct scsi_task **tp,
struct scsi_persistent_reserve_in_read_keys **rkp);
int prout_register_and_ignore(struct iscsi_context *iscsi, int lun,
int prout_register_and_ignore(struct scsi_device *sdev,
unsigned long long key);
int prout_register_key(struct iscsi_context *iscsi, int lun,
int prout_register_key(struct scsi_device *sdev,
unsigned long long sark, unsigned long long rk);
int prin_verify_key_presence(struct iscsi_context *iscsi, int lun,
int prin_verify_key_presence(struct scsi_device *sdev,
unsigned long long key, int present);
int prout_reregister_key_fails(struct iscsi_context *iscsi, int lun,
int prout_reregister_key_fails(struct scsi_device *sdev,
unsigned long long sark);
int prout_reserve(struct iscsi_context *iscsi, int lun,
int prout_reserve(struct scsi_device *sdev,
unsigned long long key, enum scsi_persistent_out_type pr_type);
int prout_release(struct iscsi_context *iscsi, int lun,
int prout_release(struct scsi_device *sdev,
unsigned long long key, enum scsi_persistent_out_type pr_type);
int prin_verify_not_reserved(struct iscsi_context *iscsi, int lun);
int prin_verify_reserved_as(struct iscsi_context *iscsi, int lun,
int prin_verify_not_reserved(struct scsi_device *sdev);
int prin_verify_reserved_as(struct scsi_device *sdev,
unsigned long long key, enum scsi_persistent_out_type pr_type);
int verify_read_works(struct iscsi_context *iscsi, int lun, unsigned char *buf);
int verify_write_works(struct iscsi_context *iscsi, int lun, unsigned char *buf);
int verify_read_fails(struct iscsi_context *iscsi, int lun, unsigned char *buf);
int verify_write_fails(struct iscsi_context *iscsi, int lun, unsigned char *buf);
int inquiry(struct iscsi_context *iscsi, struct scsi_task **task, int lun, int evpd, int page_code, int maxsize, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int compareandwrite(struct iscsi_context *iscsi, int lun, uint64_t lba, unsigned char *data, uint32_t len, int blocksize, int wrprotect, int dpo, int fua, int group_number, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int get_lba_status(struct iscsi_context *iscsi, struct scsi_task **task, int lun, uint64_t lba, uint32_t len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int orwrite(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 prefetch10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int prefetch16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int preventallow(struct iscsi_context *iscsi, int lun, int prevent);
int read6(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read10(struct iscsi_context *iscsi, struct scsi_task **task, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 read12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 read16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 readcapacity10(struct iscsi_context *iscsi, int lun, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int readcapacity16(struct iscsi_context *iscsi, int lun, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int report_supported_opcodes(struct iscsi_context *iscsi, struct scsi_task **save_task, int lun, int rctd, int options, int opcode, int sa, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int release6(struct iscsi_context *iscsi, int lun);
int reserve6(struct iscsi_context *iscsi, int lun);
int reserve6_conflict(struct iscsi_context *iscsi, int lun);
int sanitize(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_conflict(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_invalidfieldincdb(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_writeprotected(struct iscsi_context *iscsi, int lun, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int startstopunit(struct iscsi_context *iscsi, int lun, int immed, int pcm, int pc, int no_flush, int loej, int start, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int synchronizecache10(struct iscsi_context *iscsi, int lun, uint32_t lba, int num_blocks, int sync_nv, int immed, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int synchronizecache16(struct iscsi_context *iscsi, int lun, uint64_t lba, int num_blocks, int sync_nv, int immed, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int testunitready_clear_ua(struct iscsi_context *iscsi, int lun);
int testunitready(struct iscsi_context *iscsi, int lun, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int mode_sense(struct iscsi_context *iscsi, int lun);
int unmap(struct iscsi_context *iscsi, int lun, int anchor, struct unmap_list *list, int list_len, 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 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 status, enum scsi_sense_key key, int *ascq, int num_ascq);
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 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 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 status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writesame16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify10(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify12(struct iscsi_context *iscsi, int lun, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify16(struct iscsi_context *iscsi, int lun, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int verify_read_works(struct scsi_device *sdev, unsigned char *buf);
int verify_write_works(struct scsi_device *sdev, unsigned char *buf);
int verify_read_fails(struct scsi_device *sdev, unsigned char *buf);
int verify_write_fails(struct scsi_device *sdev, unsigned char *buf);
int inquiry(struct scsi_device *sdev, struct scsi_task **task, int evpd, int page_code, int maxsize, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int compareandwrite(struct scsi_device *sdev, uint64_t lba, unsigned char *data, uint32_t len, int blocksize, int wrprotect, int dpo, int fua, int group_number, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int get_lba_status(struct scsi_device *sdev, struct scsi_task **task, uint64_t lba, uint32_t len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int orwrite(struct scsi_device *sdev, 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 prefetch10(struct scsi_device *sdev, uint32_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int prefetch16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int immed, int group, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int preventallow(struct scsi_device *sdev, int prevent);
int read6(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int read10(struct scsi_device *sdev, struct scsi_task **task, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 read12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 read16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int rdprotect, 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 readcapacity10(struct scsi_device *sdev, uint32_t lba, int pmi, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int readcapacity16(struct scsi_device *sdev, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int report_supported_opcodes(struct scsi_device *sdev, struct scsi_task **save_task, int rctd, int options, int opcode, int sa, int alloc_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int release6(struct scsi_device *sdev);
int reserve6(struct scsi_device *sdev);
int reserve6_conflict(struct scsi_device *sdev);
int sanitize(struct scsi_device *sdev, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_conflict(struct scsi_device *sdev, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_invalidfieldincdb(struct scsi_device *sdev, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int sanitize_writeprotected(struct scsi_device *sdev, int immed, int ause, int sa, int param_len, struct iscsi_data *data);
int startstopunit(struct scsi_device *sdev, int immed, int pcm, int pc, int no_flush, int loej, int start, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int synchronizecache10(struct scsi_device *sdev, uint32_t lba, int num_blocks, int sync_nv, int immed, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int synchronizecache16(struct scsi_device *sdev, uint64_t lba, int num_blocks, int sync_nv, int immed, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int testunitready_clear_ua(struct scsi_device *sdev);
int testunitready(struct scsi_device *sdev, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int mode_sense(struct scsi_device *sdev);
int unmap(struct scsi_device *sdev, int anchor, struct unmap_list *list, int list_len, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int verify10(struct scsi_device *sdev, 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 scsi_device *sdev, 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 scsi_device *sdev, 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 scsi_device *sdev, 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 write12(struct scsi_device *sdev, 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 write16(struct scsi_device *sdev, 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 writesame10(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writesame16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int num_blocks, int anchor, int unmap, int wrprotect, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify10(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify12(struct scsi_device *sdev, uint32_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int writeverify16(struct scsi_device *sdev, uint64_t lba, uint32_t datalen, int blocksize, int wrprotect, int dpo, int bytchk, int group, unsigned char *data, int status, enum scsi_sense_key key, int *ascq, int num_ascq);
int set_swp(struct iscsi_context *iscsi, int lun);
int clear_swp(struct iscsi_context *iscsi, int lun);
int set_swp(struct scsi_device *sdev);
int clear_swp(struct scsi_device *sdev);
#endif /* _ISCSI_SUPPORT_H_ */

View File

@@ -53,7 +53,7 @@ test_compareandwrite_miscompare(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = write16(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -72,7 +72,7 @@ test_compareandwrite_miscompare(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
@@ -90,7 +90,7 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Overwrite %d blocks with 'B' "
"at LBA:0 (if they all contain 'A')", i);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0,
EXPECT_MISCOMPARE);
@@ -103,7 +103,7 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are still unchanged as 'A'", i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = read16(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -128,7 +128,7 @@ test_compareandwrite_miscompare(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = write16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -142,7 +142,7 @@ test_compareandwrite_miscompare(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
@@ -155,7 +155,7 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Overwrite %d blocks with 'B' "
"at LBA:%" PRIu64 " (if they all contain 'A')",
i, num_blocks - i);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = compareandwrite(sd, num_blocks - i,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0,
EXPECT_MISCOMPARE);
@@ -164,7 +164,7 @@ test_compareandwrite_miscompare(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64
"they are still unchanged as 'A'",
i, num_blocks - i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = read16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -54,7 +54,7 @@ test_compareandwrite_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = write16(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -69,7 +69,7 @@ test_compareandwrite_simple(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
@@ -87,7 +87,7 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Overwrite %d blocks with 'B' "
"at LBA:0 (if they all contain 'A')", i);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0,
EXPECT_STATUS_GOOD);
@@ -100,7 +100,7 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:0 and verify "
"they are all 'B'", i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = read16(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -126,7 +126,7 @@ test_compareandwrite_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = write16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -136,7 +136,7 @@ test_compareandwrite_simple(void)
"BlockLimits.MaximumCompareAndWriteLength(%d). "
"Command should fail with INVALID_FIELD_IN_CDB",
i, maxbl);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = compareandwrite(sd, 0,
buf, 2 * i * block_size,
block_size, 0, 0, 0, 0,
EXPECT_INVALID_FIELD_IN_CDB);
@@ -149,7 +149,7 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Overwrite %d blocks with 'B' "
"at LBA:%" PRIu64 " (if they all contain 'A')",
i, num_blocks - i);
ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = compareandwrite(sd, num_blocks - i,
buf, 2 * i * block_size, block_size,
0, 0, 0, 0,
EXPECT_STATUS_GOOD);
@@ -158,7 +158,7 @@ test_compareandwrite_simple(void)
logging(LOG_VERBOSE, "Read %d blocks at LBA:%" PRIu64
" and verify they are all 'B'",
i, num_blocks - i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = read16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -33,7 +33,7 @@ test_get_lba_status_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test GET_LBA_STATUS one block beyond the end of the LUN");
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks + 1, 24,
ret = get_lba_status(sd, NULL, num_blocks + 1, 24,
EXPECT_LBA_OOB);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support GET_LBA_STATUS. Skipping test");
@@ -43,13 +43,13 @@ test_get_lba_status_beyond_eol(void)
logging(LOG_VERBOSE, "Test GET_LBA_STATUS at LBA 2^63");
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0x8000000000000000ULL, 24,
ret = get_lba_status(sd, NULL, 0x8000000000000000ULL, 24,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test GET_LBA_STATUS at LBA -1");
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0xffffffffffffffffULL, 24,
ret = get_lba_status(sd, NULL, 0xffffffffffffffffULL, 24,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -33,7 +33,7 @@ test_get_lba_status_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test GET_LBA_STATUS of 1-256 blocks at the start of the LUN");
for (i = 1; i <= 256; i++) {
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 24,
ret = get_lba_status(sd, NULL,0, 24,
EXPECT_STATUS_GOOD);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support GET_LBA_STATUS. Skipping test");
@@ -48,7 +48,7 @@ test_get_lba_status_simple(void)
logging(LOG_VERBOSE, "Test GET_LBA_STATUS of 1-256 blocks at the end of the LUN");
for (i = 1; i <= 256; i++) {
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, 24,
ret = get_lba_status(sd, NULL, num_blocks - i, 24,
EXPECT_STATUS_GOOD);
if (ret != 0) {
CU_FAIL("[FAILED] GET_LBA_STATUS command failed");

View File

@@ -50,7 +50,7 @@ test_get_lba_status_unmap_single(void)
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
"pattern and thus map the blocks", 256 + lbppb);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, (256 + lbppb) * block_size,
ret = write10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -60,13 +60,13 @@ test_get_lba_status_unmap_single(void)
PRIu64 " (number of logical blocks: %d)", i, lbppb);
list[0].lba = i;
list[0].num = lbppb;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the status of the block at LBA:%"
PRIu64, i);
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, i, 24,
ret = get_lba_status(sd, NULL, i, 24,
EXPECT_STATUS_GOOD);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support GET_LBA_STATUS. Skipping test");
@@ -78,7 +78,7 @@ test_get_lba_status_unmap_single(void)
}
logging(LOG_VERBOSE, "Read the status of the block at LBA:%"
PRIu64, i + lbppb);
ret = get_lba_status(sd->iscsi_ctx, &t, sd->iscsi_lun, i + lbppb, 24,
ret = get_lba_status(sd, &t, i + lbppb, 24,
EXPECT_STATUS_GOOD);
if (ret != 0) {
CU_FAIL("[FAILED] GET_LBA_STATUS command failed");
@@ -116,20 +116,20 @@ test_get_lba_status_unmap_single(void)
for (i = lbppb; i + lbppb <= 256; i += lbppb) {
logging(LOG_VERBOSE, "Write the first %i blocks with a known "
"pattern and thus map the blocks", (256 + lbppb));
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, (256 + lbppb) * block_size,
ret = write10(sd, 0, (256 + lbppb) * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
logging(LOG_VERBOSE, "Unmap %" PRIu64 " blocks at LBA 0", i);
list[0].lba = 0;
list[0].num = i;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read the status of the block at LBA:0");
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 24,
ret = get_lba_status(sd, NULL, 0, 24,
EXPECT_STATUS_GOOD);
if (ret == -2) {
CU_PASS("[SKIPPED] Target does not support GET_LBA_STATUS. Skipping test");
@@ -140,7 +140,7 @@ test_get_lba_status_unmap_single(void)
return;
}
logging(LOG_VERBOSE, "Read the status of the block at LBA:%" PRIu64, i + 1);
ret = get_lba_status(sd->iscsi_ctx, &t, sd->iscsi_lun, i + 1, 24,
ret = get_lba_status(sd, &t, i + 1, 24,
EXPECT_STATUS_GOOD);
if (ret != 0) {
CU_FAIL("[FAILED] GET_LBA_STATUS command failed");

View File

@@ -40,7 +40,7 @@ test_inquiry_alloc_length(void)
scsi_free_scsi_task(task);
task = NULL;
}
ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 0, 0, i,
ret = inquiry(sd, &task, 0, 0, i,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -83,12 +83,12 @@ test_inquiry_alloc_length(void)
logging(LOG_VERBOSE, "Version is SPC-3 or later. Read INQUIRY data using 16-bit allocation length");
logging(LOG_VERBOSE, "Read INQUIRY data with allocation length 511 (low order byte is 0xff)");
ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 0, 0, 511,
ret = inquiry(sd, &task, 0, 0, 511,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read INQUIRY data with allocation length 512 (low order byte is 0x00)");
ret = inquiry(sd->iscsi_ctx, &task2, sd->iscsi_lun, 0, 0, 512,
ret = inquiry(sd, &task2, 0, 0, 512,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -39,7 +39,7 @@ test_inquiry_block_limits(void)
CHECK_FOR_SBC;
logging(LOG_VERBOSE, "Block device. Verify that we can read Block Limits VPD");
ret = inquiry(sd->iscsi_ctx, &bl_task, sd->iscsi_lun,
ret = inquiry(sd, &bl_task,
1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -107,7 +107,7 @@ test_inquiry_block_limits(void)
* MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT
*/
logging(LOG_VERBOSE, "Try reading the logical block provisioning VPD");
ret = inquiry(sd->iscsi_ctx, &lbp_task, sd->iscsi_lun,
ret = inquiry(sd, &lbp_task,
1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64,
EXPECT_STATUS_GOOD);
if (ret == 0) {

View File

@@ -33,7 +33,7 @@ test_inquiry_evpd(void)
logging(LOG_VERBOSE, "Test of the INQUIRY EVPD bit");
logging(LOG_VERBOSE, "Verify that INQUIRY with EVPD==0 and PC!=0 is an error");
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 1, 256,
ret = inquiry(sd, NULL, 0, 1, 256,
EXPECT_INVALID_FIELD_IN_CDB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -36,13 +36,13 @@ test_inquiry_mandatory_vpd_sbc(void)
logging(LOG_VERBOSE, "SUPPORTED_VPD_PAGES is mandatory for SBC devices. Verify we can read it.");
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun,
ret = inquiry(sd, NULL,
1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "DEVICE_IDENTIFICATION is mandatory for SBC devices. Verify we can read it.");
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun,
ret = inquiry(sd, NULL,
1, SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -35,7 +35,7 @@ test_inquiry_standard(void)
logging(LOG_VERBOSE, "Verify we can read standard INQUIRY page");
/* 260 bytes is the maximum possible size of the standard vpd */
ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 0, 0, 260,
ret = inquiry(sd, &task, 0, 0, 260,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -34,7 +34,7 @@ test_inquiry_supported_vpd(void)
logging(LOG_VERBOSE, "Test INQUIRY supported VPD pages");
logging(LOG_VERBOSE, "Verify we can read the SUPPORTED VPD page");
ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun,
ret = inquiry(sd, &task,
1, SCSI_INQUIRY_PAGECODE_SUPPORTED_VPD_PAGES, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -56,7 +56,7 @@ test_inquiry_supported_vpd(void)
logging(LOG_VERBOSE, "Verify we can read page 0x%02x",
sup_inq->pages[i]);
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 1, sup_inq->pages[i], 255,
ret = inquiry(sd, NULL, 1, sup_inq->pages[i], 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -64,7 +64,7 @@ void test_iscsi_cmdsn_toohigh(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, -1);
if (ret == -1) {
@@ -76,7 +76,7 @@ void test_iscsi_cmdsn_toohigh(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 0);
logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -64,7 +64,7 @@ void test_iscsi_cmdsn_toolow(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, -1);
if (ret == -1) {
@@ -77,7 +77,7 @@ void test_iscsi_cmdsn_toolow(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 0);
logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -75,7 +75,7 @@ void test_iscsi_datasn_invalid(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, 2 * block_size,
ret = write10(sd, 100, 2 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -98,7 +98,7 @@ void test_iscsi_datasn_invalid(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, block_size,
ret = write10(sd, 100, block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -121,7 +121,7 @@ void test_iscsi_datasn_invalid(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, block_size,
ret = write10(sd, 100, block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -145,7 +145,7 @@ void test_iscsi_datasn_invalid(void)
iscsi_set_noautoreconnect(sd->iscsi_ctx, 1);
iscsi_set_timeout(sd->iscsi_ctx, 3);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, 2 * block_size,
ret = write10(sd, 100, 2 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {

View File

@@ -37,38 +37,38 @@ test_mandatory_sbc(void)
CHECK_FOR_SBC;
logging(LOG_VERBOSE, "Test INQUIRY.");
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 0, 255,
ret = inquiry(sd, NULL, 0, 0, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READCAPACITY10.");
ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0,
ret = readcapacity10(sd, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (sbc3_support) {
logging(LOG_VERBOSE, "Test READCAPACITY16. The device claims SBC-3 support.");
ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 15,
ret = readcapacity16(sd, 15,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Test READ10.");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size,
ret = read10(sd, NULL, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
if (sbc3_support) {
logging(LOG_VERBOSE, "Test READ16. the device claims SBC-3 support.");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = read16(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Test TESTUNITREADY.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -43,17 +43,17 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Eject the medium.");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 1, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY when medium is ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected.");
ret = synchronizecache10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 1,
ret = synchronizecache10(sd, 0, 1, 1, 1,
EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
@@ -63,7 +63,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE16 when medium is ejected.");
ret = synchronizecache16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 1,
ret = synchronizecache16(sd, 0, 1, 1, 1,
EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
@@ -73,30 +73,30 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test READ10 when medium is ejected.");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size,
ret = read10(sd, NULL, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 when medium is ejected.");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = read12(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 when medium is ejected.");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = read16(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READCAPACITY10 when medium is ejected.");
ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0,
ret = readcapacity10(sd, 0, 0,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READCAPACITY16 when medium is ejected.");
ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 15,
ret = readcapacity16(sd, 15,
EXPECT_NO_MEDIUM);
if (ret == -2) {
if (sbc3_support) {
@@ -110,7 +110,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test GET_LBA_STATUS when medium is ejected.");
ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 24,
ret = get_lba_status(sd, NULL, 0, 24,
EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
@@ -120,7 +120,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test PREFETCH10 when medium is ejected.");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 0, EXPECT_NO_MEDIUM);
ret = prefetch10(sd, 0, 1, 1, 0, EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
@@ -130,7 +130,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test PREFETCH16 when medium is ejected.");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 0, EXPECT_NO_MEDIUM);
ret = prefetch16(sd, 0, 1, 1, 0, EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
"PREFETCH16");
@@ -139,7 +139,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test VERIFY10 when medium is ejected.");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = verify10(sd, 0, block_size, block_size,
0, 0, 1, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -150,7 +150,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test VERIFY12 when medium is ejected.");
ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = verify12(sd, 0, block_size, block_size,
0, 0, 1, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -161,7 +161,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test VERIFY16 when medium is ejected.");
ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = verify16(sd, 0, block_size, block_size,
0, 0, 1, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -177,25 +177,25 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test WRITE10 when medium is ejected.");
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write10(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITE12 when medium is ejected.");
ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write12(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITE16 when medium is ejected.");
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write16(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITEVERIFY10 when medium is ejected.");
ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = writeverify10(sd, 0, block_size, block_size,
0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -206,7 +206,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test WRITEVERIFY12 when medium is ejected.");
ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = writeverify12(sd, 0, block_size, block_size,
0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -217,7 +217,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test WRITEVERIFY16 when medium is ejected.");
ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = writeverify16(sd, 0, block_size, block_size,
0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -228,7 +228,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test ORWRITE when medium is ejected.");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = orwrite(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -242,7 +242,7 @@ test_nomedia_sbc(void)
logging(LOG_VERBOSE, "[SKIPPED] Test not implemented yet");
logging(LOG_VERBOSE, "Test WRITESAME10 when medium is ejected.");
ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = writesame10(sd, 0, block_size,
1, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -253,7 +253,7 @@ test_nomedia_sbc(void)
}
logging(LOG_VERBOSE, "Test WRITESAME16 when medium is ejected.");
ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = writesame16(sd, 0, block_size,
1, 0, 0, 0, 0, buf,
EXPECT_NO_MEDIUM);
if (ret == -2) {
@@ -266,7 +266,7 @@ test_nomedia_sbc(void)
logging(LOG_VERBOSE, "Test UNMAP when medium is ejected.");
list[0].lba = 0;
list[0].num = lbppb;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_NO_MEDIUM);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] target does not support "
@@ -278,7 +278,7 @@ test_nomedia_sbc(void)
finished:
logging(LOG_VERBOSE, "Load the medium again.");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 1, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -33,7 +33,7 @@ test_orwrite_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test ORWRITE 0-blocks at LBA==0");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
0, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -44,21 +44,21 @@ test_orwrite_0blocks(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE 0-blocks one block past end-of-LUN");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1,
ret = orwrite(sd, num_blocks + 1,
0, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE 0-blocks at LBA==2^63");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL,
ret = orwrite(sd, 0x8000000000000000ULL,
0, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE 0-blocks at LBA==-1");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, -1,
ret = orwrite(sd, -1,
0, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,7 +40,7 @@ test_orwrite_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i,
ret = orwrite(sd, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_LBA_OOB);
if (ret == -2) {
@@ -57,7 +57,7 @@ test_orwrite_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL,
ret = orwrite(sd, 0x8000000000000000ULL,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -69,7 +69,7 @@ test_orwrite_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, -1,
ret = orwrite(sd, -1,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -81,7 +81,7 @@ test_orwrite_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1,
ret = orwrite(sd, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -39,7 +39,7 @@ test_orwrite_flags(void)
logging(LOG_VERBOSE, "Test ORWRITE flags");
logging(LOG_VERBOSE, "Test ORWRITE with DPO==1");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 1, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -50,28 +50,28 @@ test_orwrite_flags(void)
logging(LOG_VERBOSE, "Test ORWRITE with FUA==1 FUA_NV==0");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 0, 1, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE with FUA==1 FUA_NV==1");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 0, 1, 1, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE with FUA==0 FUA_NV==1");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 0, 0, 1, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test ORWRITE with DPO==1 FUA==1 FUA_NV==1");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 1, 1, 1, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -42,7 +42,7 @@ test_orwrite_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = orwrite(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -58,7 +58,7 @@ test_orwrite_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = orwrite(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -47,14 +47,14 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
memset(buf, 0, block_size * i);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = write10(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
memset(buf, 0xa5, block_size * i);
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = orwrite(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -65,7 +65,7 @@ test_orwrite_verify(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -76,13 +76,13 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "OrWrite %d blocks with 0x5a", i);
memset(buf, 0x5a, block_size * i);
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = orwrite(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -101,20 +101,20 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "Write %d blocks of all-zero", i);
memset(buf, 0, block_size * i);
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = write16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "OrWrite %d blocks with 0xa5", i);
memset(buf, 0xa5, block_size * i);
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = orwrite(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = read16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -125,13 +125,13 @@ test_orwrite_verify(void)
logging(LOG_VERBOSE, "OrWrite %d blocks with 0x5a", i);
memset(buf, 0x5a, block_size * i);
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = orwrite(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read %d blocks back", i);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size,
ret = read16(sd, num_blocks - i, i * block_size,
block_size, 0, 0, 0, 0, 0, readbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -44,7 +44,7 @@ test_orwrite_wrprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = orwrite(sd, 0, block_size,
block_size, i, 0, 0, 0, 0, buf,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -30,7 +30,7 @@ test_prefetch10_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH10 0-blocks at LBA==0");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0,
ret = prefetch10(sd, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH10 is not implemented.");
@@ -45,19 +45,19 @@ test_prefetch10_0blocks(void)
}
logging(LOG_VERBOSE, "Test PREFETCH10 0-blocks one block past end-of-LUN");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, 0, 0,
ret = prefetch10(sd, num_blocks + 1, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH10 0-blocks at LBA==2^31");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, 0, 0,
ret = prefetch10(sd, 0x80000000, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH10 0-blocks at LBA==-1");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, 0, 0,
ret = prefetch10(sd, -1, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -37,7 +37,7 @@ test_prefetch10_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH10 1-256 blocks one block beyond the end");
for (i = 1; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i, 0, 0,
ret = prefetch10(sd, num_blocks + 1 - i, i, 0, 0,
EXPECT_LBA_OOB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH10 is not implemented.");
@@ -50,7 +50,7 @@ test_prefetch10_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH10 1-256 blocks at LBA==2^31");
for (i = 1; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i, 0, 0,
ret = prefetch10(sd, 0x80000000, i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -58,7 +58,7 @@ test_prefetch10_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH10 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, -1, i, 0, 0,
ret = prefetch10(sd, -1, i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -66,7 +66,7 @@ test_prefetch10_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH10 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i, 0, 0,
ret = prefetch10(sd, num_blocks - 1, i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -34,7 +34,7 @@ test_prefetch10_flags(void)
logging(LOG_VERBOSE, "Test PREFETCH10 flags");
logging(LOG_VERBOSE, "Test PREFETCH10 with IMMED==1");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 0,
ret = prefetch10(sd, 0, 1, 1, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH10 is not implemented.");
@@ -44,12 +44,12 @@ test_prefetch10_flags(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH10 with GROUP==3");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 0, 3,
ret = prefetch10(sd, 0, 1, 0, 3,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH10 with IMMED=1 and GROUP==3");
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 3,
ret = prefetch10(sd, 0, 1, 1, 3,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -33,7 +33,7 @@ test_prefetch10_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH10 of 1-256 blocks at the start of the LUN");
for (i = 1; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, i, 0, 0,
ret = prefetch10(sd, 0, i, 0, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH10 is not implemented.");
@@ -46,7 +46,7 @@ test_prefetch10_simple(void)
logging(LOG_VERBOSE, "Test PREFETCH10 of 1-256 blocks at the end of the LUN");
for (i = 1; i <= 256; i++) {
ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i, 0, 0,
ret = prefetch10(sd, num_blocks - i, i, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -30,7 +30,7 @@ test_prefetch16_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH16 0-blocks at LBA==0");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0,
ret = prefetch16(sd, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH16 is not implemented.");
@@ -40,19 +40,19 @@ test_prefetch16_0blocks(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH16 0-blocks one block past end-of-LUN");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, 0, 0,
ret = prefetch16(sd, num_blocks + 1, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH16 0-blocks at LBA==2^63");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0, 0, 0,
ret = prefetch16(sd, 0x8000000000000000ULL, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH16 0-blocks at LBA==-1");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, 0, 0,
ret = prefetch16(sd, -1, 0, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -32,7 +32,7 @@ test_prefetch16_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH16 1-256 blocks one block beyond the end");
for (i = 1; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i, 0, 0,
ret = prefetch16(sd, num_blocks + 1 - i, i, 0, 0,
EXPECT_LBA_OOB);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH16 is not implemented.");
@@ -45,7 +45,7 @@ test_prefetch16_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH16 1-256 blocks at LBA==2^63");
for (i = 1; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL,
ret = prefetch16(sd, 0x8000000000000000ULL,
i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -54,7 +54,7 @@ test_prefetch16_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH16 1-256 blocks at LBA==-1");
for (i = 1; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, -1, i, 0, 0,
ret = prefetch16(sd, -1, i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -62,7 +62,7 @@ test_prefetch16_beyond_eol(void)
logging(LOG_VERBOSE, "Test PREFETCH16 2-256 blocks all but one block beyond the end");
for (i = 2; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i, 0, 0,
ret = prefetch16(sd, num_blocks - 1, i, 0, 0,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -34,7 +34,7 @@ test_prefetch16_flags(void)
logging(LOG_VERBOSE, "Test PREFETCH16 flags");
logging(LOG_VERBOSE, "Test PREFETCH16 with IMMED==1");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 0,
ret = prefetch16(sd, 0, 1, 1, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH16 is not implemented.");
@@ -44,12 +44,12 @@ test_prefetch16_flags(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH16 with GROUP==3");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 0, 3,
ret = prefetch16(sd, 0, 1, 0, 3,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test PREFETCH16 with IMMED=1 and GROUP==3");
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 3,
ret = prefetch16(sd, 0, 1, 1, 3,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -33,7 +33,7 @@ test_prefetch16_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test PREFETCH16 of 1-256 blocks at the start of the LUN");
for (i = 1; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, i, 0, 0,
ret = prefetch16(sd, 0, i, 0, 0,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PREFETCH16 is not implemented.");
@@ -46,7 +46,7 @@ test_prefetch16_simple(void)
logging(LOG_VERBOSE, "Test PREFETCH16 of 1-256 blocks at the end of the LUN");
for (i = 1; i <= 256; i++) {
ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i, 0, 0,
ret = prefetch16(sd, num_blocks - i, i, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -28,6 +28,7 @@ void
test_preventallow_2_itnexuses(void)
{
int ret;
struct scsi_device sd2;
CHECK_FOR_SBC;
CHECK_FOR_REMOVABLE;
@@ -36,45 +37,45 @@ test_preventallow_2_itnexuses(void)
logging(LOG_VERBOSE, "Test that PREVENT MEDIUM REMOVAL are seen on other nexuses as well");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "Try to eject the medium on the second connection");
ret = startstopunit(iscsic2, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(&sd2, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Logout the second connection from target");
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,16 +36,16 @@ test_preventallow_cold_reset(void)
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -53,33 +53,33 @@ test_preventallow_cold_reset(void)
logging(LOG_VERBOSE, "Perform cold reset on target");
ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx);
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0);
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,48 +36,48 @@ test_preventallow_eject(void)
logging(LOG_VERBOSE, "Test that we can not eject medium when PREVENT is active");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium again");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,16 +36,16 @@ test_preventallow_itnexus_loss(void)
logging(LOG_VERBOSE, "Test that IT-Nexus loss clears PREVENT MEDIUM REMOVAL");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -61,28 +61,28 @@ test_preventallow_itnexus_loss(void)
}
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,16 +36,16 @@ test_preventallow_logout(void)
logging(LOG_VERBOSE, "Test that Logout loss clears PREVENT MEDIUM REMOVAL");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -62,28 +62,28 @@ test_preventallow_logout(void)
}
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,16 +36,16 @@ test_preventallow_lun_reset(void)
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -54,32 +54,32 @@ test_preventallow_lun_reset(void)
ret = iscsi_task_mgmt_lun_reset_sync(sd->iscsi_ctx, sd->iscsi_lun);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0);
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -36,10 +36,10 @@ test_preventallow_simple(void)
logging(LOG_VERBOSE, "Test PREVENTALLOW basics");
logging(LOG_VERBOSE, "Test we can set PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -36,16 +36,16 @@ test_preventallow_warm_reset(void)
logging(LOG_VERBOSE, "Test that Target Warm Reset clears PREVENT MEDIUM REMOVAL");
logging(LOG_VERBOSE, "Set the PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1);
ret = preventallow(sd, 1);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_REMOVAL_PREVENTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can still access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -54,32 +54,32 @@ test_preventallow_warm_reset(void)
ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Wait until all unit attentions clear");
while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0);
while (testunitready(sd, EXPECT_STATUS_GOOD) != 0);
logging(LOG_VERBOSE, "Try to eject the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can not access the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 0,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed");
logging(LOG_VERBOSE, "Test we can clear PREVENT flag");
ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0);
ret = preventallow(sd, 0);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Load the medium");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1,
ret = startstopunit(sd, 0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,7 +36,7 @@ test_prin_read_keys_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test Persistent Reserve IN READ_KEYS works.");
ret = prin_read_keys(sd->iscsi_ctx, sd->iscsi_lun, &task, NULL);
ret = prin_read_keys(sd, &task, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE IN is not implemented.");
CU_PASS("PERSISTENT RESERVE IN is not implemented.");

View File

@@ -37,7 +37,7 @@ test_prin_serviceaction_range(void)
logging(LOG_VERBOSE, "Test Persistent Reserve IN Serviceaction range.");
/* verify PRIN/READ_KEYS works -- XXX redundant -- remove this? */
ret = prin_read_keys(sd->iscsi_ctx, sd->iscsi_lun, &task, NULL);
ret = prin_read_keys(sd, &task, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE IN is not implemented.");
CU_PASS("PERSISTENT RESERVE IN is not implemented.");
@@ -47,13 +47,13 @@ test_prin_serviceaction_range(void)
/* verify that PRIN/SA={0,1,2,3} works ... */
for (i = 0; i < 4; i++) {
ret = prin_task(sd->iscsi_ctx, sd->iscsi_lun, i, 1);
ret = prin_task(sd, i, 1);
CU_ASSERT_EQUAL(ret, 0);
}
/* verify that PRIN/SA={4..0x20} fails ... */
for (i = 4; i < 0x20; i++) {
ret = prin_task(sd->iscsi_ctx, sd->iscsi_lun, i, 0);
ret = prin_task(sd, i, 0);
CU_ASSERT_EQUAL(ret, 0);
}
}

View File

@@ -37,7 +37,7 @@ test_prout_register_simple(void)
logging(LOG_VERBOSE, "Test Persistent Reserve IN REGISTER works.");
/* register our reservation key with the target */
ret = prout_register_and_ignore(sd->iscsi_ctx, sd->iscsi_lun, key);
ret = prout_register_and_ignore(sd, key);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE OUT is not implemented.");
CU_PASS("PERSISTENT RESERVE OUT is not implemented.");
@@ -46,18 +46,18 @@ test_prout_register_simple(void)
CU_ASSERT_EQUAL(ret, 0);
/* verify we can read the registration */
ret = prin_verify_key_presence(sd->iscsi_ctx, sd->iscsi_lun, key, 1);
ret = prin_verify_key_presence(sd, key, 1);
CU_ASSERT_EQUAL(ret, 0);
/* try to reregister, which should fail */
ret = prout_reregister_key_fails(sd->iscsi_ctx, sd->iscsi_lun, key+1);
ret = prout_reregister_key_fails(sd, key+1);
CU_ASSERT_EQUAL(ret, 0);
/* release from the target */
ret = prout_register_key(sd->iscsi_ctx, sd->iscsi_lun, 0, key);
ret = prout_register_key(sd, 0, key);
CU_ASSERT_EQUAL(ret, 0);
/* Verify the registration is gone */
ret = prin_verify_key_presence(sd->iscsi_ctx, sd->iscsi_lun, key, 0);
ret = prin_verify_key_presence(sd, key, 0);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -25,8 +25,7 @@
static void
verify_persistent_reserve_access(struct iscsi_context *iscsi1, int lun1,
struct iscsi_context *iscsi2, int lun2,
verify_persistent_reserve_access(struct scsi_device *sd1, struct scsi_device *sd2,
const enum scsi_persistent_out_type pr_type,
int reg_i2_can_read,
int reg_i2_can_write,
@@ -44,26 +43,26 @@ verify_persistent_reserve_access(struct iscsi_context *iscsi1, int lun1,
scsi_pr_type_str(pr_type));
/* send TURs to clear possible check conditions */
(void) testunitready_clear_ua(iscsi1, lun1);
(void) testunitready_clear_ua(iscsi2, lun2);
(void) testunitready_clear_ua(sd1);
(void) testunitready_clear_ua(sd2);
/* register our reservation key with the target */
ret = prout_register_and_ignore(iscsi1, lun1, key);
ret = prout_register_and_ignore(sd1, key);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE OUT is not implemented.");
CU_PASS("PERSISTENT RESERVE OUT is not implemented.");
return;
}
CU_ASSERT_EQUAL(0, ret);
ret = prout_register_and_ignore(iscsi2, lun2, key2);
ret = prout_register_and_ignore(sd2, key2);
CU_ASSERT_EQUAL(0, ret);
/* reserve the target through initiator 1 */
ret = prout_reserve(iscsi1, lun1, key, pr_type);
ret = prout_reserve(sd1, key, pr_type);
CU_ASSERT_EQUAL(0, ret);
/* verify target reservation */
ret = prin_verify_reserved_as(iscsi1, lun1,
ret = prin_verify_reserved_as(sd1,
pr_type_is_all_registrants(pr_type) ? 0 : key,
pr_type);
CU_ASSERT_EQUAL(0, ret);
@@ -72,58 +71,62 @@ verify_persistent_reserve_access(struct iscsi_context *iscsi1, int lun1,
CU_ASSERT_PTR_NOT_NULL(read_write_buf);
/* make sure init1 can read */
ret = verify_read_works(iscsi1, lun1, read_write_buf);
ret = verify_read_works(sd1, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* make sure init1 can write */
ret = verify_write_works(iscsi1, lun1, read_write_buf);
ret = verify_write_works(sd1, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* verify registered init2 read access */
if (reg_i2_can_read)
ret = verify_read_works(iscsi2, lun2, read_write_buf);
ret = verify_read_works(sd2, read_write_buf);
else
ret = verify_read_fails(iscsi2, lun2, read_write_buf);
ret = verify_read_fails(sd2, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* verify registered init2 write access */
if (reg_i2_can_write)
ret = verify_write_works(iscsi2, lun2, read_write_buf);
ret = verify_write_works(sd2, read_write_buf);
else
ret = verify_write_fails(iscsi2, lun2, read_write_buf);
ret = verify_write_fails(sd2, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* unregister init2 */
ret = prout_register_key(iscsi2, lun2, 0, key);
ret = prout_register_key(sd2, 0, key);
CU_ASSERT_EQUAL(0, ret);
/* verify unregistered init2 read access */
if (unreg_i2_can_read)
ret = verify_read_works(iscsi2, lun2, read_write_buf);
ret = verify_read_works(sd2, read_write_buf);
else
ret = verify_read_fails(iscsi2, lun2, read_write_buf);
ret = verify_read_fails(sd2, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* verify unregistered init2 write access */
if (unreg_i2_can_write)
ret = verify_write_works(iscsi2, lun2, read_write_buf);
ret = verify_write_works(sd2, read_write_buf);
else
ret = verify_write_fails(iscsi2, lun2, read_write_buf);
ret = verify_write_fails(sd2, read_write_buf);
CU_ASSERT_EQUAL(0, ret);
/* release our reservation */
ret = prout_release(iscsi1, lun1, key, pr_type);
ret = prout_release(sd1, key, pr_type);
CU_ASSERT_EQUAL(0, ret);
/* remove our key from the target */
ret = prout_register_key(iscsi1, lun1, 0, key);
ret = prout_register_key(sd1, 0, key);
CU_ASSERT_EQUAL(0, ret);
}
void
test_prout_reserve_access_ea(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS,
0, 0, 0, 0);
}
@@ -131,7 +134,11 @@ test_prout_reserve_access_ea(void)
void
test_prout_reserve_access_we(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE,
1, 0, 1, 0);
}
@@ -139,7 +146,11 @@ test_prout_reserve_access_we(void)
void
test_prout_reserve_access_earo(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_REGISTRANTS_ONLY,
1, 1, 0, 0);
}
@@ -147,7 +158,11 @@ test_prout_reserve_access_earo(void)
void
test_prout_reserve_access_wero(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_REGISTRANTS_ONLY,
1, 1, 1, 0);
}
@@ -155,7 +170,11 @@ test_prout_reserve_access_wero(void)
void
test_prout_reserve_access_eaar(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_ALL_REGISTRANTS,
1, 1, 0, 0);
}
@@ -163,7 +182,11 @@ test_prout_reserve_access_eaar(void)
void
test_prout_reserve_access_wear(void)
{
verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_access(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_ALL_REGISTRANTS,
1, 1, 1, 0);
}

View File

@@ -25,8 +25,7 @@
static void
verify_persistent_reserve_ownership(struct iscsi_context *iscsi1, int lun1,
struct iscsi_context *iscsi2, int lun2,
verify_persistent_reserve_ownership(struct scsi_device *sd1, struct scsi_device *sd2,
const enum scsi_persistent_out_type pr_type,
int resvn_is_shared)
{
@@ -41,97 +40,121 @@ verify_persistent_reserve_ownership(struct iscsi_context *iscsi1, int lun1,
scsi_pr_type_str(pr_type));
/* send TURs to clear possible check conditions */
(void) testunitready_clear_ua(iscsi1, lun1);
(void) testunitready_clear_ua(iscsi2, lun2);
(void) testunitready_clear_ua(sd1);
(void) testunitready_clear_ua(sd2);
/* register our reservation key with the target */
ret = prout_register_and_ignore(iscsi1, lun1, key1);
ret = prout_register_and_ignore(sd1, key1);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE OUT is not implemented.");
CU_PASS("PERSISTENT RESERVE OUT is not implemented.");
return;
}
CU_ASSERT_EQUAL(0, ret);
ret = prout_register_and_ignore(iscsi2, lun2, key2);
ret = prout_register_and_ignore(sd2, key2);
CU_ASSERT_EQUAL(0, ret);
/* reserve the target through initiator 1 */
ret = prout_reserve(iscsi1, lun1, key1, pr_type);
ret = prout_reserve(sd1, key1, pr_type);
CU_ASSERT_EQUAL(0, ret);
/* verify target reservation */
ret = prin_verify_reserved_as(iscsi1, lun1,
ret = prin_verify_reserved_as(sd1,
pr_type_is_all_registrants(pr_type) ? 0 : key1,
pr_type);
CU_ASSERT_EQUAL(0, ret);
/* unregister init1 */
ret = prout_register_key(iscsi1, lun1, 0, key1);
ret = prout_register_key(sd1, 0, key1);
CU_ASSERT_EQUAL(0, ret);
/* verify if reservation is still present */
if (resvn_is_shared) {
/* verify target reservation */
ret = prin_verify_reserved_as(iscsi1, lun1,
ret = prin_verify_reserved_as(sd1,
pr_type_is_all_registrants(pr_type) ? 0 : key1,
pr_type);
CU_ASSERT_EQUAL(0, ret);
/* release our reservation */
ret = prout_release(iscsi2, lun2, key2, pr_type);
ret = prout_release(sd2, key2, pr_type);
CU_ASSERT_EQUAL(0, ret);
} else {
/* verify target is not reserved now */
ret = prin_verify_not_reserved(iscsi1, lun1);
ret = prin_verify_not_reserved(sd1);
CU_ASSERT_EQUAL(0, ret);
/* send TUR to clear possible check condition */
(void) testunitready_clear_ua(iscsi2, lun2);
(void) testunitready_clear_ua(sd2);
}
/* remove our remaining key from the target */
ret = prout_register_key(iscsi2, lun2, 0, key2);
ret = prout_register_key(sd2, 0, key2);
CU_ASSERT_EQUAL(0, ret);
}
void
test_prout_reserve_ownership_ea(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS, 0);
}
void
test_prout_reserve_ownership_we(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE, 0);
}
void
test_prout_reserve_ownership_earo(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_REGISTRANTS_ONLY, 0);
}
void
test_prout_reserve_ownership_wero(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_REGISTRANTS_ONLY, 0);
}
void
test_prout_reserve_ownership_eaar(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_ALL_REGISTRANTS, 1);
}
void
test_prout_reserve_ownership_wear(void)
{
verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2,
struct scsi_device sd2;
sd2.iscsi_ctx = iscsic2;
sd2.iscsi_lun = tgt_lun2;
verify_persistent_reserve_ownership(sd, &sd2,
SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_ALL_REGISTRANTS, 1);
}

View File

@@ -52,7 +52,7 @@ test_prout_reserve_simple(void)
logging(LOG_VERBOSE, "Test Persistent Reserve IN RESERVE works.");
/* register our reservation key with the target */
ret = prout_register_and_ignore(sd->iscsi_ctx, sd->iscsi_lun, key);
ret = prout_register_and_ignore(sd, key);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE OUT is not implemented.");
CU_PASS("PERSISTENT RESERVE OUT is not implemented.");
@@ -65,22 +65,22 @@ test_prout_reserve_simple(void)
enum scsi_persistent_out_type pr_type = pr_types_to_test[i];
/* reserve the target */
ret = prout_reserve(sd->iscsi_ctx, sd->iscsi_lun, key, pr_type);
ret = prout_reserve(sd, key, pr_type);
CU_ASSERT_EQUAL(ret, 0);
/* verify target reservation */
ret = prin_verify_reserved_as(sd->iscsi_ctx, sd->iscsi_lun,
ret = prin_verify_reserved_as(sd,
pr_type_is_all_registrants(pr_type) ? 0 : key,
pr_type);
CU_ASSERT_EQUAL(ret, 0);
/* release our reservation */
ret = prout_release(sd->iscsi_ctx, sd->iscsi_lun, key, pr_type);
ret = prout_release(sd, key, pr_type);
CU_ASSERT_EQUAL(ret, 0);
}
/* remove our key from the target */
ret = prout_register_key(sd->iscsi_ctx, sd->iscsi_lun, 0, key);
ret = prout_register_key(sd, 0, key);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -30,7 +30,7 @@ test_read10_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==0");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 0, block_size,
ret = read10(sd, NULL, 0, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -41,21 +41,21 @@ test_read10_0blocks(void)
}
logging(LOG_VERBOSE, "Test READ10 0-blocks one block past end-of-LUN");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks + 1, 0,
ret = read10(sd, NULL, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==2^31");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0x80000000, 0, block_size,
ret = read10(sd, NULL, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 0-blocks at LBA==-1");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, -1, 0, block_size,
ret = read10(sd, NULL, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,7 +40,7 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL,sd->iscsi_lun, num_blocks + 1 - i,
ret = read10(sd, NULL, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -52,7 +52,7 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0x80000000,
ret = read10(sd, NULL, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -64,7 +64,7 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, -1, i * block_size,
ret = read10(sd, NULL, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -76,7 +76,7 @@ test_read10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - 1,
ret = read10(sd, NULL, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,35 +36,35 @@ test_read10_flags(void)
CHECK_FOR_SBC;
logging(LOG_VERBOSE, "Test READ10 with DPO==1");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==1 FUA_NV==0");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==1 FUA_NV==1");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with FUA==0 FUA_NV==1");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ10 with DPO==1 FUA==1 FUA_NV==1");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -42,7 +42,7 @@ test_read10_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0,
ret = read10(sd, NULL, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -37,7 +37,7 @@ test_read10_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL,sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -49,7 +49,7 @@ test_read10_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i,
ret = read10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -30,7 +30,7 @@ test_read12_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==0");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size,
ret = read12(sd, 0, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -46,21 +46,21 @@ test_read12_0blocks(void)
}
logging(LOG_VERBOSE, "Test READ12 0-blocks one block past end-of-LUN");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0,
ret = read12(sd, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==2^31");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size,
ret = read12(sd, 0x80000000, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 0-blocks at LBA==-1");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size,
ret = read12(sd, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,7 +40,7 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i,
ret = read12(sd, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
if (ret == -2) {
@@ -57,7 +57,7 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000,
ret = read12(sd, 0x80000000,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -69,7 +69,7 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size,
ret = read12(sd, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -81,7 +81,7 @@ test_read12_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1,
ret = read12(sd, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,7 +36,7 @@ test_read12_flags(void)
CHECK_FOR_SBC;
logging(LOG_VERBOSE, "Test READ12 with DPO==1");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -48,28 +48,28 @@ test_read12_flags(void)
logging(LOG_VERBOSE, "Test READ12 with FUA==1 FUA_NV==0");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with FUA==1 FUA_NV==1");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with FUA==0 FUA_NV==1");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ12 with DPO==1 FUA==1 FUA_NV==1");
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -41,7 +41,7 @@ test_read12_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read12(sd, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -37,7 +37,7 @@ test_read12_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = read12(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -54,7 +54,7 @@ test_read12_simple(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = read12(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -32,7 +32,7 @@ test_read16_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==0");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size,
ret = read16(sd, 0, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -43,21 +43,21 @@ test_read16_0blocks(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks one block past end-of-LUN");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0,
ret = read16(sd, num_blocks + 1, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==2^63");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0,
ret = read16(sd, 0x8000000000000000ULL, 0,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 0-blocks at LBA==-1");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size,
ret = read16(sd, -1, 0, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -49,7 +49,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i,
ret = read16(sd, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
if (ret == -2) {
@@ -67,7 +67,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL,
ret = read16(sd, 0x8000000000000000ULL,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -81,7 +81,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun,
ret = read16(sd,
1ULL << (64 - ilog2(block_size)),
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
@@ -96,7 +96,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun,
ret = read16(sd,
1ULL << (63 - ilog2(block_size)),
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
@@ -110,7 +110,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size,
ret = read16(sd, -1, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -123,7 +123,7 @@ test_read16_beyond_eol(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1,
ret = read16(sd, num_blocks - 1,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -36,7 +36,7 @@ test_read16_flags(void)
logging(LOG_VERBOSE, "Test READ16 flags");
logging(LOG_VERBOSE, "Test READ16 with DPO==1");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size, 0, 1, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -48,28 +48,28 @@ test_read16_flags(void)
logging(LOG_VERBOSE, "Test READ16 with FUA==1 FUA_NV==0");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size, 0, 0, 1, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with FUA==1 FUA_NV==1");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size, 0, 0, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with FUA==0 FUA_NV==1");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size, 0, 0, 0, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test READ16 with DPO==1 FUA==1 FUA_NV==1");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size, 0, 1, 1, 1, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -41,7 +41,7 @@ test_read16_rdprotect(void)
if (!inq->protect || (rc16 != NULL && !rc16->prot_en)) {
logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail.");
for (i = 1; i < 8; i++) {
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = read16(sd, 0,
block_size, block_size,
i, 0, 0, 0, 0, NULL,
EXPECT_INVALID_FIELD_IN_CDB);

View File

@@ -39,7 +39,7 @@ test_read16_simple(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = read16(sd, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -57,7 +57,7 @@ test_read16_simple(void)
break;
}
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = read16(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -38,7 +38,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ6 1-255 blocks one block beyond the end");
for (i = 1; i <= 255; i++) {
ret = read6(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i,
ret = read6(sd, num_blocks + 1 - i,
i * block_size, block_size, NULL,
EXPECT_LBA_OOB);
if (ret == -2) {
@@ -52,7 +52,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, "Test READ6 1-255 blocks at LBA==0x1fffff");
for (i = 1; i <= 255; i++) {
ret = read6(sd->iscsi_ctx, sd->iscsi_lun, 0x1fffff,
ret = read6(sd, 0x1fffff,
i * block_size, block_size, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -61,7 +61,7 @@ test_read6_beyond_eol(void)
logging(LOG_VERBOSE, "Test READ6 2-255 blocks all but one block beyond the end");
for (i = 2; i <= 255; i++) {
ret = read6(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1,
ret = read6(sd, num_blocks - 1,
i * block_size, block_size, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -34,7 +34,7 @@ test_read6_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test READ6 of 1-255 blocks at the start of the LUN");
for (i = 1; i <= 255; i++) {
ret = read6(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = read6(sd, 0, i * block_size,
block_size, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -51,7 +51,7 @@ test_read6_simple(void)
CU_PASS("LUN is too big for read-at-eol tests with READ6. Skipping test.\n");
} else {
for (i = 1; i <= 255; i++) {
ret = read6(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = read6(sd, num_blocks - i,
i * block_size, block_size, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -34,7 +34,7 @@ test_readcapacity10_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test basic READCAPACITY10");
ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0,
ret = readcapacity10(sd, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -35,7 +35,7 @@ test_readcapacity16_alloclen(void)
logging(LOG_VERBOSE, "Test that READCAPACITY16 with alloc_len 0-15 is not an error");
for (i = 0; i < 16; i++) {
ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, i,
ret = readcapacity16(sd, i,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim SBC-3 support.");

View File

@@ -34,7 +34,7 @@ test_readcapacity16_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that READCAPACITY16 works");
ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 16,
ret = readcapacity16(sd, 16,
EXPECT_STATUS_GOOD);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim support.");

View File

@@ -41,25 +41,25 @@ test_readonly_sbc(void)
logging(LOG_VERBOSE, "Test WRITE10 fails with WRITE_PROTECTED");
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write10(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITE12 fails with WRITE_PROTECTED");
ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write12(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITE16 fails with WRITE_PROTECTED");
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size,
ret = write16(sd, 0, block_size, block_size,
0, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test WRITE_SAME10 fails with WRITE_PROTECTED");
ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1,
ret = writesame10(sd, 0, block_size, 1,
0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -68,7 +68,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITE_SAME16 fails with WRITE_PROTECTED");
ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1,
ret = writesame16(sd, 0, block_size, 1,
0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -77,7 +77,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITE_SAME10 UNMAP fails with WRITE_PROTECTED");
ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = writesame10(sd, 0,
block_size, 1, 0, 1, 0, 0, NULL,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -86,7 +86,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITE_SAME16 UNMAP fails with WRITE_PROTECTED");
ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = writesame16(sd, 0,
block_size, 1, 0, 1, 0, 0, NULL,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -97,7 +97,7 @@ test_readonly_sbc(void)
logging(LOG_VERBOSE, "Test UNMAP of one physical block fails with WRITE_PROTECTED");
list[0].lba = 0;
list[0].num = lbppb;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
logging(LOG_VERBOSE, "UNMAP not supported on target. Skipped.");
@@ -107,7 +107,7 @@ test_readonly_sbc(void)
logging(LOG_VERBOSE, "Test UNMAP of one logical block fails with WRITE_PROTECTED");
list[0].lba = 0;
list[0].num = 1;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
logging(LOG_VERBOSE, "UNMAP not supported on target. Skipped.");
@@ -115,7 +115,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITEVERIFY10 fails with WRITE_PROTECTED");
ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = writeverify10(sd, 0,
block_size, block_size, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -124,7 +124,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITEVERIFY12 fails with WRITE_PROTECTED");
ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = writeverify12(sd, 0,
block_size, block_size, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -133,7 +133,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test WRITEVERIFY16 fails with WRITE_PROTECTED");
ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = writeverify16(sd, 0,
block_size, block_size, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {
@@ -142,7 +142,7 @@ test_readonly_sbc(void)
CU_ASSERT_NOT_EQUAL(ret, -1);
logging(LOG_VERBOSE, "Test ORWRITE fails with WRITE_PROTECTED");
ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0,
ret = orwrite(sd, 0,
block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_WRITE_PROTECTED);
if (ret == -2) {

View File

@@ -39,7 +39,7 @@ test_report_supported_opcodes_one_command(void)
logging(LOG_VERBOSE, "Fetch list of all supported opcodes");
ret = report_supported_opcodes(sd->iscsi_ctx, &rso_task, sd->iscsi_lun,
ret = report_supported_opcodes(sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPS_ALL,
0, 0, 65535,
EXPECT_STATUS_GOOD);
@@ -68,7 +68,7 @@ test_report_supported_opcodes_one_command(void)
if (rsoc->descriptors[i].servactv) {
logging(LOG_VERBOSE, "This opcode has service actions. "
"Reporting Options 001b should fail");
ret = report_supported_opcodes(sd->iscsi_ctx, NULL, sd->iscsi_lun,
ret = report_supported_opcodes(sd, NULL,
0, SCSI_REPORT_SUPPORTING_OPCODE,
rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa,
@@ -79,7 +79,7 @@ test_report_supported_opcodes_one_command(void)
"service actions. Reporting Options 001b "
"should work");
ret = report_supported_opcodes(
sd->iscsi_ctx, NULL, sd->iscsi_lun,
sd, NULL,
0, SCSI_REPORT_SUPPORTING_OPCODE,
rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa,
@@ -92,7 +92,7 @@ test_report_supported_opcodes_one_command(void)
logging(LOG_VERBOSE, "This opcode has service actions. "
"Reporting Options 002b should work");
ret = report_supported_opcodes(
sd->iscsi_ctx, NULL, sd->iscsi_lun,
sd, NULL,
0, SCSI_REPORT_SUPPORTING_SERVICEACTION,
rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa,
@@ -103,7 +103,7 @@ test_report_supported_opcodes_one_command(void)
"service actions. Reporting Options 002b "
"should fail");
ret = report_supported_opcodes(
sd->iscsi_ctx, NULL, sd->iscsi_lun,
sd, NULL,
0, SCSI_REPORT_SUPPORTING_SERVICEACTION,
rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa,
@@ -121,8 +121,7 @@ test_report_supported_opcodes_one_command(void)
rsoc->descriptors[i].opcode,
rsoc->descriptors[i].sa);
ret = report_supported_opcodes(
sd->iscsi_ctx, &one_task, sd->iscsi_lun,
0,
sd, &one_task, 0,
rsoc->descriptors[i].servactv ?
SCSI_REPORT_SUPPORTING_SERVICEACTION :
SCSI_REPORT_SUPPORTING_OPCODE,

View File

@@ -39,7 +39,7 @@ test_report_supported_opcodes_rctd(void)
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
"without timeout descriptors");
ret = report_supported_opcodes(
sd->iscsi_ctx, &rso_task, sd->iscsi_lun,
sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
65535,
EXPECT_STATUS_GOOD);
@@ -76,7 +76,7 @@ test_report_supported_opcodes_rctd(void)
logging(LOG_VERBOSE, "Test READ_SUPPORTED_OPCODES report ALL opcodes "
"with timeout descriptors");
ret = report_supported_opcodes(
sd->iscsi_ctx, &rso_task, sd->iscsi_lun,
sd, &rso_task,
1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
65535,
EXPECT_STATUS_GOOD);

View File

@@ -37,7 +37,7 @@ test_report_supported_opcodes_servactv(void)
ret = report_supported_opcodes(
sd->iscsi_ctx, &rso_task, sd->iscsi_lun,
sd, &rso_task,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
65535,
EXPECT_STATUS_GOOD);

View File

@@ -34,7 +34,7 @@ test_report_supported_opcodes_simple(void)
logging(LOG_VERBOSE, "Test basic READ_SUPPORTED_OPCODES");
ret = report_supported_opcodes(
sd->iscsi_ctx, NULL, sd->iscsi_lun,
sd, NULL,
0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0,
1024,
EXPECT_STATUS_GOOD);

View File

@@ -29,14 +29,14 @@ void
test_reserve6_2initiators(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test RESERVE6/RELEASE6 across two initiators");
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -46,53 +46,53 @@ test_reserve6_2initiators(void)
logging(LOG_NORMAL, "Verify that the first initiator can re-RESERVE6 the same reservation");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_NORMAL, "Try to take out a RESERVE6 from the second initiator");
ret = reserve6_conflict(iscsic2, sd->iscsi_lun);
ret = reserve6_conflict(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "Try to RELEASE from the second initiator. Should be a nop");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "Test we can still send MODE SENSE from the first initiator");
ret = mode_sense(sd->iscsi_ctx, sd->iscsi_lun);
ret = mode_sense(sd);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "MODE SENSE should fail from the second initiator");
ret = mode_sense(iscsic2, sd->iscsi_lun);
ret = mode_sense(&sd2);
CU_ASSERT_EQUAL(ret, SCSI_STATUS_RESERVATION_CONFLICT);
logging(LOG_NORMAL, "RESERVE6 from the second initiator should still fail");
ret = reserve6_conflict(iscsic2, sd->iscsi_lun);
ret = reserve6_conflict(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "RELEASE6 from the first initiator");
ret = release6(sd->iscsi_ctx, sd->iscsi_lun);
ret = release6(sd);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
iscsic2 = NULL;
}

View File

@@ -29,14 +29,14 @@ void
test_reserve6_itnexus_loss(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on it-nexus loss");
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -46,14 +46,14 @@ test_reserve6_itnexus_loss(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_NORMAL, "Try to take out a RESERVE6 from the second initiator");
ret = reserve6_conflict(iscsic2, sd->iscsi_lun);
ret = reserve6_conflict(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Disconnect from the target.");
@@ -70,15 +70,15 @@ test_reserve6_itnexus_loss(void)
}
logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
finished:
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
iscsic2 = NULL;
}

View File

@@ -29,14 +29,14 @@ void
test_reserve6_logout(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on logout");
logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -46,14 +46,14 @@ test_reserve6_logout(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_NORMAL, "Try to take out a RESERVE6 from the second initiator");
ret = reserve6_conflict(iscsic2, sd->iscsi_lun);
ret = reserve6_conflict(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Logout from target");
@@ -68,14 +68,13 @@ test_reserve6_logout(void)
}
logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_NORMAL, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -29,14 +29,14 @@ void
test_reserve6_lun_reset(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on lun reset");
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -57,21 +57,20 @@ test_reserve6_lun_reset(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -34,7 +34,7 @@ test_reserve6_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test basic RESERVE6/RELEASE6 commands if supported");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -42,6 +42,6 @@ test_reserve6_simple(void)
}
CU_ASSERT_EQUAL(ret, 0);
ret = release6(sd->iscsi_ctx, sd->iscsi_lun);
ret = release6(sd);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -29,14 +29,14 @@ void
test_reserve6_target_cold_reset(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on target cold reset");
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -56,21 +56,20 @@ test_reserve6_target_cold_reset(void)
sleep(3);
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -29,14 +29,14 @@ void
test_reserve6_target_warm_reset(void)
{
int ret;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test that RESERVE6 is released on target warm reset");
logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator");
ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun);
ret = reserve6(sd);
if (ret == -2) {
logging(LOG_VERBOSE, "[SKIPPED] Target does not support RESERVE6. Skipping test");
CU_PASS("[SKIPPED] Target does not support RESERVE6. Skipping test");
@@ -57,22 +57,21 @@ test_reserve6_target_warm_reset(void)
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "RELEASE6 from the second initiator");
ret = release6(iscsic2, sd->iscsi_lun);
ret = release6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
iscsi_logout_sync(iscsic2);
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_logout_sync(sd2.iscsi_ctx);
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -33,7 +33,7 @@ check_wabereq(void)
struct scsi_task *task_ret = NULL;
logging(LOG_VERBOSE, "Read one block from LBA 0");
read10(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 0, block_size, block_size,
read10(sd, &task_ret, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL(task_ret);
@@ -109,7 +109,7 @@ check_unmap(void)
uint64_t lba;
logging(LOG_VERBOSE, "Read LBA mapping from the target");
get_lba_status(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 0, 256,
get_lba_status(sd, &task_ret, 0, 256,
EXPECT_STATUS_GOOD);
if (task_ret == NULL) {
logging(LOG_VERBOSE, "[FAILED] Failed to read LBA mapping "
@@ -197,7 +197,7 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
int ret;
memset(buf, 'a', 256 * block_size);
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = write16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -209,7 +209,7 @@ check_lun_is_wiped(unsigned char *buf, uint64_t lba)
int ret;
unsigned char *rbuf = alloca(256 * block_size);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = read16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -325,7 +325,7 @@ test_sanitize_block_erase(void)
logging(LOG_VERBOSE, "Test we can perform basic BLOCK ERASE SANITIZE");
ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
@@ -341,7 +341,7 @@ test_sanitize_block_erase(void)
logging(LOG_VERBOSE, "BLOCK_ERASE parameter list length must be 0");
logging(LOG_VERBOSE, "Test that non-zero param length is an error for "
"BLOCK ERASE");
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 8, &data);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -63,7 +63,7 @@ void test_sanitize_block_erase_reserved(void)
logging(LOG_VERBOSE, "Send SANITIZE command with the reserved "
"bit in byte 1 set to 1");
change_num = 1;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE BLOCK_ERASE is not "
@@ -79,7 +79,7 @@ void test_sanitize_block_erase_reserved(void)
"byte %d set to non-zero", i);
change_num = i;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -33,7 +33,7 @@ check_wacereq(void)
struct scsi_task *task_ret = NULL;
logging(LOG_VERBOSE, "Read one block from LBA 0");
read10(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 0, block_size, block_size,
read10(sd, &task_ret, 0, block_size, block_size,
0, 0, 0, 0, 0, NULL,
EXPECT_STATUS_GOOD);
CU_ASSERT_PTR_NOT_NULL(task_ret);
@@ -106,7 +106,7 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
int ret;
memset(buf, 'a', 256 * block_size);
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = write16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -118,7 +118,7 @@ check_lun_is_wiped(unsigned char *buf, uint64_t lba)
int ret;
unsigned char *rbuf = alloca(256 * block_size);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = read16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -184,7 +184,7 @@ test_sanitize_crypto_erase(void)
logging(LOG_VERBOSE, "Test we can perform basic CRYPTO ERASE SANITIZE");
ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
@@ -202,7 +202,7 @@ return;
logging(LOG_VERBOSE, "CRYPTO_ERASE parameter list length must be 0");
logging(LOG_VERBOSE, "Test that non-zero param length is an error for "
"CRYPTO ERASE");
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 8, &data);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -63,7 +63,7 @@ void test_sanitize_crypto_erase_reserved(void)
logging(LOG_VERBOSE, "Send SANITIZE command with the reserved "
"bit in byte 1 set to 1");
change_num = 1;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE CRYPTO_ERASE is not "
@@ -79,7 +79,7 @@ void test_sanitize_crypto_erase_reserved(void)
"byte %d set to non-zero", i);
change_num = i;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -60,7 +60,7 @@ test_sanitize_exit_failure_mode(void)
"be 0");
logging(LOG_VERBOSE, "Test that non-zero param length is an error for "
"EXIT_FAILURE_MODE");
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_EXIT_FAILURE_MODE, 8, &data);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -51,7 +51,7 @@ test_sanitize_invalid_serviceaction(void)
logging(LOG_VERBOSE, "Verify that ServiceAction:0x%02d is "
"an error.", i);
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, i, 0, NULL);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE is not "

View File

@@ -33,7 +33,7 @@ init_lun_with_data(uint64_t lba)
unsigned char *buf = alloca(256 * block_size);
memset(buf, 'a', 256 * block_size);
ret = write16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = write16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -46,7 +46,7 @@ check_lun_is_wiped(uint64_t lba, char c)
unsigned char *rbuf = alloca(256 * block_size);
unsigned char *zbuf = alloca(256 * block_size);
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = read16(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, rbuf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -124,7 +124,7 @@ test_sanitize_overwrite(void)
data.data[1] = 0x00;
data.data[2] = block_size >> 8;
data.data[3] = block_size & 0xff;
ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
@@ -140,7 +140,7 @@ test_sanitize_overwrite(void)
data.data[2] = (block_size / 2) >> 8;
data.data[3] = (block_size / 2 ) & 0xff;
ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
@@ -151,7 +151,7 @@ test_sanitize_overwrite(void)
data.data[2] = 0;
data.data[3] = 4;
ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
@@ -161,7 +161,7 @@ test_sanitize_overwrite(void)
logging(LOG_VERBOSE, "Test OVERWRITE with ParamLen:%d is an "
"error.", i);
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, i, &data);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE is not "
@@ -180,7 +180,7 @@ test_sanitize_overwrite(void)
data.size = block_size + 8;
data.data = alloca(block_size + 8); /* so we can send IP > blocksize */
memset(data.data, 0, data.size);
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, block_size + 5, &data);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE is not "
@@ -199,7 +199,7 @@ test_sanitize_overwrite(void)
data.data[1] = 0x00;
data.data[2] = block_size >> 8;
data.data[3] = block_size & 0xff;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
@@ -212,7 +212,7 @@ test_sanitize_overwrite(void)
data.data[1] = 0x00;
data.data[2] = 0x00;
data.data[3] = 0x00;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
@@ -226,7 +226,7 @@ test_sanitize_overwrite(void)
data.data[1] = 0x00;
data.data[2] = (block_size + 4) >> 8;
data.data[3] = (block_size + 4) & 0xff;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -73,7 +73,7 @@ void test_sanitize_overwrite_reserved(void)
logging(LOG_VERBOSE, "Send SANITIZE command with the reserved "
"bit in byte 1 set to 1");
change_num = 1;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
if (ret == -2) {
logging(LOG_NORMAL, "[SKIPPED] SANITIZE OVERWRITE is not "
@@ -89,7 +89,7 @@ void test_sanitize_overwrite_reserved(void)
"byte %d set to non-zero", i);
change_num = i;
ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_invalidfieldincdb(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -32,6 +32,7 @@ test_sanitize_readonly(void)
int ret;
struct iscsi_data data;
struct scsi_command_descriptor *cd;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test SANITIZE with READONLY devices");
@@ -40,14 +41,14 @@ test_sanitize_readonly(void)
CHECK_FOR_DATALOSS;
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "Set Software Write Protect on the second connection");
ret = set_swp(iscsic2, sd->iscsi_lun);
ret = set_swp(&sd2);
CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) {
return;
@@ -55,7 +56,7 @@ test_sanitize_readonly(void)
logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on "
"first connection");
while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) {
while (testunitready_clear_ua(sd)) {
sleep(1);
}
@@ -77,7 +78,7 @@ test_sanitize_readonly(void)
data.data[1] = 0x00;
data.data[2] = block_size >> 8;
data.data[3] = block_size & 0xff;
ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_writeprotected(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -92,7 +93,7 @@ test_sanitize_readonly(void)
"implemented according to REPORT_SUPPORTED_OPCODES.");
} else {
logging(LOG_VERBOSE, "Test SANITIZE BLOCK_ERASE");
ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_writeprotected(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -106,21 +107,20 @@ test_sanitize_readonly(void)
"implemented according to REPORT_SUPPORTED_OPCODES.");
} else {
logging(LOG_VERBOSE, "Test SANITIZE CRYPTO_ERASE");
ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_writeprotected(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "Clear Software Write Protect on the second connection");
ret = clear_swp(iscsic2, sd->iscsi_lun);
ret = clear_swp(&sd2);
logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on "
"first connection");
while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) {
while (testunitready_clear_ua(sd)) {
sleep(1);
}
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -32,6 +32,7 @@ test_sanitize_reservations(void)
int ret;
struct iscsi_data data;
struct scsi_command_descriptor *cd;
struct scsi_device sd2;
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test SANITIZE with RESERVATIONS");
@@ -40,15 +41,15 @@ test_sanitize_reservations(void)
CHECK_FOR_DATALOSS;
logging(LOG_VERBOSE, "Create a second connection to the target");
iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun);
if (iscsic2 == NULL) {
sd2.iscsi_ctx = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd2.iscsi_lun);
if (sd2.iscsi_ctx == NULL) {
logging(LOG_VERBOSE, "Failed to login to target");
return;
}
logging(LOG_VERBOSE, "Take out a RESERVE6 from the second "
"initiator");
ret = reserve6(iscsic2, sd->iscsi_lun);
ret = reserve6(&sd2);
CU_ASSERT_EQUAL(ret, 0);
@@ -70,7 +71,7 @@ test_sanitize_reservations(void)
data.data[1] = 0x00;
data.data[2] = block_size >> 8;
data.data[3] = block_size & 0xff;
ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_conflict(sd,
0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -85,7 +86,7 @@ test_sanitize_reservations(void)
"implemented according to REPORT_SUPPORTED_OPCODES.");
} else {
logging(LOG_VERBOSE, "Test SANITIZE BLOCK_ERASE");
ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_conflict(sd,
0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -99,12 +100,10 @@ test_sanitize_reservations(void)
"implemented according to REPORT_SUPPORTED_OPCODES.");
} else {
logging(LOG_VERBOSE, "Test SANITIZE CRYPTO_ERASE");
ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun,
ret = sanitize_conflict(sd,
0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL);
CU_ASSERT_EQUAL(ret, 0);
}
iscsi_destroy_context(iscsic2);
iscsic2 = NULL;
iscsi_destroy_context(sd2.iscsi_ctx);
}

View File

@@ -86,26 +86,26 @@ test_sanitize_reset(void)
logging(LOG_VERBOSE, "Verify that the SANITIZE has started and that "
"TESTUNITREADY fails with SANITIZE_IN_PROGRESS");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that STARTSTOPUNIT fails with "
"SANITIZE_IN_PROGRESS");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 1, 0, 1, 0,
ret = startstopunit(sd, 1, 0, 1, 0, 1, 0,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that READ16 fails with "
"SANITIZE_IN_PROGRESS");
ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = read16(sd, 0, block_size,
block_size, 0, 0, 0, 0, 0, NULL,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify that INQUIRY is still allowed while "
"SANITIZE is in progress");
ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 0, 255,
ret = inquiry(sd, NULL, 0, 0, 255,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -157,12 +157,12 @@ test_sanitize_reset(void)
}
logging(LOG_VERBOSE, "Verify that the SANITIZE is still going.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Wait until the SANITIZE operation has finished");
while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) {
while (testunitready_clear_ua(sd)) {
sleep(60);
}
}

View File

@@ -39,95 +39,95 @@ test_startstopunit_noloej(void)
}
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==0");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==0 START==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 0, 0, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==0");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 0, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==0 START==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 0, 0, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==0");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 1, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==0 NO_FLUSH==1 START==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 1, 0, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==0");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 1, 0, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test that media is not ejected when LOEJ==0 IMMED==1 NO_FLUSH==1 START==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 1, 0, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "In case the target did eject the medium, load it again.");
startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1,
startstopunit(sd, 1, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
}

View File

@@ -40,18 +40,18 @@ test_startstopunit_pwrcnd(void)
logging(LOG_VERBOSE, "Test that media is not ejected when PC!=0");
for (i = 1; i < 16; i++) {
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, i, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is not ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
}
logging(LOG_VERBOSE, "In case the target did eject the medium, load it again.");
startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1,
startstopunit(sd, 1, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
}

View File

@@ -41,7 +41,7 @@ test_startstopunit_simple(void)
logging(LOG_VERBOSE, "Media is not removable. STARTSTOPUNIT should fail");
}
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
if (!inq->rmb) {
@@ -52,45 +52,45 @@ test_startstopunit_simple(void)
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
1, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can read from the media.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test we can eject removable the media with IMMED==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 0, 1, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test TESTUNITREADY that medium is ejected.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_NO_MEDIUM);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1");
ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun,
ret = startstopunit(sd,
0, 0, 0, 0, 1, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Verify we can access the media again.");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_SANITIZE);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -30,7 +30,7 @@ test_testunitready_simple(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test TESTUNITREADY");
ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun,
ret = testunitready(sd,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}

View File

@@ -40,7 +40,7 @@ test_unmap_0blocks(void)
for (i = 0; i < 256; i++) {
list[0].lba = i;
list[0].num = 0;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -49,7 +49,7 @@ test_unmap_0blocks(void)
for (i = 0; i < 256; i++) {
list[i].lba = i;
list[i].num = 0;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, i,
ret = unmap(sd, 0, list, i,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
}
@@ -57,7 +57,7 @@ test_unmap_0blocks(void)
logging(LOG_VERBOSE, "Test UNMAP of 0 blocks at end-of-LUN");
list[0].lba = num_blocks;
list[0].num = 0;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -67,13 +67,13 @@ test_unmap_0blocks(void)
list[i].lba = i/2;
list[i].num = 0;
}
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 256,
ret = unmap(sd, 0, list, 256,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test UNMAP without any descriptors.");
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 0,
ret = unmap(sd, 0, list, 0,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -31,7 +31,7 @@ init_lun_with_data(unsigned char *buf, uint64_t lba)
int ret;
memset(buf, 'a', 256 * block_size);
ret = write10(sd->iscsi_ctx, sd->iscsi_lun, lba, 256 * block_size,
ret = write10(sd, lba, 256 * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -64,12 +64,12 @@ test_unmap_simple(void)
logging(LOG_VERBOSE, "UNMAP blocks 0-%d", i);
list[0].lba = 0;
list[0].num = i;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -99,12 +99,12 @@ test_unmap_simple(void)
for (i = 0; i < 256; i++) {
list[i].lba = i;
list[i].num = 1;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, i + 1,
ret = unmap(sd, 0, list, i + 1,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Read blocks 0-%d", i);
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,7 +40,7 @@ test_unmap_vpd(void)
logging(LOG_VERBOSE, "Check if UNMAP is available.");
list[0].lba = 0;
list[0].num = 0;
ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1,
ret = unmap(sd, 0, list, 1,
EXPECT_STATUS_GOOD);
if (ret != 0) {
logging(LOG_VERBOSE, "UNMAP is not available. Verify that VPD "

View File

@@ -30,7 +30,7 @@ test_verify10_0blocks(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 0-blocks at LBA==0");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size,
ret = verify10(sd, 0, 0, block_size,
0, 0, 1, NULL,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -41,21 +41,21 @@ test_verify10_0blocks(void)
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY10 0-blocks one block past end-of-LUN");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0,
ret = verify10(sd, num_blocks + 1, 0,
block_size, 0, 0, 1, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY10 0-blocks at LBA==2^31");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0,
ret = verify10(sd, 0x80000000, 0,
block_size, 0, 0, 1, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY10 0-blocks at LBA==-1");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size,
ret = verify10(sd, -1, 0, block_size,
0, 0, 1, NULL,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -42,7 +42,7 @@ test_verify10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i,
ret = verify10(sd, num_blocks + 1 - i,
i * block_size, block_size, 0, 0, 1, buf,
EXPECT_LBA_OOB);
if (ret == -2) {
@@ -59,7 +59,7 @@ test_verify10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000,
ret = verify10(sd, 0x80000000,
i * block_size, block_size, 0, 0, 1, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -71,7 +71,7 @@ test_verify10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size,
ret = verify10(sd, -1, i * block_size,
block_size, 0, 0, 1, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);
@@ -83,7 +83,7 @@ test_verify10_beyond_eol(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1,
ret = verify10(sd, num_blocks - 1,
i * block_size, block_size, 0, 0, 1, buf,
EXPECT_LBA_OOB);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -34,14 +34,14 @@ test_verify10_flags(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test VERIFY10 flags");
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size,
ret = read10(sd, NULL, 0, block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
logging(LOG_VERBOSE, "Test VERIFY10 with DPO==1");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = verify10(sd, 0, block_size,
block_size, 0, 1, 0, buf,
EXPECT_STATUS_GOOD);
if (ret == -2) {
@@ -54,7 +54,7 @@ test_verify10_flags(void)
logging(LOG_VERBOSE, "Test VERIFY10 with BYTCHK==1");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size,
ret = verify10(sd, 0, block_size,
block_size, 0, 0, 1, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);

View File

@@ -40,7 +40,7 @@ test_verify10_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size,
ret = read10(sd, NULL, 0, i * block_size,
block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -49,7 +49,7 @@ test_verify10_mismatch(void)
buf[offset] ^= 'X';
logging(LOG_VERBOSE, "Flip some bits in the data");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size,
ret = verify10(sd, 0, i * block_size,
block_size, 0, 0, 1, buf,
EXPECT_MISCOMPARE);
if (ret == -2) {
@@ -66,7 +66,7 @@ test_verify10_mismatch(void)
if (maximum_transfer_length && maximum_transfer_length < i) {
break;
}
ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i,
ret = read10(sd, NULL, num_blocks - i,
i * block_size, block_size, 0, 0, 0, 0, 0, buf,
EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0);
@@ -75,7 +75,7 @@ test_verify10_mismatch(void)
buf[offset] ^= 'X';
logging(LOG_VERBOSE, "Flip some bits in the data");
ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i,
ret = verify10(sd, num_blocks - i,
i * block_size, block_size, 0, 0, 1, buf,
EXPECT_MISCOMPARE);
CU_ASSERT_EQUAL(ret, 0);

Some files were not shown because too many files have changed in this diff Show More