From 9b768f7de968cbc5f903982b790d0505579cb88b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 18 Sep 2014 16:42:45 -0700 Subject: [PATCH] TESTS: move the default url, lun and iscsi context into a structure Signed-off-by: Ronnie Sahlberg --- test-tool/iscsi-support.c | 2 - test-tool/iscsi-support.h | 8 +- test-tool/iscsi-test-cu.c | 99 ++++++++++--------- test-tool/iscsi-test-cu.h | 2 - test-tool/test_compareandwrite_miscompare.c | 16 +-- test-tool/test_compareandwrite_simple.c | 16 +-- test-tool/test_get_lba_status_beyond_eol.c | 6 +- test-tool/test_get_lba_status_simple.c | 4 +- test-tool/test_get_lba_status_unmap_single.c | 16 +-- test-tool/test_inquiry_alloc_length.c | 6 +- test-tool/test_inquiry_block_limits.c | 4 +- test-tool/test_inquiry_evpd.c | 2 +- test-tool/test_inquiry_mandatory_vpd_sbc.c | 4 +- test-tool/test_inquiry_standard.c | 2 +- test-tool/test_inquiry_supported_vpd.c | 4 +- test-tool/test_iscsi_cmdsn_toohigh.c | 14 +-- test-tool/test_iscsi_cmdsn_toolow.c | 14 +-- test-tool/test_iscsi_datasn_invalid.c | 48 ++++----- test-tool/test_mandatory_sbc.c | 12 +-- test-tool/test_modesense6_all_pages.c | 4 +- test-tool/test_modesense6_residuals.c | 8 +- test-tool/test_nomedia_sbc.c | 52 +++++----- test-tool/test_orwrite_0blocks.c | 8 +- test-tool/test_orwrite_beyond_eol.c | 8 +- test-tool/test_orwrite_flags.c | 10 +- test-tool/test_orwrite_simple.c | 4 +- test-tool/test_orwrite_verify.c | 20 ++-- test-tool/test_orwrite_wrprotect.c | 2 +- test-tool/test_prefetch10_0blocks.c | 8 +- test-tool/test_prefetch10_beyond_eol.c | 8 +- test-tool/test_prefetch10_flags.c | 6 +- test-tool/test_prefetch10_simple.c | 4 +- test-tool/test_prefetch16_0blocks.c | 8 +- test-tool/test_prefetch16_beyond_eol.c | 8 +- test-tool/test_prefetch16_flags.c | 6 +- test-tool/test_prefetch16_simple.c | 4 +- test-tool/test_preventallow_2_itnexuses.c | 14 +-- test-tool/test_preventallow_cold_reset.c | 20 ++-- test-tool/test_preventallow_eject.c | 20 ++-- test-tool/test_preventallow_itnexus_loss.c | 22 ++--- test-tool/test_preventallow_logout.c | 24 ++--- test-tool/test_preventallow_lun_reset.c | 20 ++-- test-tool/test_preventallow_simple.c | 4 +- test-tool/test_preventallow_warm_reset.c | 20 ++-- test-tool/test_prin_read_keys_simple.c | 2 +- test-tool/test_prin_serviceaction_range.c | 6 +- test-tool/test_prout_register_simple.c | 10 +- test-tool/test_prout_reserve_access.c | 12 +-- test-tool/test_prout_reserve_ownership.c | 12 +-- test-tool/test_prout_reserve_simple.c | 10 +- test-tool/test_read10_0blocks.c | 8 +- test-tool/test_read10_beyond_eol.c | 8 +- test-tool/test_read10_flags.c | 10 +- test-tool/test_read10_invalid.c | 30 +++--- test-tool/test_read10_rdprotect.c | 2 +- test-tool/test_read10_residuals.c | 20 ++-- test-tool/test_read10_simple.c | 4 +- test-tool/test_read12_0blocks.c | 8 +- test-tool/test_read12_beyond_eol.c | 8 +- test-tool/test_read12_flags.c | 10 +- test-tool/test_read12_rdprotect.c | 2 +- test-tool/test_read12_residuals.c | 20 ++-- test-tool/test_read12_simple.c | 4 +- test-tool/test_read16_0blocks.c | 8 +- test-tool/test_read16_beyond_eol.c | 12 +-- test-tool/test_read16_flags.c | 10 +- test-tool/test_read16_rdprotect.c | 2 +- test-tool/test_read16_residuals.c | 20 ++-- test-tool/test_read16_simple.c | 4 +- test-tool/test_read6_beyond_eol.c | 6 +- test-tool/test_read6_simple.c | 8 +- test-tool/test_readcapacity10_simple.c | 2 +- test-tool/test_readcapacity16_alloclen.c | 2 +- test-tool/test_readcapacity16_simple.c | 2 +- test-tool/test_readonly_sbc.c | 26 ++--- ...est_report_supported_opcodes_one_command.c | 12 +-- .../test_report_supported_opcodes_rctd.c | 4 +- .../test_report_supported_opcodes_servactv.c | 2 +- .../test_report_supported_opcodes_simple.c | 2 +- test-tool/test_reserve6_2initiators.c | 22 ++--- test-tool/test_reserve6_itnexus_loss.c | 16 +-- test-tool/test_reserve6_logout.c | 18 ++-- test-tool/test_reserve6_lun_reset.c | 12 +-- test-tool/test_reserve6_simple.c | 4 +- test-tool/test_reserve6_target_cold_reset.c | 12 +-- test-tool/test_reserve6_target_warm_reset.c | 12 +-- test-tool/test_sanitize_block_erase.c | 14 +-- .../test_sanitize_block_erase_reserved.c | 4 +- test-tool/test_sanitize_crypto_erase.c | 10 +- .../test_sanitize_crypto_erase_reserved.c | 4 +- test-tool/test_sanitize_exit_failure_mode.c | 2 +- .../test_sanitize_invalid_serviceaction.c | 2 +- test-tool/test_sanitize_overwrite.c | 20 ++-- test-tool/test_sanitize_overwrite_reserved.c | 4 +- test-tool/test_sanitize_readonly.c | 16 +-- test-tool/test_sanitize_reservations.c | 10 +- test-tool/test_sanitize_reset.c | 42 ++++---- test-tool/test_startstopunit_noloej.c | 34 +++---- test-tool/test_startstopunit_pwrcnd.c | 6 +- test-tool/test_startstopunit_simple.c | 16 +-- test-tool/test_testunitready_simple.c | 2 +- test-tool/test_unmap_0blocks.c | 10 +- test-tool/test_unmap_simple.c | 10 +- test-tool/test_unmap_vpd.c | 2 +- test-tool/test_verify10_0blocks.c | 8 +- test-tool/test_verify10_beyond_eol.c | 8 +- test-tool/test_verify10_flags.c | 6 +- test-tool/test_verify10_mismatch.c | 8 +- test-tool/test_verify10_mismatch_no_cmp.c | 8 +- test-tool/test_verify10_simple.c | 8 +- test-tool/test_verify10_vrprotect.c | 4 +- test-tool/test_verify12_0blocks.c | 8 +- test-tool/test_verify12_beyond_eol.c | 8 +- test-tool/test_verify12_flags.c | 6 +- test-tool/test_verify12_mismatch.c | 8 +- test-tool/test_verify12_mismatch_no_cmp.c | 8 +- test-tool/test_verify12_simple.c | 8 +- test-tool/test_verify12_vrprotect.c | 4 +- test-tool/test_verify16_0blocks.c | 8 +- test-tool/test_verify16_beyond_eol.c | 8 +- test-tool/test_verify16_flags.c | 6 +- test-tool/test_verify16_mismatch.c | 8 +- test-tool/test_verify16_mismatch_no_cmp.c | 8 +- test-tool/test_verify16_simple.c | 8 +- test-tool/test_verify16_vrprotect.c | 4 +- test-tool/test_write10_0blocks.c | 8 +- test-tool/test_write10_beyond_eol.c | 8 +- test-tool/test_write10_flags.c | 10 +- test-tool/test_write10_residuals.c | 36 +++---- test-tool/test_write10_simple.c | 4 +- test-tool/test_write10_wrprotect.c | 2 +- test-tool/test_write12_0blocks.c | 8 +- test-tool/test_write12_beyond_eol.c | 8 +- test-tool/test_write12_flags.c | 10 +- test-tool/test_write12_residuals.c | 36 +++---- test-tool/test_write12_simple.c | 4 +- test-tool/test_write12_wrprotect.c | 2 +- test-tool/test_write16_0blocks.c | 8 +- test-tool/test_write16_beyond_eol.c | 8 +- test-tool/test_write16_flags.c | 10 +- test-tool/test_write16_residuals.c | 36 +++---- test-tool/test_write16_simple.c | 4 +- test-tool/test_write16_wrprotect.c | 2 +- test-tool/test_writesame10_0blocks.c | 8 +- test-tool/test_writesame10_beyond_eol.c | 8 +- test-tool/test_writesame10_simple.c | 4 +- test-tool/test_writesame10_unmap.c | 26 ++--- test-tool/test_writesame10_unmap_unaligned.c | 2 +- test-tool/test_writesame10_unmap_until_end.c | 6 +- test-tool/test_writesame10_unmap_vpd.c | 2 +- test-tool/test_writesame10_wrprotect.c | 2 +- test-tool/test_writesame16_0blocks.c | 8 +- test-tool/test_writesame16_beyond_eol.c | 8 +- test-tool/test_writesame16_simple.c | 4 +- test-tool/test_writesame16_unmap.c | 34 +++---- test-tool/test_writesame16_unmap_unaligned.c | 2 +- test-tool/test_writesame16_unmap_until_end.c | 6 +- test-tool/test_writesame16_unmap_vpd.c | 2 +- test-tool/test_writesame16_wrprotect.c | 2 +- test-tool/test_writeverify10_0blocks.c | 8 +- test-tool/test_writeverify10_beyond_eol.c | 8 +- test-tool/test_writeverify10_flags.c | 4 +- test-tool/test_writeverify10_residuals.c | 38 +++---- test-tool/test_writeverify10_simple.c | 4 +- test-tool/test_writeverify10_wrprotect.c | 2 +- test-tool/test_writeverify12_0blocks.c | 8 +- test-tool/test_writeverify12_beyond_eol.c | 8 +- test-tool/test_writeverify12_flags.c | 4 +- test-tool/test_writeverify12_residuals.c | 38 +++---- test-tool/test_writeverify12_simple.c | 4 +- test-tool/test_writeverify12_wrprotect.c | 2 +- test-tool/test_writeverify16_0blocks.c | 8 +- test-tool/test_writeverify16_beyond_eol.c | 8 +- test-tool/test_writeverify16_flags.c | 4 +- test-tool/test_writeverify16_residuals.c | 38 +++---- test-tool/test_writeverify16_simple.c | 4 +- test-tool/test_writeverify16_wrprotect.c | 2 +- 177 files changed, 939 insertions(+), 934 deletions(-) diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c index 9be0b2a..2cf4e05 100644 --- a/test-tool/iscsi-support.c +++ b/test-tool/iscsi-support.c @@ -46,8 +46,6 @@ const char *initiatorname1 = const char *initiatorname2 = "iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-test-2"; -const char *tgt_url; - int no_medium_ascqs[3] = { SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT, SCSI_SENSE_ASCQ_MEDIUM_NOT_PRESENT_TRAY_OPEN, diff --git a/test-tool/iscsi-support.h b/test-tool/iscsi-support.h index 33a150e..e390637 100644 --- a/test-tool/iscsi-support.h +++ b/test-tool/iscsi-support.h @@ -28,7 +28,6 @@ extern const char *initiatorname1; extern const char *initiatorname2; -extern const char *tgt_url; #define EXPECT_STATUS_GOOD SCSI_STATUS_GOOD, SCSI_SENSE_NO_SENSE, NULL, 0 #define EXPECT_NO_MEDIUM SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_NOT_READY, no_medium_ascqs, 3 @@ -184,6 +183,13 @@ extern int readonly; extern int sbc3_support; extern int maximum_transfer_length; +struct scsi_device { + struct iscsi_context *iscsi_ctx; + int iscsi_lun; + const char *iscsi_url; +}; +extern struct scsi_device *sd; + struct iscsi_context *iscsi_context_login(const char *initiatorname, const char *url, int *lun); struct iscsi_async_state { diff --git a/test-tool/iscsi-test-cu.c b/test-tool/iscsi-test-cu.c index 2659a2b..3ee2ca0 100644 --- a/test-tool/iscsi-test-cu.c +++ b/test-tool/iscsi-test-cu.c @@ -50,6 +50,7 @@ #define PROG "iscsi-test-cu" int loglevel = LOG_NORMAL; +struct scsi_device *sd; /* * this allows us to redefine how PDU are queued, at times, for @@ -595,8 +596,6 @@ static struct test_family families[] = { /* * globals for test setup and teardown */ -int tgt_lun; -struct iscsi_context *iscsic; struct scsi_task *task; int tgt_lun2; struct iscsi_context *iscsic2; @@ -683,8 +682,8 @@ test_teardown(void) int suite_init(void) { - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { fprintf(stderr, "error: Failed to login to target for test set-up\n"); return 1; @@ -703,10 +702,10 @@ suite_cleanup(void) /* libcunit version 1 */ test_teardown(); #endif - if (iscsic) { - iscsi_logout_sync(iscsic); - iscsi_destroy_context(iscsic); - iscsic = NULL; + if (sd->iscsi_ctx) { + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); + sd->iscsi_ctx = NULL; } return 0; } @@ -715,7 +714,7 @@ int suite_init_pgr(void) { suite_init(); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun2); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &tgt_lun2); if (iscsic2 == NULL) { fprintf(stderr, "error: Failed to login to target for test set-up\n"); @@ -933,6 +932,8 @@ main(int argc, char *argv[]) int i, c; int opt_idx = 0; + sd = malloc(sizeof(struct scsi_device)); + while ((c = getopt_long(argc, argv, "?hli:I:t:sdgfAsSnuvxV", long_opts, &opt_idx)) > 0) { switch (c) { @@ -994,7 +995,7 @@ main(int argc, char *argv[]) } if (optind < argc) { - tgt_url = strdup(argv[optind++]); + sd->iscsi_url = strdup(argv[optind++]); } if (optind < argc) { fprintf(stderr, "error: too many arguments\n"); @@ -1005,7 +1006,7 @@ main(int argc, char *argv[]) /* XXX why is this done? */ real_iscsi_queue_pdu = dlsym(RTLD_NEXT, "iscsi_queue_pdu"); - if (tgt_url == NULL) { + if (sd->iscsi_url == NULL) { fprintf(stderr, "You must specify the URL\n"); print_usage(); if (testname_re) @@ -1013,8 +1014,8 @@ main(int argc, char *argv[]) return 10; } - iscsic = iscsi_context_login(initiatorname1, tgt_url, &lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &lun); + if (sd->iscsi_ctx == NULL) { printf("Failed to login to target\n"); return -1; } @@ -1024,46 +1025,46 @@ main(int argc, char *argv[]) * All devices support readcapacity10 but only some support * readcapacity16 */ - task = iscsi_readcapacity10_sync(iscsic, lun, 0, 0); + task = iscsi_readcapacity10_sync(sd->iscsi_ctx, lun, 0, 0); if (task == NULL) { printf("Failed to send READCAPACITY10 command: %s\n", - iscsi_get_error(iscsic)); - iscsi_destroy_context(iscsic); + iscsi_get_error(sd->iscsi_ctx)); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } if (task->status != SCSI_STATUS_GOOD) { printf("READCAPACITY10 command: failed with sense. %s\n", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); scsi_free_scsi_task(task); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } rc10 = scsi_datain_unmarshall(task); if (rc10 == NULL) { printf("failed to unmarshall READCAPACITY10 data. %s\n", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); scsi_free_scsi_task(task); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } block_size = rc10->block_size; num_blocks = rc10->lba + 1; scsi_free_scsi_task(task); - rc16_task = iscsi_readcapacity16_sync(iscsic, lun); + rc16_task = iscsi_readcapacity16_sync(sd->iscsi_ctx, lun); if (rc16_task == NULL) { printf("Failed to send READCAPACITY16 command: %s\n", - iscsi_get_error(iscsic)); - iscsi_destroy_context(iscsic); + iscsi_get_error(sd->iscsi_ctx)); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } if (rc16_task->status == SCSI_STATUS_GOOD) { rc16 = scsi_datain_unmarshall(rc16_task); if (rc16 == NULL) { printf("failed to unmarshall READCAPACITY16 data. %s\n", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); scsi_free_scsi_task(rc16_task); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } block_size = rc16->block_length; @@ -1071,9 +1072,9 @@ main(int argc, char *argv[]) lbppb = 1 << rc16->lbppbe; } - inq_task = iscsi_inquiry_sync(iscsic, lun, 0, 0, 64); + inq_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 0, 0, 64); if (inq_task == NULL || inq_task->status != SCSI_STATUS_GOOD) { - printf("Inquiry command failed : %s\n", iscsi_get_error(iscsic)); + printf("Inquiry command failed : %s\n", iscsi_get_error(sd->iscsi_ctx)); return -1; } full_size = scsi_datain_getfullsize(inq_task); @@ -1081,10 +1082,10 @@ main(int argc, char *argv[]) scsi_free_scsi_task(inq_task); /* we need more data for the full list */ - inq_task = iscsi_inquiry_sync(iscsic, lun, 0, 0, full_size); + inq_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 0, 0, full_size); if (inq_task == NULL) { printf("Inquiry command failed : %s\n", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); return -1; } } @@ -1103,7 +1104,7 @@ main(int argc, char *argv[]) } /* try reading block limits vpd */ - inq_bl_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64); + inq_bl_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, 64); if (inq_bl_task && inq_bl_task->status != SCSI_STATUS_GOOD) { scsi_free_scsi_task(inq_bl_task); inq_bl_task = NULL; @@ -1113,8 +1114,8 @@ main(int argc, char *argv[]) if (full_size > inq_bl_task->datain.size) { scsi_free_scsi_task(inq_bl_task); - if ((inq_bl_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, full_size)) == NULL) { - printf("Inquiry command failed : %s\n", iscsi_get_error(iscsic)); + if ((inq_bl_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_LIMITS, full_size)) == NULL) { + printf("Inquiry command failed : %s\n", iscsi_get_error(sd->iscsi_ctx)); return -1; } } @@ -1127,7 +1128,7 @@ main(int argc, char *argv[]) } /* try reading block device characteristics vpd */ - inq_bdc_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS, 255); + inq_bdc_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 1, SCSI_INQUIRY_PAGECODE_BLOCK_DEVICE_CHARACTERISTICS, 255); if (inq_bdc_task == NULL) { printf("Failed to read Block Device Characteristics page\n"); } @@ -1141,9 +1142,9 @@ main(int argc, char *argv[]) /* if thin provisioned we also need to read the VPD page for it */ if (rc16 && rc16->lbpme != 0){ - inq_lbp_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64); + inq_lbp_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64); if (inq_lbp_task == NULL || inq_lbp_task->status != SCSI_STATUS_GOOD) { - printf("Inquiry command failed : %s\n", iscsi_get_error(iscsic)); + printf("Inquiry command failed : %s\n", iscsi_get_error(sd->iscsi_ctx)); return -1; } full_size = scsi_datain_getfullsize(inq_lbp_task); @@ -1151,8 +1152,8 @@ main(int argc, char *argv[]) scsi_free_scsi_task(inq_lbp_task); /* we need more data for the full list */ - if ((inq_lbp_task = iscsi_inquiry_sync(iscsic, lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, full_size)) == NULL) { - printf("Inquiry command failed : %s\n", iscsi_get_error(iscsic)); + if ((inq_lbp_task = iscsi_inquiry_sync(sd->iscsi_ctx, lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, full_size)) == NULL) { + printf("Inquiry command failed : %s\n", iscsi_get_error(sd->iscsi_ctx)); return -1; } } @@ -1164,12 +1165,12 @@ main(int argc, char *argv[]) } } - rsop_task = iscsi_report_supported_opcodes_sync(iscsic, lun, + rsop_task = iscsi_report_supported_opcodes_sync(sd->iscsi_ctx, lun, 1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535); if (rsop_task == NULL) { printf("Failed to send REPORT_SUPPORTED_OPCODES command: %s\n", - iscsi_get_error(iscsic)); - iscsi_destroy_context(iscsic); + iscsi_get_error(sd->iscsi_ctx)); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } if (rsop_task->status == SCSI_STATUS_GOOD) { @@ -1177,19 +1178,19 @@ main(int argc, char *argv[]) if (rsop == NULL) { printf("failed to unmarshall REPORT_SUPPORTED_OPCODES " "data. %s\n", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); scsi_free_scsi_task(rsop_task); } } /* check if the device is write protected or not */ - task = iscsi_modesense6_sync(iscsic, lun, 0, SCSI_MODESENSE_PC_CURRENT, + task = iscsi_modesense6_sync(sd->iscsi_ctx, lun, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255); if (task == NULL) { printf("Failed to send MODE_SENSE6 command: %s\n", - iscsi_get_error(iscsic)); - iscsi_destroy_context(iscsic); + iscsi_get_error(sd->iscsi_ctx)); + iscsi_destroy_context(sd->iscsi_ctx); return -1; } if (task->status == SCSI_STATUS_GOOD) { @@ -1205,8 +1206,8 @@ main(int argc, char *argv[]) } scsi_free_scsi_task(task); - iscsi_logout_sync(iscsic); - iscsi_destroy_context(iscsic); + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); if (is_usb) { printf("USB device. Clamping maximum transfer length to 120k\n"); @@ -1243,7 +1244,7 @@ main(int argc, char *argv[]) } CU_cleanup_registry(); - free(discard_const(tgt_url)); + free(discard_const(sd->iscsi_url)); if (inq_task != NULL) { scsi_free_scsi_task(inq_task); @@ -1263,6 +1264,8 @@ main(int argc, char *argv[]) if (rsop_task != NULL) { scsi_free_scsi_task(rsop_task); } - + if (sd != NULL) { + free(sd); + } return 0; } diff --git a/test-tool/iscsi-test-cu.h b/test-tool/iscsi-test-cu.h index 0b02db3..638a802 100644 --- a/test-tool/iscsi-test-cu.h +++ b/test-tool/iscsi-test-cu.h @@ -32,8 +32,6 @@ #include "iscsi-support.h" /* globals between setup, tests, and teardown */ -extern struct iscsi_context *iscsic; -extern int tgt_lun; extern struct scsi_task *task; extern struct iscsi_context *iscsic2; extern int tgt_lun2; diff --git a/test-tool/test_compareandwrite_miscompare.c b/test-tool/test_compareandwrite_miscompare.c index 65d4138..fa1f269 100644 --- a/test-tool/test_compareandwrite_miscompare.c +++ b/test-tool/test_compareandwrite_miscompare.c @@ -53,7 +53,7 @@ test_compareandwrite_miscompare(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, 0, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_compareandwrite_simple.c b/test-tool/test_compareandwrite_simple.c index 5a6b346..cce245e 100644 --- a/test-tool/test_compareandwrite_simple.c +++ b/test-tool/test_compareandwrite_simple.c @@ -54,7 +54,7 @@ test_compareandwrite_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, 0, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = compareandwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_get_lba_status_beyond_eol.c b/test-tool/test_get_lba_status_beyond_eol.c index d7910ad..1ae55a2 100644 --- a/test-tool/test_get_lba_status_beyond_eol.c +++ b/test-tool/test_get_lba_status_beyond_eol.c @@ -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(iscsic, NULL, tgt_lun, num_blocks + 1, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0x8000000000000000ULL, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0x8000000000000000ULL, 24, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test GET_LBA_STATUS at LBA -1"); - ret = get_lba_status(iscsic, NULL, tgt_lun, 0xffffffffffffffffULL, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0xffffffffffffffffULL, 24, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_get_lba_status_simple.c b/test-tool/test_get_lba_status_simple.c index 8d12fab..ba28bf6 100644 --- a/test-tool/test_get_lba_status_simple.c +++ b/test-tool/test_get_lba_status_simple.c @@ -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(iscsic, NULL, tgt_lun, 0, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, num_blocks - i, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, 24, EXPECT_STATUS_GOOD); if (ret != 0) { CU_FAIL("[FAILED] GET_LBA_STATUS command failed"); diff --git a/test-tool/test_get_lba_status_unmap_single.c b/test-tool/test_get_lba_status_unmap_single.c index 0c8b4f9..ea058dc 100644 --- a/test-tool/test_get_lba_status_unmap_single.c +++ b/test-tool/test_get_lba_status_unmap_single.c @@ -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(iscsic, tgt_lun, 0, (256 + lbppb) * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, i, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, &t, tgt_lun, i + lbppb, 24, + ret = get_lba_status(sd->iscsi_ctx, &t, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, (256 + lbppb) * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, &t, tgt_lun, i + 1, 24, + ret = get_lba_status(sd->iscsi_ctx, &t, sd->iscsi_lun, i + 1, 24, EXPECT_STATUS_GOOD); if (ret != 0) { CU_FAIL("[FAILED] GET_LBA_STATUS command failed"); diff --git a/test-tool/test_inquiry_alloc_length.c b/test-tool/test_inquiry_alloc_length.c index 3854a40..8e11589 100644 --- a/test-tool/test_inquiry_alloc_length.c +++ b/test-tool/test_inquiry_alloc_length.c @@ -40,7 +40,7 @@ test_inquiry_alloc_length(void) scsi_free_scsi_task(task); task = NULL; } - ret = inquiry(iscsic, &task, tgt_lun, 0, 0, i, + ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 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(iscsic, &task, tgt_lun, 0, 0, 511, + ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 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(iscsic, &task2, tgt_lun, 0, 0, 512, + ret = inquiry(sd->iscsi_ctx, &task2, sd->iscsi_lun, 0, 0, 512, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_inquiry_block_limits.c b/test-tool/test_inquiry_block_limits.c index bc22d70..08d2338 100644 --- a/test-tool/test_inquiry_block_limits.c +++ b/test-tool/test_inquiry_block_limits.c @@ -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(iscsic, &bl_task, tgt_lun, + ret = inquiry(sd->iscsi_ctx, &bl_task, sd->iscsi_lun, 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(iscsic, &lbp_task, tgt_lun, + ret = inquiry(sd->iscsi_ctx, &lbp_task, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_LOGICAL_BLOCK_PROVISIONING, 64, EXPECT_STATUS_GOOD); if (ret == 0) { diff --git a/test-tool/test_inquiry_evpd.c b/test-tool/test_inquiry_evpd.c index 7a4475b..34a45bf 100644 --- a/test-tool/test_inquiry_evpd.c +++ b/test-tool/test_inquiry_evpd.c @@ -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(iscsic, NULL, tgt_lun, 0, 1, 256, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 1, 256, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_inquiry_mandatory_vpd_sbc.c b/test-tool/test_inquiry_mandatory_vpd_sbc.c index 7df0b48..f5707a7 100644 --- a/test-tool/test_inquiry_mandatory_vpd_sbc.c +++ b/test-tool/test_inquiry_mandatory_vpd_sbc.c @@ -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(iscsic, NULL, tgt_lun, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 1, SCSI_INQUIRY_PAGECODE_DEVICE_IDENTIFICATION, 255, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_inquiry_standard.c b/test-tool/test_inquiry_standard.c index c2c1257..89be0c7 100644 --- a/test-tool/test_inquiry_standard.c +++ b/test-tool/test_inquiry_standard.c @@ -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(iscsic, &task, tgt_lun, 0, 0, 260, + ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 0, 0, 260, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_inquiry_supported_vpd.c b/test-tool/test_inquiry_supported_vpd.c index 7a92d89..36344a2 100644 --- a/test-tool/test_inquiry_supported_vpd.c +++ b/test-tool/test_inquiry_supported_vpd.c @@ -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(iscsic, &task, tgt_lun, + ret = inquiry(sd->iscsi_ctx, &task, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 1, sup_inq->pages[i], 255, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 1, sup_inq->pages[i], 255, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_iscsi_cmdsn_toohigh.c b/test-tool/test_iscsi_cmdsn_toohigh.c index f2db7f3..abbe353 100644 --- a/test-tool/test_iscsi_cmdsn_toohigh.c +++ b/test-tool/test_iscsi_cmdsn_toohigh.c @@ -54,17 +54,17 @@ void test_iscsi_cmdsn_toohigh(void) logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN > MAXCMDSN must be silently ignored by the target"); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == MAXCMDSN+1. Should be ignored by the target."); - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; change_cmdsn = 1; /* we don't want autoreconnect since some targets will incorrectly * drop the connection on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, -1); if (ret == -1) { @@ -74,9 +74,9 @@ void test_iscsi_cmdsn_toohigh(void) } - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_iscsi_cmdsn_toolow.c b/test-tool/test_iscsi_cmdsn_toolow.c index a1eaea8..9809d04 100644 --- a/test-tool/test_iscsi_cmdsn_toolow.c +++ b/test-tool/test_iscsi_cmdsn_toolow.c @@ -54,17 +54,17 @@ void test_iscsi_cmdsn_toolow(void) logging(LOG_VERBOSE, "RFC3720:3.2.2.1 CMDSN < EXPCMDSN must be silently ignored by the target"); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN-1. Should be ignored by the target."); - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; change_cmdsn = 1; /* we don't want autoreconnect since some targets will incorrectly * drop the connection on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, -1); if (ret == -1) { @@ -75,9 +75,9 @@ void test_iscsi_cmdsn_toolow(void) - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Send a TESTUNITREADY with CMDSN == EXPCMDSN. should work again"); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_iscsi_datasn_invalid.c b/test-tool/test_iscsi_datasn_invalid.c index 897975b..b672e7f 100644 --- a/test-tool/test_iscsi_datasn_invalid.c +++ b/test-tool/test_iscsi_datasn_invalid.c @@ -69,13 +69,13 @@ void test_iscsi_datasn_invalid(void) logging(LOG_VERBOSE, "Send 2 DATAIN with DATASN==0. Should fail."); change_datasn = 1; - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = write10(iscsic, tgt_lun, 100, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -86,19 +86,19 @@ void test_iscsi_datasn_invalid(void) } CU_ASSERT_NOT_EQUAL(ret, 0); - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Send DATAIN with DATASN==27. Should fail"); change_datasn = 2; - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = write10(iscsic, tgt_lun, 100, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -109,19 +109,19 @@ void test_iscsi_datasn_invalid(void) } CU_ASSERT_NOT_EQUAL(ret, 0); - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Send DATAIN with DATASN==-1. Should fail"); change_datasn = 3; - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = write10(iscsic, tgt_lun, 100, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -132,20 +132,20 @@ void test_iscsi_datasn_invalid(void) } CU_ASSERT_NOT_EQUAL(ret, 0); - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Send DATAIN in reverse order (datasn == 1,0). Should fail"); change_datasn = 4; - iscsic->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; - iscsic->target_max_recv_data_segment_length = block_size; + sd->iscsi_ctx->use_immediate_data = ISCSI_IMMEDIATE_DATA_NO; + sd->iscsi_ctx->target_max_recv_data_segment_length = block_size; local_iscsi_queue_pdu = my_iscsi_queue_pdu; - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); - ret = write10(iscsic, tgt_lun, 100, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 100, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -157,5 +157,5 @@ void test_iscsi_datasn_invalid(void) CU_ASSERT_NOT_EQUAL(ret, 0); local_iscsi_queue_pdu = NULL; - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); } diff --git a/test-tool/test_mandatory_sbc.c b/test-tool/test_mandatory_sbc.c index 8c33127..ab5f3a9 100644 --- a/test-tool/test_mandatory_sbc.c +++ b/test-tool/test_mandatory_sbc.c @@ -37,38 +37,38 @@ test_mandatory_sbc(void) CHECK_FOR_SBC; logging(LOG_VERBOSE, "Test INQUIRY."); - ret = inquiry(iscsic, NULL, tgt_lun, 0, 0, 255, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 0, 255, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test READCAPACITY10."); - ret = readcapacity10(iscsic, tgt_lun, 0, 0, + ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 15, + ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 15, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } logging(LOG_VERBOSE, "Test READ10."); - ret = read10(iscsic, NULL, tgt_lun, 0, block_size, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_modesense6_all_pages.c b/test-tool/test_modesense6_all_pages.c index 7c96141..1f0ddc0 100644 --- a/test-tool/test_modesense6_all_pages.c +++ b/test-tool/test_modesense6_all_pages.c @@ -39,14 +39,14 @@ test_modesense6_all_pages(void) } logging(LOG_VERBOSE, "Send MODESENSE6 command to fetch AllPages"); - task = iscsi_modesense6_sync(iscsic, tgt_lun, 0, + task = iscsi_modesense6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255); if (task == NULL || task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Failed to send MODE_SENSE6 " "command:%s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_FAIL("[FAILED] Failed to fetch the All Pages page."); return; } diff --git a/test-tool/test_modesense6_residuals.c b/test-tool/test_modesense6_residuals.c index fdb2f72..ab0eb97 100644 --- a/test-tool/test_modesense6_residuals.c +++ b/test-tool/test_modesense6_residuals.c @@ -40,14 +40,14 @@ test_modesense6_residuals(void) scsi_free_scsi_task(task); task = NULL; } - task = iscsi_modesense6_sync(iscsic, tgt_lun, 0, + task = iscsi_modesense6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 4); if (task == NULL || task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Failed to send MODE_SENSE6 " "command:%s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_FAIL("[FAILED] Failed to fetch the All Pages page."); return; } @@ -80,14 +80,14 @@ test_modesense6_residuals(void) scsi_free_scsi_task(task); task = NULL; } - task = iscsi_modesense6_sync(iscsic, tgt_lun, 0, + task = iscsi_modesense6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, SCSI_MODESENSE_PC_CURRENT, SCSI_MODEPAGE_RETURN_ALL_PAGES, 0, 255); if (task == NULL || task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Failed to send MODE_SENSE6 " "command:%s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_FAIL("[FAILED] Failed to fetch the All Pages page."); return; } diff --git a/test-tool/test_nomedia_sbc.c b/test-tool/test_nomedia_sbc.c index 42f95e4..477f004 100644 --- a/test-tool/test_nomedia_sbc.c +++ b/test-tool/test_nomedia_sbc.c @@ -43,17 +43,17 @@ test_nomedia_sbc(void) } logging(LOG_VERBOSE, "Eject the medium."); - ret = startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test SYNCHRONIZECACHE10 when medium is ejected."); - ret = synchronizecache10(iscsic, tgt_lun, 0, 1, 1, 1, + ret = synchronizecache10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 1, 1, + ret = synchronizecache16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, block_size, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 0, + ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test READCAPACITY16 when medium is ejected."); - ret = readcapacity16(iscsic, tgt_lun, 15, + ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, 24, + ret = get_lba_status(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 1, 0, EXPECT_NO_MEDIUM); + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 1, 0, EXPECT_NO_MEDIUM); + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_orwrite_0blocks.c b/test-tool/test_orwrite_0blocks.c index 80c099d..5d7b641 100644 --- a/test-tool/test_orwrite_0blocks.c +++ b/test-tool/test_orwrite_0blocks.c @@ -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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_orwrite_beyond_eol.c b/test-tool/test_orwrite_beyond_eol.c index c057dde..bc222f9 100644 --- a/test-tool/test_orwrite_beyond_eol.c +++ b/test-tool/test_orwrite_beyond_eol.c @@ -40,7 +40,7 @@ test_orwrite_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = orwrite(iscsic, tgt_lun, num_blocks + 1 - i, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_orwrite_flags.c b/test-tool/test_orwrite_flags.c index 317f113..8ea0cf4 100644 --- a/test-tool/test_orwrite_flags.c +++ b/test-tool/test_orwrite_flags.c @@ -39,7 +39,7 @@ test_orwrite_flags(void) logging(LOG_VERBOSE, "Test ORWRITE flags"); logging(LOG_VERBOSE, "Test ORWRITE with DPO==1"); - ret = orwrite(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_orwrite_simple.c b/test-tool/test_orwrite_simple.c index 394ddd4..470df44 100644 --- a/test-tool/test_orwrite_simple.c +++ b/test-tool/test_orwrite_simple.c @@ -42,7 +42,7 @@ test_orwrite_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = orwrite(iscsic, tgt_lun, 0, i * block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_orwrite_verify.c b/test-tool/test_orwrite_verify.c index b6f6245..2e7d505 100644 --- a/test-tool/test_orwrite_verify.c +++ b/test-tool/test_orwrite_verify.c @@ -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(iscsic, tgt_lun, 0, i * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, i * block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, i * block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, readbuf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_orwrite_wrprotect.c b/test-tool/test_orwrite_wrprotect.c index 65c9dbd..d99e842 100644 --- a/test-tool/test_orwrite_wrprotect.c +++ b/test-tool/test_orwrite_wrprotect.c @@ -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(iscsic, tgt_lun, 0, block_size, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_prefetch10_0blocks.c b/test-tool/test_prefetch10_0blocks.c index f16a27b..73b8c89 100644 --- a/test-tool/test_prefetch10_0blocks.c +++ b/test-tool/test_prefetch10_0blocks.c @@ -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(iscsic, tgt_lun, 0, 0, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, 0, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, 0, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test PREFETCH10 0-blocks at LBA==-1"); - ret = prefetch10(iscsic, tgt_lun, -1, 0, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch10_beyond_eol.c b/test-tool/test_prefetch10_beyond_eol.c index e3d6a0b..f5c0704 100644 --- a/test-tool/test_prefetch10_beyond_eol.c +++ b/test-tool/test_prefetch10_beyond_eol.c @@ -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(iscsic, tgt_lun, num_blocks + 1 - i, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch10_flags.c b/test-tool/test_prefetch10_flags.c index 7071b26..a59a21f 100644 --- a/test-tool/test_prefetch10_flags.c +++ b/test-tool/test_prefetch10_flags.c @@ -34,7 +34,7 @@ test_prefetch10_flags(void) logging(LOG_VERBOSE, "Test PREFETCH10 flags"); logging(LOG_VERBOSE, "Test PREFETCH10 with IMMED==1"); - ret = prefetch10(iscsic, tgt_lun, 0, 1, 1, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 0, 3, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 1, 3, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 3, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch10_simple.c b/test-tool/test_prefetch10_simple.c index eb5020b..ca0351b 100644 --- a/test-tool/test_prefetch10_simple.c +++ b/test-tool/test_prefetch10_simple.c @@ -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(iscsic, tgt_lun, 0, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i, 0, 0, + ret = prefetch10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i, 0, 0, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch16_0blocks.c b/test-tool/test_prefetch16_0blocks.c index d175a88..6620d80 100644 --- a/test-tool/test_prefetch16_0blocks.c +++ b/test-tool/test_prefetch16_0blocks.c @@ -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(iscsic, tgt_lun, 0, 0, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, 0, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, 0, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test PREFETCH16 0-blocks at LBA==-1"); - ret = prefetch16(iscsic, tgt_lun, -1, 0, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch16_beyond_eol.c b/test-tool/test_prefetch16_beyond_eol.c index 7adcd6f..069e250 100644 --- a/test-tool/test_prefetch16_beyond_eol.c +++ b/test-tool/test_prefetch16_beyond_eol.c @@ -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(iscsic, tgt_lun, num_blocks + 1 - i, i, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, i, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, i, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i, 0, 0, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch16_flags.c b/test-tool/test_prefetch16_flags.c index d8db486..3f24e9f 100644 --- a/test-tool/test_prefetch16_flags.c +++ b/test-tool/test_prefetch16_flags.c @@ -34,7 +34,7 @@ test_prefetch16_flags(void) logging(LOG_VERBOSE, "Test PREFETCH16 flags"); logging(LOG_VERBOSE, "Test PREFETCH16 with IMMED==1"); - ret = prefetch16(iscsic, tgt_lun, 0, 1, 1, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 0, 3, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, 1, 1, 3, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 0, 1, 1, 3, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prefetch16_simple.c b/test-tool/test_prefetch16_simple.c index f31ab35..92725ec 100644 --- a/test-tool/test_prefetch16_simple.c +++ b/test-tool/test_prefetch16_simple.c @@ -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(iscsic, tgt_lun, 0, i, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, i, 0, 0, + ret = prefetch16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i, 0, 0, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_2_itnexuses.c b/test-tool/test_preventallow_2_itnexuses.c index 2b14acc..6a9b0d1 100644 --- a/test-tool/test_preventallow_2_itnexuses.c +++ b/test-tool/test_preventallow_2_itnexuses.c @@ -36,28 +36,28 @@ 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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == 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, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(iscsic2, sd->iscsi_lun, 0, 0, 0, 0, 1, 0, EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); @@ -70,11 +70,11 @@ test_preventallow_2_itnexuses(void) logging(LOG_VERBOSE, "Clear PREVENT and load medium in case target failed"); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_preventallow_cold_reset.c b/test-tool/test_preventallow_cold_reset.c index a374cdb..81eec21 100644 --- a/test-tool/test_preventallow_cold_reset.c +++ b/test-tool/test_preventallow_cold_reset.c @@ -36,50 +36,50 @@ 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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Perform cold reset on target"); - ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic); + ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx); logging(LOG_VERBOSE, "Wait until all unit attentions clear"); - while (testunitready(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); + while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_preventallow_eject.c b/test-tool/test_preventallow_eject.c index d110064..de38b4d 100644 --- a/test-tool/test_preventallow_eject.c +++ b/test-tool/test_preventallow_eject.c @@ -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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_REMOVAL_PREVENTED); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Clear PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium again"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_preventallow_itnexus_loss.c b/test-tool/test_preventallow_itnexus_loss.c index d649c77..038254c 100644 --- a/test-tool/test_preventallow_itnexus_loss.c +++ b/test-tool/test_preventallow_itnexus_loss.c @@ -36,53 +36,53 @@ 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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Disconnect from the target."); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); logging(LOG_VERBOSE, "Reconnect to target"); - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_preventallow_logout.c b/test-tool/test_preventallow_logout.c index 130916d..9280f76 100644 --- a/test-tool/test_preventallow_logout.c +++ b/test-tool/test_preventallow_logout.c @@ -36,54 +36,54 @@ test_preventallow_logout(void) logging(LOG_VERBOSE, "Test that Logout loss clears PREVENT MEDIUM REMOVAL"); logging(LOG_VERBOSE, "Set the PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Logout from target"); - iscsi_logout_sync(iscsic); - iscsi_destroy_context(iscsic); + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); logging(LOG_VERBOSE, "Relogin to target"); - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_preventallow_lun_reset.c b/test-tool/test_preventallow_lun_reset.c index 625ea1a..fd1cb0e 100644 --- a/test-tool/test_preventallow_lun_reset.c +++ b/test-tool/test_preventallow_lun_reset.c @@ -36,50 +36,50 @@ 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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Perform LUN reset on target"); - ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun); + 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(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); + while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_simple.c b/test-tool/test_preventallow_simple.c index eb2324d..9d74822 100644 --- a/test-tool/test_preventallow_simple.c +++ b/test-tool/test_preventallow_simple.c @@ -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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can clear PREVENT flag"); - ret = preventallow(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_preventallow_warm_reset.c b/test-tool/test_preventallow_warm_reset.c index 02cc71b..cf610e2 100644 --- a/test-tool/test_preventallow_warm_reset.c +++ b/test-tool/test_preventallow_warm_reset.c @@ -36,50 +36,50 @@ 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(iscsic, tgt_lun, 1); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 1); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Perform warm reset on target"); - ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic); + 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(iscsic, tgt_lun, EXPECT_STATUS_GOOD) != 0); + while (testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD) != 0); logging(LOG_VERBOSE, "Try to eject the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0); + ret = preventallow(sd->iscsi_ctx, sd->iscsi_lun, 0); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Load the medium"); - ret = startstopunit(iscsic, tgt_lun, 0, 0, 0, 0, 1, 1, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_prin_read_keys_simple.c b/test-tool/test_prin_read_keys_simple.c index 01b748c..feee29a 100644 --- a/test-tool/test_prin_read_keys_simple.c +++ b/test-tool/test_prin_read_keys_simple.c @@ -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(iscsic, tgt_lun, &task, NULL); + ret = prin_read_keys(sd->iscsi_ctx, sd->iscsi_lun, &task, NULL); if (ret == -2) { logging(LOG_NORMAL, "[SKIPPED] PERSISTEN RESERVE IN is not implemented."); CU_PASS("PERSISTENT RESERVE IN is not implemented."); diff --git a/test-tool/test_prin_serviceaction_range.c b/test-tool/test_prin_serviceaction_range.c index d8f3a00..3e43fd1 100644 --- a/test-tool/test_prin_serviceaction_range.c +++ b/test-tool/test_prin_serviceaction_range.c @@ -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(iscsic, tgt_lun, &task, NULL); + ret = prin_read_keys(sd->iscsi_ctx, sd->iscsi_lun, &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(iscsic, tgt_lun, i, 1); + ret = prin_task(sd->iscsi_ctx, sd->iscsi_lun, i, 1); CU_ASSERT_EQUAL(ret, 0); } /* verify that PRIN/SA={4..0x20} fails ... */ for (i = 4; i < 0x20; i++) { - ret = prin_task(iscsic, tgt_lun, i, 0); + ret = prin_task(sd->iscsi_ctx, sd->iscsi_lun, i, 0); CU_ASSERT_EQUAL(ret, 0); } } diff --git a/test-tool/test_prout_register_simple.c b/test-tool/test_prout_register_simple.c index ca13193..d71f1a0 100644 --- a/test-tool/test_prout_register_simple.c +++ b/test-tool/test_prout_register_simple.c @@ -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(iscsic, tgt_lun, key); + ret = prout_register_and_ignore(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, key, 1); + ret = prin_verify_key_presence(sd->iscsi_ctx, sd->iscsi_lun, key, 1); CU_ASSERT_EQUAL(ret, 0); /* try to reregister, which should fail */ - ret = prout_reregister_key_fails(iscsic, tgt_lun, key+1); + ret = prout_reregister_key_fails(sd->iscsi_ctx, sd->iscsi_lun, key+1); CU_ASSERT_EQUAL(ret, 0); /* release from the target */ - ret = prout_register_key(iscsic, tgt_lun, 0, key); + ret = prout_register_key(sd->iscsi_ctx, sd->iscsi_lun, 0, key); CU_ASSERT_EQUAL(ret, 0); /* Verify the registration is gone */ - ret = prin_verify_key_presence(iscsic, tgt_lun, key, 0); + ret = prin_verify_key_presence(sd->iscsi_ctx, sd->iscsi_lun, key, 0); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_prout_reserve_access.c b/test-tool/test_prout_reserve_access.c index 2d4dd65..cf9d6b0 100644 --- a/test-tool/test_prout_reserve_access.c +++ b/test-tool/test_prout_reserve_access.c @@ -123,7 +123,7 @@ verify_persistent_reserve_access(struct iscsi_context *iscsi1, int lun1, void test_prout_reserve_access_ea(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS, 0, 0, 0, 0); } @@ -131,7 +131,7 @@ test_prout_reserve_access_ea(void) void test_prout_reserve_access_we(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE, 1, 0, 1, 0); } @@ -139,7 +139,7 @@ test_prout_reserve_access_we(void) void test_prout_reserve_access_earo(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_REGISTRANTS_ONLY, 1, 1, 0, 0); } @@ -147,7 +147,7 @@ test_prout_reserve_access_earo(void) void test_prout_reserve_access_wero(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_REGISTRANTS_ONLY, 1, 1, 1, 0); } @@ -155,7 +155,7 @@ test_prout_reserve_access_wero(void) void test_prout_reserve_access_eaar(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_ALL_REGISTRANTS, 1, 1, 0, 0); } @@ -163,7 +163,7 @@ test_prout_reserve_access_eaar(void) void test_prout_reserve_access_wear(void) { - verify_persistent_reserve_access(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_access(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_ALL_REGISTRANTS, 1, 1, 1, 0); } diff --git a/test-tool/test_prout_reserve_ownership.c b/test-tool/test_prout_reserve_ownership.c index 9404e6d..28b33d1 100644 --- a/test-tool/test_prout_reserve_ownership.c +++ b/test-tool/test_prout_reserve_ownership.c @@ -97,41 +97,41 @@ verify_persistent_reserve_ownership(struct iscsi_context *iscsi1, int lun1, void test_prout_reserve_ownership_ea(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS, 0); } void test_prout_reserve_ownership_we(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE, 0); } void test_prout_reserve_ownership_earo(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_REGISTRANTS_ONLY, 0); } void test_prout_reserve_ownership_wero(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_REGISTRANTS_ONLY, 0); } void test_prout_reserve_ownership_eaar(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_EXCLUSIVE_ACCESS_ALL_REGISTRANTS, 1); } void test_prout_reserve_ownership_wear(void) { - verify_persistent_reserve_ownership(iscsic, tgt_lun, iscsic2, tgt_lun2, + verify_persistent_reserve_ownership(sd->iscsi_ctx, sd->iscsi_lun, iscsic2, tgt_lun2, SCSI_PERSISTENT_RESERVE_TYPE_WRITE_EXCLUSIVE_ALL_REGISTRANTS, 1); } diff --git a/test-tool/test_prout_reserve_simple.c b/test-tool/test_prout_reserve_simple.c index c7a0c42..90144d5 100644 --- a/test-tool/test_prout_reserve_simple.c +++ b/test-tool/test_prout_reserve_simple.c @@ -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(iscsic, tgt_lun, key); + ret = prout_register_and_ignore(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, key, pr_type); + ret = prout_reserve(sd->iscsi_ctx, sd->iscsi_lun, key, pr_type); CU_ASSERT_EQUAL(ret, 0); /* verify target reservation */ - ret = prin_verify_reserved_as(iscsic, tgt_lun, + ret = prin_verify_reserved_as(sd->iscsi_ctx, sd->iscsi_lun, pr_type_is_all_registrants(pr_type) ? 0 : key, pr_type); CU_ASSERT_EQUAL(ret, 0); /* release our reservation */ - ret = prout_release(iscsic, tgt_lun, key, pr_type); + ret = prout_release(sd->iscsi_ctx, sd->iscsi_lun, key, pr_type); CU_ASSERT_EQUAL(ret, 0); } /* remove our key from the target */ - ret = prout_register_key(iscsic, tgt_lun, 0, key); + ret = prout_register_key(sd->iscsi_ctx, sd->iscsi_lun, 0, key); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_read10_0blocks.c b/test-tool/test_read10_0blocks.c index 973efba..0c870a1 100644 --- a/test-tool/test_read10_0blocks.c +++ b/test-tool/test_read10_0blocks.c @@ -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(iscsic, NULL, tgt_lun, 0, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, num_blocks + 1, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0x80000000, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, -1, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read10_beyond_eol.c b/test-tool/test_read10_beyond_eol.c index 4fdae75..148693a 100644 --- a/test-tool/test_read10_beyond_eol.c +++ b/test-tool/test_read10_beyond_eol.c @@ -40,7 +40,7 @@ test_read10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL,tgt_lun, num_blocks + 1 - i, + ret = read10(sd->iscsi_ctx, NULL,sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0x80000000, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, -1, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, -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(iscsic, NULL, tgt_lun, num_blocks - 1, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read10_flags.c b/test-tool/test_read10_flags.c index b467278..d0ed3f2 100644 --- a/test-tool/test_read10_flags.c +++ b/test-tool/test_read10_flags.c @@ -36,35 +36,35 @@ test_read10_flags(void) CHECK_FOR_SBC; logging(LOG_VERBOSE, "Test READ10 with DPO==1"); - ret = read10(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read10_invalid.c b/test-tool/test_read10_invalid.c index 4de7360..4dfed15 100644 --- a/test-tool/test_read10_invalid.c +++ b/test-tool/test_read10_invalid.c @@ -54,19 +54,19 @@ test_read10_invalid(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -89,7 +89,7 @@ test_read10_invalid(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==10000"); @@ -103,13 +103,13 @@ test_read10_invalid(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 10000; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -147,13 +147,13 @@ test_read10_invalid(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 200; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -193,13 +193,13 @@ test_read10_invalid(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = block_size; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -240,16 +240,16 @@ test_read10_invalid(void) data.size = block_size; data.data = (unsigned char *)buf; - iscsi_set_noautoreconnect(iscsic, 1); - iscsi_set_timeout(iscsic, 3); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); + iscsi_set_timeout(sd->iscsi_ctx, 3); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); scsi_free_scsi_task(task); diff --git a/test-tool/test_read10_rdprotect.c b/test-tool/test_read10_rdprotect.c index c8fff2f..028f30d 100644 --- a/test-tool/test_read10_rdprotect.c +++ b/test-tool/test_read10_rdprotect.c @@ -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(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_read10_residuals.c b/test-tool/test_read10_residuals.c index f177d44..bb89c15 100644 --- a/test-tool/test_read10_residuals.c +++ b/test-tool/test_read10_residuals.c @@ -55,19 +55,19 @@ test_read10_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -90,7 +90,7 @@ test_read10_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==10000"); @@ -104,13 +104,13 @@ test_read10_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 10000; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -152,13 +152,13 @@ test_read10_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 200; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -198,13 +198,13 @@ test_read10_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = block_size; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); diff --git a/test-tool/test_read10_simple.c b/test-tool/test_read10_simple.c index b0d06c0..c142a12 100644 --- a/test-tool/test_read10_simple.c +++ b/test-tool/test_read10_simple.c @@ -37,7 +37,7 @@ test_read10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL,tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL,sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read12_0blocks.c b/test-tool/test_read12_0blocks.c index 88b0811..09e3827 100644 --- a/test-tool/test_read12_0blocks.c +++ b/test-tool/test_read12_0blocks.c @@ -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(iscsic, tgt_lun, 0, 0, block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, 0, block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, 0, block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read12_beyond_eol.c b/test-tool/test_read12_beyond_eol.c index 87232ca..ea214d2 100644 --- a/test-tool/test_read12_beyond_eol.c +++ b/test-tool/test_read12_beyond_eol.c @@ -40,7 +40,7 @@ test_read12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, num_blocks + 1 - i, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, i * block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read12_flags.c b/test-tool/test_read12_flags.c index 7bac8b5..75161b0 100644 --- a/test-tool/test_read12_flags.c +++ b/test-tool/test_read12_flags.c @@ -36,7 +36,7 @@ test_read12_flags(void) CHECK_FOR_SBC; logging(LOG_VERBOSE, "Test READ12 with DPO==1"); - ret = read12(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read12_rdprotect.c b/test-tool/test_read12_rdprotect.c index b01c6e3..125fe7b 100644 --- a/test-tool/test_read12_rdprotect.c +++ b/test-tool/test_read12_rdprotect.c @@ -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(iscsic, tgt_lun, 0, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_read12_residuals.c b/test-tool/test_read12_residuals.c index 38ed3b4..e359075 100644 --- a/test-tool/test_read12_residuals.c +++ b/test-tool/test_read12_residuals.c @@ -50,12 +50,12 @@ test_read12_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -69,7 +69,7 @@ test_read12_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -92,7 +92,7 @@ test_read12_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==10000"); @@ -106,13 +106,13 @@ test_read12_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 10000; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -154,13 +154,13 @@ test_read12_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 200; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -200,13 +200,13 @@ test_read12_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = block_size; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); diff --git a/test-tool/test_read12_simple.c b/test-tool/test_read12_simple.c index 93518fb..00c720b 100644 --- a/test-tool/test_read12_simple.c +++ b/test-tool/test_read12_simple.c @@ -37,7 +37,7 @@ test_read12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, 0, i * block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read16_0blocks.c b/test-tool/test_read16_0blocks.c index 62fb146..c72ce03 100644 --- a/test-tool/test_read16_0blocks.c +++ b/test-tool/test_read16_0blocks.c @@ -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(iscsic, tgt_lun, 0, 0, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, 0, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read16_beyond_eol.c b/test-tool/test_read16_beyond_eol.c index 418de91..47e7b53 100644 --- a/test-tool/test_read16_beyond_eol.c +++ b/test-tool/test_read16_beyond_eol.c @@ -49,7 +49,7 @@ test_read16_beyond_eol(void) break; } - ret = read16(iscsic, tgt_lun, num_blocks + 1 - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read16_flags.c b/test-tool/test_read16_flags.c index 436ebe6..763aff7 100644 --- a/test-tool/test_read16_flags.c +++ b/test-tool/test_read16_flags.c @@ -36,7 +36,7 @@ test_read16_flags(void) logging(LOG_VERBOSE, "Test READ16 flags"); logging(LOG_VERBOSE, "Test READ16 with DPO==1"); - ret = read16(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read16_rdprotect.c b/test-tool/test_read16_rdprotect.c index 800372b..db81d79 100644 --- a/test-tool/test_read16_rdprotect.c +++ b/test-tool/test_read16_rdprotect.c @@ -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(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, NULL, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_read16_residuals.c b/test-tool/test_read16_residuals.c index 538096e..a914754 100644 --- a/test-tool/test_read16_residuals.c +++ b/test-tool/test_read16_residuals.c @@ -50,12 +50,12 @@ test_read16_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -69,7 +69,7 @@ test_read16_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -92,7 +92,7 @@ test_read16_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try reading one block but with iSCSI expected transfer length==10000"); @@ -106,13 +106,13 @@ test_read16_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 10000; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -154,13 +154,13 @@ test_read16_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = 200; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -200,13 +200,13 @@ test_read16_residuals(void) task->xfer_dir = SCSI_XFER_READ; task->expxferlen = block_size; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); diff --git a/test-tool/test_read16_simple.c b/test-tool/test_read16_simple.c index e91f241..413160d 100644 --- a/test-tool/test_read16_simple.c +++ b/test-tool/test_read16_simple.c @@ -39,7 +39,7 @@ test_read16_simple(void) break; } - ret = read16(iscsic, tgt_lun, 0, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read6_beyond_eol.c b/test-tool/test_read6_beyond_eol.c index eaeeb52..db0f378 100644 --- a/test-tool/test_read6_beyond_eol.c +++ b/test-tool/test_read6_beyond_eol.c @@ -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(iscsic, tgt_lun, num_blocks + 1 - i, + ret = read6(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x1fffff, + ret = read6(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - 1, + ret = read6(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_read6_simple.c b/test-tool/test_read6_simple.c index 6930400..19c436d 100644 --- a/test-tool/test_read6_simple.c +++ b/test-tool/test_read6_simple.c @@ -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(iscsic, tgt_lun, 0, i * block_size, + ret = read6(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = read6(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, NULL, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -64,11 +64,11 @@ test_read6_simple(void) logging(LOG_VERBOSE, "Test sending a READ6 with transfer length == 0 " "(meaning 256 blocks)"); /* 256 is converted to 0 when the CDB is marshalled by the helper */ - task = iscsi_read6_sync(iscsic, tgt_lun, 0, + task = iscsi_read6_sync(sd->iscsi_ctx, sd->iscsi_lun, 0, 256 * block_size, block_size); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_NORMAL, "[FAILED] READ6 command: " - "failed with sense. %s", iscsi_get_error(iscsic)); + "failed with sense. %s", iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); diff --git a/test-tool/test_readcapacity10_simple.c b/test-tool/test_readcapacity10_simple.c index 8a2d52f..242f2db 100644 --- a/test-tool/test_readcapacity10_simple.c +++ b/test-tool/test_readcapacity10_simple.c @@ -34,7 +34,7 @@ test_readcapacity10_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test basic READCAPACITY10"); - ret = readcapacity10(iscsic, tgt_lun, 0, 0, + ret = readcapacity10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_readcapacity16_alloclen.c b/test-tool/test_readcapacity16_alloclen.c index 6587e39..0f8c089 100644 --- a/test-tool/test_readcapacity16_alloclen.c +++ b/test-tool/test_readcapacity16_alloclen.c @@ -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(iscsic, tgt_lun, i, + ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 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."); diff --git a/test-tool/test_readcapacity16_simple.c b/test-tool/test_readcapacity16_simple.c index fb7ce4d..3b8e89f 100644 --- a/test-tool/test_readcapacity16_simple.c +++ b/test-tool/test_readcapacity16_simple.c @@ -34,7 +34,7 @@ test_readcapacity16_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test that READCAPACITY16 works"); - ret = readcapacity16(iscsic, tgt_lun, 16, + ret = readcapacity16(sd->iscsi_ctx, sd->iscsi_lun, 16, EXPECT_STATUS_GOOD); if (ret == -2) { logging(LOG_NORMAL, "[SKIPPED] READCAPACITY16 is not implemented on this target and it does not claim support."); diff --git a/test-tool/test_readonly_sbc.c b/test-tool/test_readonly_sbc.c index d15e301..6625082 100644 --- a/test-tool/test_readonly_sbc.c +++ b/test-tool/test_readonly_sbc.c @@ -41,25 +41,25 @@ test_readonly_sbc(void) logging(LOG_VERBOSE, "Test WRITE10 fails with WRITE_PROTECTED"); - ret = write10(iscsic, tgt_lun, 0, block_size, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, 1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, 1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, + ret = orwrite(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_WRITE_PROTECTED); if (ret == -2) { diff --git a/test-tool/test_report_supported_opcodes_one_command.c b/test-tool/test_report_supported_opcodes_one_command.c index b38e264..c629602 100644 --- a/test-tool/test_report_supported_opcodes_one_command.c +++ b/test-tool/test_report_supported_opcodes_one_command.c @@ -39,7 +39,7 @@ test_report_supported_opcodes_one_command(void) logging(LOG_VERBOSE, "Fetch list of all supported opcodes"); - ret = report_supported_opcodes(iscsic, &rso_task, tgt_lun, + ret = report_supported_opcodes(sd->iscsi_ctx, &rso_task, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, + ret = report_supported_opcodes(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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( - iscsic, NULL, tgt_lun, + sd->iscsi_ctx, NULL, sd->iscsi_lun, 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( - iscsic, NULL, tgt_lun, + sd->iscsi_ctx, NULL, sd->iscsi_lun, 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( - iscsic, NULL, tgt_lun, + sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, SCSI_REPORT_SUPPORTING_SERVICEACTION, rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa, @@ -121,7 +121,7 @@ test_report_supported_opcodes_one_command(void) rsoc->descriptors[i].opcode, rsoc->descriptors[i].sa); ret = report_supported_opcodes( - iscsic, &one_task, tgt_lun, + sd->iscsi_ctx, &one_task, sd->iscsi_lun, 0, rsoc->descriptors[i].servactv ? SCSI_REPORT_SUPPORTING_SERVICEACTION : diff --git a/test-tool/test_report_supported_opcodes_rctd.c b/test-tool/test_report_supported_opcodes_rctd.c index f801d95..48d494b 100644 --- a/test-tool/test_report_supported_opcodes_rctd.c +++ b/test-tool/test_report_supported_opcodes_rctd.c @@ -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( - iscsic, &rso_task, tgt_lun, + sd->iscsi_ctx, &rso_task, sd->iscsi_lun, 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( - iscsic, &rso_task, tgt_lun, + sd->iscsi_ctx, &rso_task, sd->iscsi_lun, 1, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_report_supported_opcodes_servactv.c b/test-tool/test_report_supported_opcodes_servactv.c index ba66cd6..a9867b9 100644 --- a/test-tool/test_report_supported_opcodes_servactv.c +++ b/test-tool/test_report_supported_opcodes_servactv.c @@ -37,7 +37,7 @@ test_report_supported_opcodes_servactv(void) ret = report_supported_opcodes( - iscsic, &rso_task, tgt_lun, + sd->iscsi_ctx, &rso_task, sd->iscsi_lun, 0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 65535, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_report_supported_opcodes_simple.c b/test-tool/test_report_supported_opcodes_simple.c index 5183736..2ce84df 100644 --- a/test-tool/test_report_supported_opcodes_simple.c +++ b/test-tool/test_report_supported_opcodes_simple.c @@ -34,7 +34,7 @@ test_report_supported_opcodes_simple(void) logging(LOG_VERBOSE, "Test basic READ_SUPPORTED_OPCODES"); ret = report_supported_opcodes( - iscsic, NULL, tgt_lun, + sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, SCSI_REPORT_SUPPORTING_OPS_ALL, 0, 0, 1024, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_reserve6_2initiators.c b/test-tool/test_reserve6_2initiators.c index 1952aa4..eb0950c 100644 --- a/test-tool/test_reserve6_2initiators.c +++ b/test-tool/test_reserve6_2initiators.c @@ -36,7 +36,7 @@ test_reserve6_2initiators(void) logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,50 +46,50 @@ test_reserve6_2initiators(void) logging(LOG_NORMAL, "Verify that the first initiator can re-RESERVE6 the same reservation"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == 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, tgt_lun); + ret = reserve6_conflict(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "Try to RELEASE from the second initiator. Should be a nop"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "Test we can still send MODE SENSE from the first initiator"); - ret = mode_sense(iscsic, tgt_lun); + ret = mode_sense(sd->iscsi_ctx, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "MODE SENSE should fail from the second initiator"); - ret = mode_sense(iscsic2, tgt_lun); + ret = mode_sense(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, SCSI_STATUS_RESERVATION_CONFLICT); logging(LOG_NORMAL, "RESERVE6 from the second initiator should still fail"); - ret = reserve6_conflict(iscsic2, tgt_lun); + ret = reserve6_conflict(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "RELEASE6 from the first initiator"); - ret = release6(iscsic, tgt_lun); + ret = release6(sd->iscsi_ctx, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); iscsi_logout_sync(iscsic2); diff --git a/test-tool/test_reserve6_itnexus_loss.c b/test-tool/test_reserve6_itnexus_loss.c index 7aebbd6..88f1fde 100644 --- a/test-tool/test_reserve6_itnexus_loss.c +++ b/test-tool/test_reserve6_itnexus_loss.c @@ -36,7 +36,7 @@ test_reserve6_itnexus_loss(void) logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,35 +46,35 @@ test_reserve6_itnexus_loss(void) logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == 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, tgt_lun); + ret = reserve6_conflict(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Disconnect from the target."); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); logging(LOG_VERBOSE, "Sleep for three seconds incase the target is slow to reset"); sleep(3); logging(LOG_VERBOSE, "Reconnect to target"); - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); goto finished; } logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); finished: diff --git a/test-tool/test_reserve6_logout.c b/test-tool/test_reserve6_logout.c index e0ea4ff..75a7818 100644 --- a/test-tool/test_reserve6_logout.c +++ b/test-tool/test_reserve6_logout.c @@ -36,7 +36,7 @@ test_reserve6_logout(void) logging(LOG_NORMAL, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,33 +46,33 @@ test_reserve6_logout(void) logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == 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, tgt_lun); + ret = reserve6_conflict(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Logout from target"); - iscsi_logout_sync(iscsic); - iscsi_destroy_context(iscsic); + iscsi_logout_sync(sd->iscsi_ctx); + iscsi_destroy_context(sd->iscsi_ctx); logging(LOG_VERBOSE, "Relogin to target"); - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_NORMAL, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_NORMAL, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); iscsi_logout_sync(iscsic2); diff --git a/test-tool/test_reserve6_lun_reset.c b/test-tool/test_reserve6_lun_reset.c index 3b4a2ed..49a8404 100644 --- a/test-tool/test_reserve6_lun_reset.c +++ b/test-tool/test_reserve6_lun_reset.c @@ -36,7 +36,7 @@ test_reserve6_lun_reset(void) logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,9 +46,9 @@ test_reserve6_lun_reset(void) logging(LOG_VERBOSE, "Send a LUN Reset"); - ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun); + ret = iscsi_task_mgmt_lun_reset_sync(sd->iscsi_ctx, sd->iscsi_lun); if (ret != 0) { - logging(LOG_NORMAL, "LUN reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "LUN reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(ret, 0); @@ -57,18 +57,18 @@ test_reserve6_lun_reset(void) logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); iscsi_logout_sync(iscsic2); diff --git a/test-tool/test_reserve6_simple.c b/test-tool/test_reserve6_simple.c index 8f5c69d..267150e 100644 --- a/test-tool/test_reserve6_simple.c +++ b/test-tool/test_reserve6_simple.c @@ -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(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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(iscsic, tgt_lun); + ret = release6(sd->iscsi_ctx, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_reserve6_target_cold_reset.c b/test-tool/test_reserve6_target_cold_reset.c index 15914c7..d6d3b05 100644 --- a/test-tool/test_reserve6_target_cold_reset.c +++ b/test-tool/test_reserve6_target_cold_reset.c @@ -36,7 +36,7 @@ test_reserve6_target_cold_reset(void) logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,9 +46,9 @@ test_reserve6_target_cold_reset(void) logging(LOG_VERBOSE, "Send a Cold Reset to the target"); - ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic); + ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx); if (ret != 0) { - logging(LOG_NORMAL, "Cold reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "Cold reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(ret, 0); @@ -56,18 +56,18 @@ test_reserve6_target_cold_reset(void) sleep(3); logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); iscsi_logout_sync(iscsic2); diff --git a/test-tool/test_reserve6_target_warm_reset.c b/test-tool/test_reserve6_target_warm_reset.c index db5bdd3..0ec0141 100644 --- a/test-tool/test_reserve6_target_warm_reset.c +++ b/test-tool/test_reserve6_target_warm_reset.c @@ -36,7 +36,7 @@ test_reserve6_target_warm_reset(void) logging(LOG_VERBOSE, "Take out a RESERVE6 from the first initiator"); - ret = reserve6(iscsic, tgt_lun); + ret = reserve6(sd->iscsi_ctx, sd->iscsi_lun); 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,9 +46,9 @@ test_reserve6_target_warm_reset(void) logging(LOG_VERBOSE, "Send a Warm Reset to the target"); - ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic); + ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx); if (ret != 0) { - logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(ret, 0); @@ -57,7 +57,7 @@ test_reserve6_target_warm_reset(void) logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; @@ -65,11 +65,11 @@ test_reserve6_target_warm_reset(void) logging(LOG_VERBOSE, "RESERVE6 from the second initiator should work now"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "RELEASE6 from the second initiator"); - ret = release6(iscsic2, tgt_lun); + ret = release6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); iscsi_logout_sync(iscsic2); diff --git a/test-tool/test_sanitize_block_erase.c b/test-tool/test_sanitize_block_erase.c index a32723c..e4c7ec1 100644 --- a/test-tool/test_sanitize_block_erase.c +++ b/test-tool/test_sanitize_block_erase.c @@ -33,7 +33,7 @@ check_wabereq(void) struct scsi_task *task_ret = NULL; logging(LOG_VERBOSE, "Read one block from LBA 0"); - read10(iscsic, &task_ret, tgt_lun, 0, block_size, block_size, + read10(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 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(iscsic, &task_ret, tgt_lun, 0, 256, + get_lba_status(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 0, 256, EXPECT_STATUS_GOOD); if (task_ret == NULL) { logging(LOG_VERBOSE, "[FAILED] Failed to read LBA mapping " @@ -121,7 +121,7 @@ check_unmap(void) if (task_ret->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Failed to read LBA mapping " "from the target. Sense: %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_FAIL("[FAILED] Failed to read LBA mapping " "from the target."); scsi_free_scsi_task(task_ret); @@ -197,7 +197,7 @@ init_lun_with_data(unsigned char *buf, uint64_t lba) int ret; memset(buf, 'a', 256 * block_size); - ret = write16(iscsic, tgt_lun, lba, 256 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, lba, 256 * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 8, &data); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_sanitize_block_erase_reserved.c b/test-tool/test_sanitize_block_erase_reserved.c index b6ad9e3..2c721ed 100644 --- a/test-tool/test_sanitize_block_erase_reserved.c +++ b/test-tool/test_sanitize_block_erase_reserved.c @@ -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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_crypto_erase.c b/test-tool/test_sanitize_crypto_erase.c index 9b0dd4b..27856b3 100644 --- a/test-tool/test_sanitize_crypto_erase.c +++ b/test-tool/test_sanitize_crypto_erase.c @@ -33,7 +33,7 @@ check_wacereq(void) struct scsi_task *task_ret = NULL; logging(LOG_VERBOSE, "Read one block from LBA 0"); - read10(iscsic, &task_ret, tgt_lun, 0, block_size, block_size, + read10(sd->iscsi_ctx, &task_ret, sd->iscsi_lun, 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(iscsic, tgt_lun, lba, 256 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, lba, 256 * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 8, &data); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_sanitize_crypto_erase_reserved.c b/test-tool/test_sanitize_crypto_erase_reserved.c index 2afb0e7..e142305 100644 --- a/test-tool/test_sanitize_crypto_erase_reserved.c +++ b/test-tool/test_sanitize_crypto_erase_reserved.c @@ -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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_exit_failure_mode.c b/test-tool/test_sanitize_exit_failure_mode.c index 3264dc5..40063ed 100644 --- a/test-tool/test_sanitize_exit_failure_mode.c +++ b/test-tool/test_sanitize_exit_failure_mode.c @@ -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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_EXIT_FAILURE_MODE, 8, &data); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_invalid_serviceaction.c b/test-tool/test_sanitize_invalid_serviceaction.c index 55361bb..1c77037 100644 --- a/test-tool/test_sanitize_invalid_serviceaction.c +++ b/test-tool/test_sanitize_invalid_serviceaction.c @@ -51,7 +51,7 @@ test_sanitize_invalid_serviceaction(void) logging(LOG_VERBOSE, "Verify that ServiceAction:0x%02d is " "an error.", i); - ret = sanitize_invalidfieldincdb(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, i, 0, NULL); if (ret == -2) { logging(LOG_NORMAL, "[SKIPPED] SANITIZE is not " diff --git a/test-tool/test_sanitize_overwrite.c b/test-tool/test_sanitize_overwrite.c index cdbfc4c..0fa7b52 100644 --- a/test-tool/test_sanitize_overwrite.c +++ b/test-tool/test_sanitize_overwrite.c @@ -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(iscsic, tgt_lun, lba, 256 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, lba, 256 * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_overwrite_reserved.c b/test-tool/test_sanitize_overwrite_reserved.c index 2a17d37..94fef3c 100644 --- a/test-tool/test_sanitize_overwrite_reserved.c +++ b/test-tool/test_sanitize_overwrite_reserved.c @@ -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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = sanitize_invalidfieldincdb(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_readonly.c b/test-tool/test_sanitize_readonly.c index b0e7a4b..89f8c8c 100644 --- a/test-tool/test_sanitize_readonly.c +++ b/test-tool/test_sanitize_readonly.c @@ -40,14 +40,14 @@ test_sanitize_readonly(void) CHECK_FOR_DATALOSS; logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == 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, tgt_lun); + ret = set_swp(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); if (ret != 0) { return; @@ -55,7 +55,7 @@ test_sanitize_readonly(void) logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on " "first connection"); - while (testunitready_clear_ua(iscsic, tgt_lun)) { + while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) { sleep(1); } @@ -77,7 +77,7 @@ test_sanitize_readonly(void) data.data[1] = 0x00; data.data[2] = block_size >> 8; data.data[3] = block_size & 0xff; - ret = sanitize_writeprotected(iscsic, tgt_lun, + ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data); CU_ASSERT_EQUAL(ret, 0); } @@ -92,7 +92,7 @@ test_sanitize_readonly(void) "implemented according to REPORT_SUPPORTED_OPCODES."); } else { logging(LOG_VERBOSE, "Test SANITIZE BLOCK_ERASE"); - ret = sanitize_writeprotected(iscsic, tgt_lun, + ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL); CU_ASSERT_EQUAL(ret, 0); } @@ -106,18 +106,18 @@ test_sanitize_readonly(void) "implemented according to REPORT_SUPPORTED_OPCODES."); } else { logging(LOG_VERBOSE, "Test SANITIZE CRYPTO_ERASE"); - ret = sanitize_writeprotected(iscsic, tgt_lun, + ret = sanitize_writeprotected(sd->iscsi_ctx, sd->iscsi_lun, 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, tgt_lun); + ret = clear_swp(iscsic2, sd->iscsi_lun); logging(LOG_VERBOSE, "Use TESTUNITREADY to clear unit attention on " "first connection"); - while (testunitready_clear_ua(iscsic, tgt_lun)) { + while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) { sleep(1); } diff --git a/test-tool/test_sanitize_reservations.c b/test-tool/test_sanitize_reservations.c index 05e1919..b3509c8 100644 --- a/test-tool/test_sanitize_reservations.c +++ b/test-tool/test_sanitize_reservations.c @@ -40,7 +40,7 @@ test_sanitize_reservations(void) CHECK_FOR_DATALOSS; logging(LOG_VERBOSE, "Create a second connection to the target"); - iscsic2 = iscsi_context_login(initiatorname2, tgt_url, &tgt_lun); + iscsic2 = iscsi_context_login(initiatorname2, sd->iscsi_url, &sd->iscsi_lun); if (iscsic2 == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; @@ -48,7 +48,7 @@ test_sanitize_reservations(void) logging(LOG_VERBOSE, "Take out a RESERVE6 from the second " "initiator"); - ret = reserve6(iscsic2, tgt_lun); + ret = reserve6(iscsic2, sd->iscsi_lun); CU_ASSERT_EQUAL(ret, 0); @@ -70,7 +70,7 @@ test_sanitize_reservations(void) data.data[1] = 0x00; data.data[2] = block_size >> 8; data.data[3] = block_size & 0xff; - ret = sanitize_conflict(iscsic, tgt_lun, + ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data); CU_ASSERT_EQUAL(ret, 0); } @@ -85,7 +85,7 @@ test_sanitize_reservations(void) "implemented according to REPORT_SUPPORTED_OPCODES."); } else { logging(LOG_VERBOSE, "Test SANITIZE BLOCK_ERASE"); - ret = sanitize_conflict(iscsic, tgt_lun, + ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_BLOCK_ERASE, 0, NULL); CU_ASSERT_EQUAL(ret, 0); } @@ -99,7 +99,7 @@ test_sanitize_reservations(void) "implemented according to REPORT_SUPPORTED_OPCODES."); } else { logging(LOG_VERBOSE, "Test SANITIZE CRYPTO_ERASE"); - ret = sanitize_conflict(iscsic, tgt_lun, + ret = sanitize_conflict(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_CRYPTO_ERASE, 0, NULL); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_sanitize_reset.c b/test-tool/test_sanitize_reset.c index 0a92b0f..f92b864 100644 --- a/test-tool/test_sanitize_reset.c +++ b/test-tool/test_sanitize_reset.c @@ -66,7 +66,7 @@ test_sanitize_reset(void) data.data[1] = 0x00; data.data[2] = block_size >> 8; data.data[3] = block_size & 0xff; - sanitize_task = iscsi_sanitize_task(iscsic, tgt_lun, + sanitize_task = iscsi_sanitize_task(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, SCSI_SANITIZE_OVERWRITE, data.size, &data, sanitize_cb, NULL); @@ -74,7 +74,7 @@ test_sanitize_reset(void) /* just send something so that we know the sanitize command is sent * to the target */ - rl_task = iscsi_reportluns_sync(iscsic, 0, 64); + rl_task = iscsi_reportluns_sync(sd->iscsi_ctx, 0, 64); if (rl_task) { scsi_free_scsi_task(rl_task); } @@ -86,83 +86,83 @@ test_sanitize_reset(void) logging(LOG_VERBOSE, "Verify that the SANITIZE has started and that " "TESTUNITREADY fails with SANITIZE_IN_PROGRESS"); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Verify that STARTSTOPUNIT fails with " "SANITIZE_IN_PROGRESS"); - ret = startstopunit(iscsic, tgt_lun, 1, 0, 1, 0, 1, 0, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, 0, 0, 255, + ret = inquiry(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 0, 255, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Send an ABORT TASK"); - ret = iscsi_task_mgmt_abort_task_sync(iscsic, sanitize_task); + ret = iscsi_task_mgmt_abort_task_sync(sd->iscsi_ctx, sanitize_task); if (ret != 0) { logging(LOG_NORMAL, "ABORT TASK failed. %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } logging(LOG_VERBOSE, "Send an ABORT TASK SET"); - ret = iscsi_task_mgmt_abort_task_set_sync(iscsic, tgt_lun); + ret = iscsi_task_mgmt_abort_task_set_sync(sd->iscsi_ctx, sd->iscsi_lun); if (ret != 0) { logging(LOG_NORMAL, "ABORT TASK SET failed. %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } logging(LOG_VERBOSE, "Send a LUN Reset"); - ret = iscsi_task_mgmt_lun_reset_sync(iscsic, tgt_lun); + ret = iscsi_task_mgmt_lun_reset_sync(sd->iscsi_ctx, sd->iscsi_lun); if (ret != 0) { - logging(LOG_NORMAL, "LUN reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "LUN reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } logging(LOG_VERBOSE, "Send a Warm Reset"); - ret = iscsi_task_mgmt_target_warm_reset_sync(iscsic); + ret = iscsi_task_mgmt_target_warm_reset_sync(sd->iscsi_ctx); if (ret != 0) { - logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "Warm reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } logging(LOG_VERBOSE, "Send a Cold Reset"); - ret = iscsi_task_mgmt_target_cold_reset_sync(iscsic); + ret = iscsi_task_mgmt_target_cold_reset_sync(sd->iscsi_ctx); if (ret != 0) { - logging(LOG_NORMAL, "Cold reset failed. %s", iscsi_get_error(iscsic)); + logging(LOG_NORMAL, "Cold reset failed. %s", iscsi_get_error(sd->iscsi_ctx)); } logging(LOG_VERBOSE, "Disconnect from the target."); - iscsi_destroy_context(iscsic); + iscsi_destroy_context(sd->iscsi_ctx); logging(LOG_VERBOSE, "Sleep for one seconds incase the target is " "slow to reset"); sleep(1); logging(LOG_VERBOSE, "Reconnect to target"); - iscsic = iscsi_context_login(initiatorname1, tgt_url, &tgt_lun); - if (iscsic == NULL) { + sd->iscsi_ctx = iscsi_context_login(initiatorname1, sd->iscsi_url, &sd->iscsi_lun); + if (sd->iscsi_ctx == NULL) { logging(LOG_VERBOSE, "Failed to login to target"); return; } logging(LOG_VERBOSE, "Verify that the SANITIZE is still going."); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Wait until the SANITIZE operation has finished"); - while (testunitready_clear_ua(iscsic, tgt_lun)) { + while (testunitready_clear_ua(sd->iscsi_ctx, sd->iscsi_lun)) { sleep(60); } } diff --git a/test-tool/test_startstopunit_noloej.c b/test-tool/test_startstopunit_noloej.c index efb4869..e311aee 100644 --- a/test-tool/test_startstopunit_noloej.c +++ b/test-tool/test_startstopunit_noloej.c @@ -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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_pwrcnd.c b/test-tool/test_startstopunit_pwrcnd.c index f571ce9..c902591 100644 --- a/test-tool/test_startstopunit_pwrcnd.c +++ b/test-tool/test_startstopunit_pwrcnd.c @@ -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(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); } logging(LOG_VERBOSE, "In case the target did eject the medium, load it again."); - startstopunit(iscsic, tgt_lun, 1, 0, 0, 0, 1, 1, + startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 1, 0, 0, 0, 1, 1, EXPECT_STATUS_GOOD); } diff --git a/test-tool/test_startstopunit_simple.c b/test-tool/test_startstopunit_simple.c index be391fc..dd0f90a 100644 --- a/test-tool/test_startstopunit_simple.c +++ b/test-tool/test_startstopunit_simple.c @@ -41,7 +41,7 @@ test_startstopunit_simple(void) logging(LOG_VERBOSE, "Media is not removable. STARTSTOPUNIT should fail"); } - ret = startstopunit(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); - ret = startstopunit(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can eject removable the media with IMMED==1"); - ret = startstopunit(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_NO_MEDIUM); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test we can load the removable the media with IMMED==1"); - ret = startstopunit(iscsic, tgt_lun, + ret = startstopunit(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_SANITIZE); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_testunitready_simple.c b/test-tool/test_testunitready_simple.c index 443949a..7624d54 100644 --- a/test-tool/test_testunitready_simple.c +++ b/test-tool/test_testunitready_simple.c @@ -30,7 +30,7 @@ test_testunitready_simple(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test TESTUNITREADY"); - ret = testunitready(iscsic, tgt_lun, + ret = testunitready(sd->iscsi_ctx, sd->iscsi_lun, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); } diff --git a/test-tool/test_unmap_0blocks.c b/test-tool/test_unmap_0blocks.c index 400840b..dddee15 100644 --- a/test-tool/test_unmap_0blocks.c +++ b/test-tool/test_unmap_0blocks.c @@ -40,7 +40,7 @@ test_unmap_0blocks(void) for (i = 0; i < 256; i++) { list[0].lba = i; list[0].num = 0; - ret = unmap(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, i, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 256, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 256, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test UNMAP without any descriptors."); - ret = unmap(iscsic, tgt_lun, 0, list, 0, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 0, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_unmap_simple.c b/test-tool/test_unmap_simple.c index 1dfb4e2..c21b88e 100644 --- a/test-tool/test_unmap_simple.c +++ b/test-tool/test_unmap_simple.c @@ -31,7 +31,7 @@ init_lun_with_data(unsigned char *buf, uint64_t lba) int ret; memset(buf, 'a', 256 * block_size); - ret = write10(iscsic, tgt_lun, lba, 256 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Read blocks 0-%d", i); - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, list, i + 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, i + 1, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Read blocks 0-%d", i); - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_unmap_vpd.c b/test-tool/test_unmap_vpd.c index 203e88a..4f11a11 100644 --- a/test-tool/test_unmap_vpd.c +++ b/test-tool/test_unmap_vpd.c @@ -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(iscsic, tgt_lun, 0, list, 1, + ret = unmap(sd->iscsi_ctx, sd->iscsi_lun, 0, list, 1, EXPECT_STATUS_GOOD); if (ret != 0) { logging(LOG_VERBOSE, "UNMAP is not available. Verify that VPD " diff --git a/test-tool/test_verify10_0blocks.c b/test-tool/test_verify10_0blocks.c index 35e950e..5f3a2d8 100644 --- a/test-tool/test_verify10_0blocks.c +++ b/test-tool/test_verify10_0blocks.c @@ -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(iscsic, tgt_lun, 0, 0, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks + 1, 0, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, 0, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, 0, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_beyond_eol.c b/test-tool/test_verify10_beyond_eol.c index 5177b95..73897aa 100644 --- a/test-tool/test_verify10_beyond_eol.c +++ b/test-tool/test_verify10_beyond_eol.c @@ -42,7 +42,7 @@ test_verify10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = verify10(iscsic, tgt_lun, num_blocks + 1 - i, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0x80000000, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, -1, i * block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, -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(iscsic, tgt_lun, num_blocks - 1, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_flags.c b/test-tool/test_verify10_flags.c index bcbe1d8..1cb7600 100644 --- a/test-tool/test_verify10_flags.c +++ b/test-tool/test_verify10_flags.c @@ -34,14 +34,14 @@ test_verify10_flags(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY10 flags"); - ret = read10(iscsic, NULL, tgt_lun, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_mismatch.c b/test-tool/test_verify10_mismatch.c index cd2bca2..a9c95a9 100644 --- a/test-tool/test_verify10_mismatch.c +++ b/test-tool/test_verify10_mismatch.c @@ -40,7 +40,7 @@ test_verify10_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, 0, i * block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 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(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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(iscsic, tgt_lun, num_blocks - i, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_MISCOMPARE); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_mismatch_no_cmp.c b/test-tool/test_verify10_mismatch_no_cmp.c index d3bbb25..3f60ad8 100644 --- a/test-tool/test_verify10_mismatch_no_cmp.c +++ b/test-tool/test_verify10_mismatch_no_cmp.c @@ -40,7 +40,7 @@ test_verify10_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 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_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify10(iscsic, tgt_lun, 0, i * block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -67,7 +67,7 @@ test_verify10_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -76,7 +76,7 @@ test_verify10_mismatch_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify10(iscsic, tgt_lun, num_blocks - i, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_simple.c b/test-tool/test_verify10_simple.c index 7ce8826..6d9c515 100644 --- a/test-tool/test_verify10_simple.c +++ b/test-tool/test_verify10_simple.c @@ -38,12 +38,12 @@ test_verify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify10(iscsic, tgt_lun, 0, i * block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -59,12 +59,12 @@ test_verify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify10(iscsic, tgt_lun, num_blocks - i, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify10_vrprotect.c b/test-tool/test_verify10_vrprotect.c index c1459b5..dc769cb 100644 --- a/test-tool/test_verify10_vrprotect.c +++ b/test-tool/test_verify10_vrprotect.c @@ -40,12 +40,12 @@ test_verify10_vrprotect(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(iscsic, NULL, tgt_lun, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify10(iscsic, tgt_lun, 0, block_size, + ret = verify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 1, buf, EXPECT_INVALID_FIELD_IN_CDB); if (ret == -2) { diff --git a/test-tool/test_verify12_0blocks.c b/test-tool/test_verify12_0blocks.c index 99cb63e..6813d10 100644 --- a/test-tool/test_verify12_0blocks.c +++ b/test-tool/test_verify12_0blocks.c @@ -30,7 +30,7 @@ test_verify12_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 0-blocks at LBA==0"); - ret = verify12(iscsic, tgt_lun, 0, 0, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 1, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -41,21 +41,21 @@ test_verify12_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY12 0-blocks one block past end-of-LUN"); - ret = verify12(iscsic, tgt_lun, num_blocks + 1, 0, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY12 0-blocks at LBA==2^31"); - ret = verify12(iscsic, tgt_lun, 0x80000000, 0, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY12 0-blocks at LBA==-1"); - ret = verify12(iscsic, tgt_lun, -1, 0, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_beyond_eol.c b/test-tool/test_verify12_beyond_eol.c index 1b3c1c8..3d153a9 100644 --- a/test-tool/test_verify12_beyond_eol.c +++ b/test-tool/test_verify12_beyond_eol.c @@ -42,7 +42,7 @@ test_verify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = verify12(iscsic, tgt_lun, num_blocks + 1 - i, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -59,7 +59,7 @@ test_verify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = verify12(iscsic, tgt_lun, 0x80000000, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -71,7 +71,7 @@ test_verify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = verify12(iscsic, tgt_lun, -1, i * block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -83,7 +83,7 @@ test_verify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = verify12(iscsic, tgt_lun, num_blocks - 1, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_flags.c b/test-tool/test_verify12_flags.c index 25f61d7..4b6a76d 100644 --- a/test-tool/test_verify12_flags.c +++ b/test-tool/test_verify12_flags.c @@ -35,14 +35,14 @@ test_verify12_flags(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY12 flags"); - ret = read12(iscsic, tgt_lun, 0, block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY12 with DPO==1"); - ret = verify12(iscsic, tgt_lun, 0, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -54,7 +54,7 @@ test_verify12_flags(void) logging(LOG_VERBOSE, "Test VERIFY12 with BYTCHK==1"); - ret = verify12(iscsic, tgt_lun, 0, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_mismatch.c b/test-tool/test_verify12_mismatch.c index 7de0de8..92ffbbf 100644 --- a/test-tool/test_verify12_mismatch.c +++ b/test-tool/test_verify12_mismatch.c @@ -40,7 +40,7 @@ test_verify12_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, 0, i * block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -48,7 +48,7 @@ test_verify12_mismatch(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify12(iscsic, tgt_lun, 0, i * block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 1, buf, EXPECT_MISCOMPARE); if (ret == -2) { @@ -66,7 +66,7 @@ test_verify12_mismatch(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, num_blocks - i, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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_verify12_mismatch(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify12(iscsic, tgt_lun, num_blocks - i, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_MISCOMPARE); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_mismatch_no_cmp.c b/test-tool/test_verify12_mismatch_no_cmp.c index 70e9f07..e982833 100644 --- a/test-tool/test_verify12_mismatch_no_cmp.c +++ b/test-tool/test_verify12_mismatch_no_cmp.c @@ -40,7 +40,7 @@ test_verify12_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, 0, i * block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -48,7 +48,7 @@ test_verify12_mismatch_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify12(iscsic, tgt_lun, 0, i * block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -66,7 +66,7 @@ test_verify12_mismatch_no_cmp(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, num_blocks - i, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 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_verify12_mismatch_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify12(iscsic, tgt_lun, num_blocks - i, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_simple.c b/test-tool/test_verify12_simple.c index 10132c6..0dd6b81 100644 --- a/test-tool/test_verify12_simple.c +++ b/test-tool/test_verify12_simple.c @@ -38,12 +38,12 @@ test_verify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify12(iscsic, tgt_lun, 0, i * block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -59,12 +59,12 @@ test_verify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read12(iscsic, tgt_lun, num_blocks - i, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify12(iscsic, tgt_lun, num_blocks - i, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify12_vrprotect.c b/test-tool/test_verify12_vrprotect.c index b7130e4..30df81e 100644 --- a/test-tool/test_verify12_vrprotect.c +++ b/test-tool/test_verify12_vrprotect.c @@ -41,10 +41,10 @@ test_verify12_vrprotect(void) logging(LOG_VERBOSE, "Device does not support/use protection information. All commands should fail."); for (i = 1; i < 8; i++) { - ret = read10(iscsic, NULL, tgt_lun, 0, block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); - ret = verify12(iscsic, tgt_lun, 0, block_size, + ret = verify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 1, buf, EXPECT_INVALID_FIELD_IN_CDB); if (ret == -2) { diff --git a/test-tool/test_verify16_0blocks.c b/test-tool/test_verify16_0blocks.c index e6c15f2..15ecb04 100644 --- a/test-tool/test_verify16_0blocks.c +++ b/test-tool/test_verify16_0blocks.c @@ -30,7 +30,7 @@ test_verify16_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==0"); - ret = verify16(iscsic, tgt_lun, 0, 0, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 1, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -41,21 +41,21 @@ test_verify16_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY16 0-blocks one block past end-of-LUN"); - ret = verify16(iscsic, tgt_lun, num_blocks + 1, 0, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==2^63"); - ret = verify16(iscsic, tgt_lun, 0x8000000000000000ULL, 0, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test VERIFY16 0-blocks at LBA==-1"); - ret = verify16(iscsic, tgt_lun, -1, 0, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 1, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify16_beyond_eol.c b/test-tool/test_verify16_beyond_eol.c index 721db41..59aae3c 100644 --- a/test-tool/test_verify16_beyond_eol.c +++ b/test-tool/test_verify16_beyond_eol.c @@ -39,7 +39,7 @@ test_verify16_beyond_eol(void) break; } - ret = verify16(iscsic, tgt_lun, num_blocks + 1 - i, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -57,7 +57,7 @@ test_verify16_beyond_eol(void) break; } - ret = verify16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -70,7 +70,7 @@ test_verify16_beyond_eol(void) break; } - ret = verify16(iscsic, tgt_lun, -1, i * block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -83,7 +83,7 @@ test_verify16_beyond_eol(void) break; } - ret = verify16(iscsic, tgt_lun, num_blocks - 1, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 1, buf, EXPECT_LBA_OOB); diff --git a/test-tool/test_verify16_flags.c b/test-tool/test_verify16_flags.c index 7091633..4ebfa18 100644 --- a/test-tool/test_verify16_flags.c +++ b/test-tool/test_verify16_flags.c @@ -35,12 +35,12 @@ test_verify16_flags(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test VERIFY16 flags"); - ret = read16(iscsic, tgt_lun, 0, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Test VERIFY16 with DPO==1"); - ret = verify16(iscsic, tgt_lun, 0, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -52,7 +52,7 @@ test_verify16_flags(void) logging(LOG_VERBOSE, "Test VERIFY16 with BYTCHK==1"); - ret = verify16(iscsic, tgt_lun, 0, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify16_mismatch.c b/test-tool/test_verify16_mismatch.c index c15d0be..d8d31e9 100644 --- a/test-tool/test_verify16_mismatch.c +++ b/test-tool/test_verify16_mismatch.c @@ -41,7 +41,7 @@ test_verify16_mismatch(void) break; } - ret = read16(iscsic, tgt_lun, 0, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -49,7 +49,7 @@ test_verify16_mismatch(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify16(iscsic, tgt_lun, 0, i * block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 1, buf, EXPECT_MISCOMPARE); if (ret == -2) { @@ -68,7 +68,7 @@ test_verify16_mismatch(void) break; } - ret = read16(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -77,7 +77,7 @@ test_verify16_mismatch(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify16(iscsic, tgt_lun, num_blocks - i, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_MISCOMPARE); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify16_mismatch_no_cmp.c b/test-tool/test_verify16_mismatch_no_cmp.c index ee3268e..3ad82cb 100644 --- a/test-tool/test_verify16_mismatch_no_cmp.c +++ b/test-tool/test_verify16_mismatch_no_cmp.c @@ -41,7 +41,7 @@ test_verify16_mismatch_no_cmp(void) break; } - ret = read16(iscsic, tgt_lun, 0, i * block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -49,7 +49,7 @@ test_verify16_mismatch_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify16(iscsic, tgt_lun, 0, i * block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -68,7 +68,7 @@ test_verify16_mismatch_no_cmp(void) break; } - ret = read16(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -77,7 +77,7 @@ test_verify16_mismatch_no_cmp(void) buf[offset] ^= 'X'; logging(LOG_VERBOSE, "Flip some bits in the data"); - ret = verify16(iscsic, tgt_lun, num_blocks - i, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify16_simple.c b/test-tool/test_verify16_simple.c index 542fb5a..6389782 100644 --- a/test-tool/test_verify16_simple.c +++ b/test-tool/test_verify16_simple.c @@ -38,10 +38,10 @@ test_verify16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = read10(iscsic, NULL, tgt_lun, 0, i * block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); - ret = verify16(iscsic, tgt_lun, 0, i * block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -58,12 +58,12 @@ test_verify16_simple(void) break; } - ret = read16(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); - ret = verify16(iscsic, tgt_lun, num_blocks - i, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 1, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_verify16_vrprotect.c b/test-tool/test_verify16_vrprotect.c index f4ff94a..1f91be3 100644 --- a/test-tool/test_verify16_vrprotect.c +++ b/test-tool/test_verify16_vrprotect.c @@ -41,10 +41,10 @@ test_verify16_vrprotect(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(iscsic, tgt_lun, 0, block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); - ret = verify16(iscsic, tgt_lun, 0, block_size, + ret = verify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 1, buf, EXPECT_INVALID_FIELD_IN_CDB); if (ret == -2) { diff --git a/test-tool/test_write10_0blocks.c b/test-tool/test_write10_0blocks.c index 351b904..8621841 100644 --- a/test-tool/test_write10_0blocks.c +++ b/test-tool/test_write10_0blocks.c @@ -32,7 +32,7 @@ test_write10_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==0"); - ret = write10(iscsic, tgt_lun, 0, 0, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -48,21 +48,21 @@ test_write10_0blocks(void) } logging(LOG_VERBOSE, "Test WRITE10 0-blocks one block past end-of-LUN"); - ret = write10(iscsic, tgt_lun, num_blocks + 1, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==2^31"); - ret = write10(iscsic, tgt_lun, 0x80000000, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE10 0-blocks at LBA==-1"); - ret = write10(iscsic, tgt_lun, -1, 0, block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write10_beyond_eol.c b/test-tool/test_write10_beyond_eol.c index ffc6fe2..52f74e4 100644 --- a/test-tool/test_write10_beyond_eol.c +++ b/test-tool/test_write10_beyond_eol.c @@ -44,7 +44,7 @@ test_write10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, num_blocks + 1 - i, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -61,7 +61,7 @@ test_write10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, 0x80000000, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -73,7 +73,7 @@ test_write10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, -1, i * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -85,7 +85,7 @@ test_write10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, num_blocks - 1, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write10_flags.c b/test-tool/test_write10_flags.c index 8faed5f..9961116 100644 --- a/test-tool/test_write10_flags.c +++ b/test-tool/test_write10_flags.c @@ -38,7 +38,7 @@ test_write10_flags(void) logging(LOG_VERBOSE, "Test WRITE10 flags"); logging(LOG_VERBOSE, "Test WRITE10 with DPO==1"); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -50,28 +50,28 @@ test_write10_flags(void) logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==0"); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE10 with FUA==1 FUA_NV==1"); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE10 with FUA==0 FUA_NV==1"); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE10 with DPO==1 FUA==1 FUA_NV==1"); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write10_residuals.c b/test-tool/test_write10_residuals.c index 9963a1a..a2e27f6 100644 --- a/test-tool/test_write10_residuals.c +++ b/test-tool/test_write10_residuals.c @@ -58,11 +58,11 @@ test_write10_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -76,7 +76,7 @@ test_write10_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -99,7 +99,7 @@ test_write10_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -115,13 +115,13 @@ test_write10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -157,7 +157,7 @@ test_write10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); @@ -167,7 +167,7 @@ test_write10_residuals(void) && task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_FIELD_IN_INFORMATION_UNIT)) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_ASSERT(0); } @@ -206,13 +206,13 @@ test_write10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -241,7 +241,7 @@ test_write10_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write10(iscsic, tgt_lun, 0, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -261,13 +261,13 @@ test_write10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -289,7 +289,7 @@ test_write10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(iscsic, NULL, tgt_lun, 0, 2* block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -317,7 +317,7 @@ test_write10_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write10(iscsic, tgt_lun, 0, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -337,13 +337,13 @@ test_write10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -365,7 +365,7 @@ test_write10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(iscsic, NULL, tgt_lun, 0, 2* block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write10_simple.c b/test-tool/test_write10_simple.c index abe60a4..74f21ab 100644 --- a/test-tool/test_write10_simple.c +++ b/test-tool/test_write10_simple.c @@ -42,7 +42,7 @@ test_write10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, 0, i * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -58,7 +58,7 @@ test_write10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write10(iscsic, tgt_lun, num_blocks - i, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write10_wrprotect.c b/test-tool/test_write10_wrprotect.c index 451de15..acd4bc5 100644 --- a/test-tool/test_write10_wrprotect.c +++ b/test-tool/test_write10_wrprotect.c @@ -44,7 +44,7 @@ test_write10_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 = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_write12_0blocks.c b/test-tool/test_write12_0blocks.c index fe13249..81f9765 100644 --- a/test-tool/test_write12_0blocks.c +++ b/test-tool/test_write12_0blocks.c @@ -37,7 +37,7 @@ test_write12_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==0"); - ret = write12(iscsic, tgt_lun, 0, 0, block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -48,21 +48,21 @@ test_write12_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 0-blocks one block past end-of-LUN"); - ret = write12(iscsic, tgt_lun, num_blocks + 1, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==2^31"); - ret = write12(iscsic, tgt_lun, 0x80000000, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 0-blocks at LBA==-1"); - ret = write12(iscsic, tgt_lun, -1, 0, block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write12_beyond_eol.c b/test-tool/test_write12_beyond_eol.c index 1da9c08..ceb8c8d 100644 --- a/test-tool/test_write12_beyond_eol.c +++ b/test-tool/test_write12_beyond_eol.c @@ -44,7 +44,7 @@ test_write12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, num_blocks + 1 - i, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -61,7 +61,7 @@ test_write12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, 0x80000000, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -73,7 +73,7 @@ test_write12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, -1, i * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -85,7 +85,7 @@ test_write12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, num_blocks - 1, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write12_flags.c b/test-tool/test_write12_flags.c index d68947a..c610707 100644 --- a/test-tool/test_write12_flags.c +++ b/test-tool/test_write12_flags.c @@ -38,7 +38,7 @@ test_write12_flags(void) logging(LOG_VERBOSE, "Test WRITE12 flags"); logging(LOG_VERBOSE, "Test WRITE12 with DPO==1"); - ret = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -50,28 +50,28 @@ test_write12_flags(void) logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==0"); - ret = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 with FUA==1 FUA_NV==1"); - ret = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 with FUA==0 FUA_NV==1"); - ret = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE12 with DPO==1 FUA==1 FUA_NV==1"); - ret = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write12_residuals.c b/test-tool/test_write12_residuals.c index c56f406..0551bc6 100644 --- a/test-tool/test_write12_residuals.c +++ b/test-tool/test_write12_residuals.c @@ -58,11 +58,11 @@ test_write12_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -76,7 +76,7 @@ test_write12_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -99,7 +99,7 @@ test_write12_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -115,13 +115,13 @@ test_write12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -157,7 +157,7 @@ test_write12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); @@ -168,7 +168,7 @@ test_write12_residuals(void) SCSI_SENSE_ASCQ_INVALID_FIELD_IN_INFORMATION_UNIT)) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); CU_ASSERT(0); } @@ -207,13 +207,13 @@ test_write12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -241,7 +241,7 @@ test_write12_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write12(iscsic, tgt_lun, 0, 2 * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -261,13 +261,13 @@ test_write12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -289,7 +289,7 @@ test_write12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(iscsic, tgt_lun, 0, 2* block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -317,7 +317,7 @@ test_write12_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write12(iscsic, tgt_lun, 0, 2 * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -337,13 +337,13 @@ test_write12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -365,7 +365,7 @@ test_write12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(iscsic, tgt_lun, 0, 2* block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write12_simple.c b/test-tool/test_write12_simple.c index 266c134..6e4b5ec 100644 --- a/test-tool/test_write12_simple.c +++ b/test-tool/test_write12_simple.c @@ -41,7 +41,7 @@ test_write12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, 0, i * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -57,7 +57,7 @@ test_write12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write12(iscsic, tgt_lun, num_blocks - i, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write12_wrprotect.c b/test-tool/test_write12_wrprotect.c index 7422dad..dc573ba 100644 --- a/test-tool/test_write12_wrprotect.c +++ b/test-tool/test_write12_wrprotect.c @@ -45,7 +45,7 @@ test_write12_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 = write12(iscsic, tgt_lun, 0, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_write16_0blocks.c b/test-tool/test_write16_0blocks.c index 2b60a6a..dd8b9c5 100644 --- a/test-tool/test_write16_0blocks.c +++ b/test-tool/test_write16_0blocks.c @@ -33,7 +33,7 @@ test_write16_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==0"); - ret = write16(iscsic, tgt_lun, 0, 0, block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -44,21 +44,21 @@ test_write16_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 0-blocks one block past end-of-LUN"); - ret = write16(iscsic, tgt_lun, num_blocks + 1, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==2^63"); - ret = write16(iscsic, tgt_lun, 0x8000000000000000ULL, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 0-blocks at LBA==-1"); - ret = write16(iscsic, tgt_lun, -1, 0, block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_beyond_eol.c b/test-tool/test_write16_beyond_eol.c index 6caa71e..78ba03c 100644 --- a/test-tool/test_write16_beyond_eol.c +++ b/test-tool/test_write16_beyond_eol.c @@ -42,7 +42,7 @@ test_write16_beyond_eol(void) break; } - ret = write16(iscsic, tgt_lun, num_blocks + 1 - i, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -59,7 +59,7 @@ test_write16_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -71,7 +71,7 @@ test_write16_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, -1, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -83,7 +83,7 @@ test_write16_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, num_blocks - 1, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_flags.c b/test-tool/test_write16_flags.c index b7c09c6..16f2bfe 100644 --- a/test-tool/test_write16_flags.c +++ b/test-tool/test_write16_flags.c @@ -39,7 +39,7 @@ test_write16_flags(void) logging(LOG_VERBOSE, "Test WRITE16 flags"); logging(LOG_VERBOSE, "Test WRITE16 with DPO==1"); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -51,28 +51,28 @@ test_write16_flags(void) logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==0"); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 with FUA==1 FUA_NV==1"); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 with FUA==0 FUA_NV==1"); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITE16 with DPO==1 FUA==1 FUA_NV==1"); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 1, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_residuals.c b/test-tool/test_write16_residuals.c index cde543e..ae6bfbc 100644 --- a/test-tool/test_write16_residuals.c +++ b/test-tool/test_write16_residuals.c @@ -58,11 +58,11 @@ test_write16_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -76,7 +76,7 @@ test_write16_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -99,7 +99,7 @@ test_write16_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -115,13 +115,13 @@ test_write16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -157,13 +157,13 @@ test_write16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -202,13 +202,13 @@ test_write16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -236,7 +236,7 @@ test_write16_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write16(iscsic, tgt_lun, 0, 2 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -256,13 +256,13 @@ test_write16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -284,7 +284,7 @@ test_write16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(iscsic, tgt_lun, 0, 2* block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -312,7 +312,7 @@ test_write16_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write16(iscsic, tgt_lun, 0, 2 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -332,13 +332,13 @@ test_write16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -360,7 +360,7 @@ test_write16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(iscsic, tgt_lun, 0, 2* block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_simple.c b/test-tool/test_write16_simple.c index 9504ab4..3e1de5a 100644 --- a/test-tool/test_write16_simple.c +++ b/test-tool/test_write16_simple.c @@ -43,7 +43,7 @@ test_write16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, 0, i * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -59,7 +59,7 @@ test_write16_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = write16(iscsic, tgt_lun, num_blocks - i, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_write16_wrprotect.c b/test-tool/test_write16_wrprotect.c index 27c745d..778ff10 100644 --- a/test-tool/test_write16_wrprotect.c +++ b/test-tool/test_write16_wrprotect.c @@ -44,7 +44,7 @@ test_write16_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 = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_writesame10_0blocks.c b/test-tool/test_writesame10_0blocks.c index a64815a..6151faf 100644 --- a/test-tool/test_writesame10_0blocks.c +++ b/test-tool/test_writesame10_0blocks.c @@ -40,7 +40,7 @@ test_writesame10_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==0 (WSNZ=%d)", inq_bl->wsnz); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -59,21 +59,21 @@ test_writesame10_0blocks(void) } logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks one block past end-of-LUN"); - ret = writesame10(iscsic, tgt_lun, num_blocks + 1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==2^31"); - ret = writesame10(iscsic, tgt_lun, 0x80000000, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITESAME10 0-blocks at LBA==-1"); - ret = writesame10(iscsic, tgt_lun, -1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, -1, block_size, 0, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame10_beyond_eol.c b/test-tool/test_writesame10_beyond_eol.c index ae415a8..ce53a6c 100644 --- a/test-tool/test_writesame10_beyond_eol.c +++ b/test-tool/test_writesame10_beyond_eol.c @@ -43,7 +43,7 @@ test_writesame10_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks one block beyond the end"); memset(buf, 0, block_size); for (i = 1; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, num_blocks - i + 1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i + 1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -56,7 +56,7 @@ test_writesame10_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks at LBA==2^31"); for (i = 1; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, 0x80000000, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -65,7 +65,7 @@ test_writesame10_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME10 1-256 blocks at LBA==-1"); for (i = 1; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, -1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, -1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -74,7 +74,7 @@ test_writesame10_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME10 2-256 blocks all but one block beyond the end"); for (i = 2; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, num_blocks - 1, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame10_simple.c b/test-tool/test_writesame10_simple.c index 460ac34..36b197a 100644 --- a/test-tool/test_writesame10_simple.c +++ b/test-tool/test_writesame10_simple.c @@ -40,7 +40,7 @@ test_writesame10_simple(void) memset(buf, 0, block_size); for (i = 1; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -52,7 +52,7 @@ test_writesame10_simple(void) logging(LOG_VERBOSE, "Test WRITESAME10 of 1-256 blocks at the end of the LUN"); for (i = 1; i <= 256; i++) { - ret = writesame10(iscsic, tgt_lun, num_blocks - i, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, block_size, i, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame10_unmap.c b/test-tool/test_writesame10_unmap.c index ebb9369..d33a66f 100644 --- a/test-tool/test_writesame10_unmap.c +++ b/test-tool/test_writesame10_unmap.c @@ -44,14 +44,14 @@ test_writesame10_unmap(void) for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i); memset(buf, 0, block_size); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -62,7 +62,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read10(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -83,14 +83,14 @@ test_writesame10_unmap(void) for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write10(iscsic, tgt_lun, num_blocks - i, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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, "Unmap %d blocks using WRITESAME10", i); memset(buf, 0, block_size); - ret = writesame10(iscsic, tgt_lun, num_blocks - i, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -101,7 +101,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read10(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -118,7 +118,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Verify that WRITESAME10 ANCHOR==1 + UNMAP==0 is " "invalid"); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); @@ -128,13 +128,13 @@ test_writesame10_unmap(void) if (inq_lbp->anc_sup) { logging(LOG_VERBOSE, "Test WRITESAME10 ANCHOR==1 + UNMAP==0"); memset(buf, 0, block_size); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 1, 0, 0, buf, EXPECT_STATUS_GOOD); } else { logging(LOG_VERBOSE, "Test WRITESAME10 ANCHOR==1 + UNMAP==0 no " "ANC_SUP so expecting to fail"); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 1, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); } @@ -159,14 +159,14 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write10(iscsic, tgt_lun, 0, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i); memset(buf, 0, block_size); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -177,7 +177,7 @@ test_writesame10_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read10(iscsic, NULL, tgt_lun, 0, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -196,7 +196,7 @@ test_writesame10_unmap(void) "INVALID_FIELD_IN_CDB."); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10", i); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame10_unmap_unaligned.c b/test-tool/test_writesame10_unmap_unaligned.c index 9936751..9147f27 100644 --- a/test-tool/test_writesame10_unmap_unaligned.c +++ b/test-tool/test_writesame10_unmap_unaligned.c @@ -41,7 +41,7 @@ test_writesame10_unmap_unaligned(void) logging(LOG_VERBOSE, "Test that unaligned WRITESAME10 Unmap succeeds. LBPPB==%d", lbppb); for (i = 1; i < lbppb; i++) { logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME10 at LBA:%d", lbppb - i, i); - ret = writesame10(iscsic, tgt_lun, i, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, i, block_size, lbppb - i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame10_unmap_until_end.c b/test-tool/test_writesame10_unmap_until_end.c index 2a4a805..05dffa3 100644 --- a/test-tool/test_writesame10_unmap_until_end.c +++ b/test-tool/test_writesame10_unmap_until_end.c @@ -47,13 +47,13 @@ test_writesame10_unmap_until_end(void) logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, block_size * i); - ret = write10(iscsic, tgt_lun, num_blocks - i, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 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, "Unmap %d blocks using WRITESAME10", i); - ret = writesame10(iscsic, tgt_lun, num_blocks - i, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -64,7 +64,7 @@ test_writesame10_unmap_until_end(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read10(iscsic, NULL, tgt_lun, num_blocks - i, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writesame10_unmap_vpd.c b/test-tool/test_writesame10_unmap_vpd.c index 01eb714..aece9d6 100644 --- a/test-tool/test_writesame10_unmap_vpd.c +++ b/test-tool/test_writesame10_unmap_vpd.c @@ -42,7 +42,7 @@ test_writesame10_unmap_vpd(void) logging(LOG_VERBOSE, "Check if WRITESAME10 can be used for UNMAP."); logging(LOG_VERBOSE, "Unmap 1 block using WRITESAME10"); memset(buf, 0, block_size); - ret = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret != 0) { diff --git a/test-tool/test_writesame10_wrprotect.c b/test-tool/test_writesame10_wrprotect.c index 6f0f5d8..c6f1a91 100644 --- a/test-tool/test_writesame10_wrprotect.c +++ b/test-tool/test_writesame10_wrprotect.c @@ -45,7 +45,7 @@ test_writesame10_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 = writesame10(iscsic, tgt_lun, 0, + ret = writesame10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 0, 0, i, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); if (ret == -2) { diff --git a/test-tool/test_writesame16_0blocks.c b/test-tool/test_writesame16_0blocks.c index 16e46ab..b547c9e 100644 --- a/test-tool/test_writesame16_0blocks.c +++ b/test-tool/test_writesame16_0blocks.c @@ -34,7 +34,7 @@ test_writesame16_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==0 (WSNZ=%d)", inq_bl->wsnz); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 0, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -54,21 +54,21 @@ test_writesame16_0blocks(void) } logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks one block past end-of-LUN"); - ret = writesame16(iscsic, tgt_lun, num_blocks + 1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, block_size, inq_bl->wsnz, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==2^63"); - ret = writesame16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, block_size, inq_bl->wsnz, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITESAME16 0-blocks at LBA==-1"); - ret = writesame16(iscsic, tgt_lun, -1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, -1, block_size, inq_bl->wsnz, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame16_beyond_eol.c b/test-tool/test_writesame16_beyond_eol.c index bfe445e..12ea43a 100644 --- a/test-tool/test_writesame16_beyond_eol.c +++ b/test-tool/test_writesame16_beyond_eol.c @@ -38,7 +38,7 @@ test_writesame16_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME16 1-256 blocks one block beyond the end"); memset(buf, 0, block_size); for (i = 1; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, num_blocks - i + 1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i + 1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -52,7 +52,7 @@ test_writesame16_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME16 1-256 blocks at LBA==2^63"); for (i = 1; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -61,7 +61,7 @@ test_writesame16_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME16 1-256 blocks at LBA==-1"); for (i = 1; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, -1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, -1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -70,7 +70,7 @@ test_writesame16_beyond_eol(void) logging(LOG_VERBOSE, "Test WRITESAME16 2-256 blocks all but one block beyond the end"); for (i = 2; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, num_blocks - 1, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, block_size, i, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame16_simple.c b/test-tool/test_writesame16_simple.c index 3eba474..3ec0bd1 100644 --- a/test-tool/test_writesame16_simple.c +++ b/test-tool/test_writesame16_simple.c @@ -40,7 +40,7 @@ test_writesame16_simple(void) memset(buf, 0, block_size); for (i = 1; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -53,7 +53,7 @@ test_writesame16_simple(void) logging(LOG_VERBOSE, "Test WRITESAME16 of 1-256 blocks at the end of the LUN"); for (i = 1; i <= 256; i++) { - ret = writesame16(iscsic, tgt_lun, num_blocks - i, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, block_size, i, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 1668402..02e2ddb 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -46,12 +46,12 @@ test_writesame16_unmap(void) for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -66,7 +66,7 @@ test_writesame16_unmap(void) "blocks back and verify they are all zero"); logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read16(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -84,14 +84,14 @@ test_writesame16_unmap(void) for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write16(iscsic, tgt_lun, num_blocks - i, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 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, "Unmap %d blocks using WRITESAME16", i); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, num_blocks - i, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -101,7 +101,7 @@ test_writesame16_unmap(void) "blocks back and verify they are all zero"); logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read16(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -115,7 +115,7 @@ test_writesame16_unmap(void) } logging(LOG_VERBOSE, "Verify that WRITESAME16 ANCHOR==1 + UNMAP==0 is invalid"); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); @@ -125,12 +125,12 @@ test_writesame16_unmap(void) if (inq_lbp->anc_sup) { logging(LOG_VERBOSE, "Test WRITESAME16 ANCHOR==1 + UNMAP==0"); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 1, 0, 0, buf, EXPECT_STATUS_GOOD); } else { logging(LOG_VERBOSE, "Test WRITESAME16 ANCHOR==1 + UNMAP==0 no ANC_SUP so expecting to fail"); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 1, 1, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); } @@ -156,14 +156,14 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -174,7 +174,7 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read16(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -191,7 +191,7 @@ test_writesame16_unmap(void) "INVALID_FIELD_IN_CDB."); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); @@ -208,14 +208,14 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, i * block_size); - ret = write16(iscsic, tgt_lun, 0, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -226,7 +226,7 @@ test_writesame16_unmap(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read16(iscsic, tgt_lun, 0, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); @@ -243,7 +243,7 @@ test_writesame16_unmap(void) "INVALID_FIELD_IN_CDB."); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, i, 0, 1, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writesame16_unmap_unaligned.c b/test-tool/test_writesame16_unmap_unaligned.c index 8696fe3..7e53a47 100644 --- a/test-tool/test_writesame16_unmap_unaligned.c +++ b/test-tool/test_writesame16_unmap_unaligned.c @@ -41,7 +41,7 @@ test_writesame16_unmap_unaligned(void) for (i = 1; i < lbppb; i++) { logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16 at LBA:%d", lbppb - i, i); - ret = writesame16(iscsic, tgt_lun, i, 0, lbppb - i, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, i, 0, lbppb - i, 0, 1, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { diff --git a/test-tool/test_writesame16_unmap_until_end.c b/test-tool/test_writesame16_unmap_until_end.c index 3df8365..c9db6e9 100644 --- a/test-tool/test_writesame16_unmap_until_end.c +++ b/test-tool/test_writesame16_unmap_until_end.c @@ -47,11 +47,11 @@ test_writesame16_unmap_until_end(void) for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); memset(buf, 0xff, block_size * i); - ret = write16(iscsic, tgt_lun, num_blocks - i, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); logging(LOG_VERBOSE, "Unmap %d blocks using WRITESAME16", i); - ret = writesame16(iscsic, tgt_lun, num_blocks - i, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, 0, i, 0, 1, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -67,7 +67,7 @@ test_writesame16_unmap_until_end(void) logging(LOG_VERBOSE, "Read %d blocks and verify they " "are now zero", i); - ret = read16(iscsic, tgt_lun, num_blocks - i, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); diff --git a/test-tool/test_writesame16_unmap_vpd.c b/test-tool/test_writesame16_unmap_vpd.c index 90a533d..c6f1108 100644 --- a/test-tool/test_writesame16_unmap_vpd.c +++ b/test-tool/test_writesame16_unmap_vpd.c @@ -43,7 +43,7 @@ test_writesame16_unmap_vpd(void) logging(LOG_VERBOSE, "Unmap 1 block using WRITESAME16"); memset(buf, 0, block_size); - ret = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret != 0) { diff --git a/test-tool/test_writesame16_wrprotect.c b/test-tool/test_writesame16_wrprotect.c index 55c3b7e..dd38a4d 100644 --- a/test-tool/test_writesame16_wrprotect.c +++ b/test-tool/test_writesame16_wrprotect.c @@ -45,7 +45,7 @@ test_writesame16_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 = writesame16(iscsic, tgt_lun, 0, + ret = writesame16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, 1, 0, 0, i, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); if (ret == -2) { diff --git a/test-tool/test_writeverify10_0blocks.c b/test-tool/test_writeverify10_0blocks.c index 93e98b2..7ee7d46 100644 --- a/test-tool/test_writeverify10_0blocks.c +++ b/test-tool/test_writeverify10_0blocks.c @@ -37,7 +37,7 @@ test_writeverify10_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==0"); - ret = writeverify10(iscsic, tgt_lun, 0, 0, block_size, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -48,21 +48,21 @@ test_writeverify10_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks one block past end-of-LUN"); - ret = writeverify10(iscsic, tgt_lun, num_blocks + 1, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==2^31"); - ret = writeverify10(iscsic, tgt_lun, 0x80000000, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY10 0-blocks at LBA==-1"); - ret = writeverify10(iscsic, tgt_lun, -1, 0, block_size, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify10_beyond_eol.c b/test-tool/test_writeverify10_beyond_eol.c index 0106796..705124d 100644 --- a/test-tool/test_writeverify10_beyond_eol.c +++ b/test-tool/test_writeverify10_beyond_eol.c @@ -44,7 +44,7 @@ test_writeverify10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, num_blocks + 1 - i, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -61,7 +61,7 @@ test_writeverify10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, 0x80000000, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -73,7 +73,7 @@ test_writeverify10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, -1, i * block_size, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -85,7 +85,7 @@ test_writeverify10_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, num_blocks - 1, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify10_flags.c b/test-tool/test_writeverify10_flags.c index 6995887..2cf59be 100644 --- a/test-tool/test_writeverify10_flags.c +++ b/test-tool/test_writeverify10_flags.c @@ -38,7 +38,7 @@ test_writeverify10_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY10 flags"); logging(LOG_VERBOSE, "Test WRITEVERIFY10 with DPO==1"); - ret = writeverify10(iscsic, tgt_lun, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -49,7 +49,7 @@ test_writeverify10_flags(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY10 with BYTCHK==1"); - ret = writeverify10(iscsic, tgt_lun, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify10_residuals.c b/test-tool/test_writeverify10_residuals.c index 0462105..79b6d73 100644 --- a/test-tool/test_writeverify10_residuals.c +++ b/test-tool/test_writeverify10_residuals.c @@ -44,7 +44,7 @@ test_writeverify10_residuals(void) CHECK_FOR_SBC; /* check if writeverify10 is supported */ - ret = writeverify10(iscsic, tgt_lun, 0, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -67,11 +67,11 @@ test_writeverify10_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -85,7 +85,7 @@ test_writeverify10_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -108,7 +108,7 @@ test_writeverify10_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -124,13 +124,13 @@ test_writeverify10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -166,13 +166,13 @@ test_writeverify10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -211,13 +211,13 @@ test_writeverify10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -246,7 +246,7 @@ test_writeverify10_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write10(iscsic, tgt_lun, 0, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -266,13 +266,13 @@ test_writeverify10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -294,7 +294,7 @@ test_writeverify10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(iscsic, NULL, tgt_lun, 0, 2* block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -322,7 +322,7 @@ test_writeverify10_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write10(iscsic, tgt_lun, 0, 2 * block_size, + ret = write10(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -342,13 +342,13 @@ test_writeverify10_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -370,7 +370,7 @@ test_writeverify10_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read10(iscsic, NULL, tgt_lun, 0, 2* block_size, + ret = read10(sd->iscsi_ctx, NULL, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify10_simple.c b/test-tool/test_writeverify10_simple.c index ccf3cba..d59446d 100644 --- a/test-tool/test_writeverify10_simple.c +++ b/test-tool/test_writeverify10_simple.c @@ -41,7 +41,7 @@ test_writeverify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, 0, i * block_size, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -57,7 +57,7 @@ test_writeverify10_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify10(iscsic, tgt_lun, num_blocks - i, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify10_wrprotect.c b/test-tool/test_writeverify10_wrprotect.c index 8e3c738..efb1cc7 100644 --- a/test-tool/test_writeverify10_wrprotect.c +++ b/test-tool/test_writeverify10_wrprotect.c @@ -44,7 +44,7 @@ test_writeverify10_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 = writeverify10(iscsic, tgt_lun, 0, + ret = writeverify10(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_writeverify12_0blocks.c b/test-tool/test_writeverify12_0blocks.c index 0564408..893f641 100644 --- a/test-tool/test_writeverify12_0blocks.c +++ b/test-tool/test_writeverify12_0blocks.c @@ -37,7 +37,7 @@ test_writeverify12_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==0"); - ret = writeverify12(iscsic, tgt_lun, 0, 0, block_size, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -48,21 +48,21 @@ test_writeverify12_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks one block past end-of-LUN"); - ret = writeverify12(iscsic, tgt_lun, num_blocks + 1, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==2^31"); - ret = writeverify12(iscsic, tgt_lun, 0x80000000, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY12 0-blocks at LBA==-1"); - ret = writeverify12(iscsic, tgt_lun, -1, 0, block_size, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify12_beyond_eol.c b/test-tool/test_writeverify12_beyond_eol.c index 69d1e46..be503fd 100644 --- a/test-tool/test_writeverify12_beyond_eol.c +++ b/test-tool/test_writeverify12_beyond_eol.c @@ -44,7 +44,7 @@ test_writeverify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, num_blocks + 1 - i, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -61,7 +61,7 @@ test_writeverify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, 0x80000000, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0x80000000, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -73,7 +73,7 @@ test_writeverify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, -1, i * block_size, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -85,7 +85,7 @@ test_writeverify12_beyond_eol(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, num_blocks - 1, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify12_flags.c b/test-tool/test_writeverify12_flags.c index cf8b08a..13a2abc 100644 --- a/test-tool/test_writeverify12_flags.c +++ b/test-tool/test_writeverify12_flags.c @@ -38,7 +38,7 @@ test_writeverify12_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY12 flags"); logging(LOG_VERBOSE, "Test WRITEVERIFY12 with DPO==1"); - ret = writeverify12(iscsic, tgt_lun, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -49,7 +49,7 @@ test_writeverify12_flags(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY12 with BYTCHK==1"); - ret = writeverify12(iscsic, tgt_lun, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify12_residuals.c b/test-tool/test_writeverify12_residuals.c index f8f174b..4285dea 100644 --- a/test-tool/test_writeverify12_residuals.c +++ b/test-tool/test_writeverify12_residuals.c @@ -44,7 +44,7 @@ test_writeverify12_residuals(void) CHECK_FOR_SBC; /* check if writeverify12 is supported */ - ret = writeverify12(iscsic, tgt_lun, 0, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -67,11 +67,11 @@ test_writeverify12_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -85,7 +85,7 @@ test_writeverify12_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -108,7 +108,7 @@ test_writeverify12_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -124,13 +124,13 @@ test_writeverify12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -166,13 +166,13 @@ test_writeverify12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -211,13 +211,13 @@ test_writeverify12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -246,7 +246,7 @@ test_writeverify12_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write12(iscsic, tgt_lun, 0, 2 * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -266,13 +266,13 @@ test_writeverify12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -294,7 +294,7 @@ test_writeverify12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(iscsic, tgt_lun, 0, 2* block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -322,7 +322,7 @@ test_writeverify12_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write12(iscsic, tgt_lun, 0, 2 * block_size, + ret = write12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -342,13 +342,13 @@ test_writeverify12_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -370,7 +370,7 @@ test_writeverify12_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read12(iscsic, tgt_lun, 0, 2* block_size, + ret = read12(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify12_simple.c b/test-tool/test_writeverify12_simple.c index 38f853b..57e14e1 100644 --- a/test-tool/test_writeverify12_simple.c +++ b/test-tool/test_writeverify12_simple.c @@ -41,7 +41,7 @@ test_writeverify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, 0, i * block_size, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -57,7 +57,7 @@ test_writeverify12_simple(void) if (maximum_transfer_length && maximum_transfer_length < i) { break; } - ret = writeverify12(iscsic, tgt_lun, num_blocks - i, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify12_wrprotect.c b/test-tool/test_writeverify12_wrprotect.c index 56717ca..0e00407 100644 --- a/test-tool/test_writeverify12_wrprotect.c +++ b/test-tool/test_writeverify12_wrprotect.c @@ -44,7 +44,7 @@ test_writeverify12_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 = writeverify12(iscsic, tgt_lun, 0, + ret = writeverify12(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB); diff --git a/test-tool/test_writeverify16_0blocks.c b/test-tool/test_writeverify16_0blocks.c index 621f110..c00a623 100644 --- a/test-tool/test_writeverify16_0blocks.c +++ b/test-tool/test_writeverify16_0blocks.c @@ -33,7 +33,7 @@ test_writeverify16_0blocks(void) logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==0"); - ret = writeverify16(iscsic, tgt_lun, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -44,21 +44,21 @@ test_writeverify16_0blocks(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks one block past end-of-LUN"); - ret = writeverify16(iscsic, tgt_lun, num_blocks + 1, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==2^63"); - ret = writeverify16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY16 0-blocks at LBA==-1"); - ret = writeverify16(iscsic, tgt_lun, -1, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, -1, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify16_beyond_eol.c b/test-tool/test_writeverify16_beyond_eol.c index e6221c4..4ee704f 100644 --- a/test-tool/test_writeverify16_beyond_eol.c +++ b/test-tool/test_writeverify16_beyond_eol.c @@ -41,7 +41,7 @@ test_writeverify16_beyond_eol(void) break; } - ret = writeverify16(iscsic, tgt_lun, num_blocks + 1 - i, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks + 1 - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); if (ret == -2) { @@ -59,7 +59,7 @@ test_writeverify16_beyond_eol(void) break; } - ret = writeverify16(iscsic, tgt_lun, 0x8000000000000000ULL, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0x8000000000000000ULL, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -72,7 +72,7 @@ test_writeverify16_beyond_eol(void) break; } - ret = writeverify16(iscsic, tgt_lun, -1, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, -1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); @@ -85,7 +85,7 @@ test_writeverify16_beyond_eol(void) break; } - ret = writeverify16(iscsic, tgt_lun, num_blocks - 1, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - 1, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_LBA_OOB); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify16_flags.c b/test-tool/test_writeverify16_flags.c index 46547c9..62d8d13 100644 --- a/test-tool/test_writeverify16_flags.c +++ b/test-tool/test_writeverify16_flags.c @@ -38,7 +38,7 @@ test_writeverify16_flags(void) logging(LOG_VERBOSE, "Test WRITEVERIFY16 flags"); logging(LOG_VERBOSE, "Test WRITEVERIFY16 with DPO==1"); - ret = writeverify16(iscsic, tgt_lun, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 1, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -49,7 +49,7 @@ test_writeverify16_flags(void) CU_ASSERT_EQUAL(ret, 0); logging(LOG_VERBOSE, "Test WRITEVERIFY16 with BYTCHK==1"); - ret = writeverify16(iscsic, tgt_lun, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, 0, 0, 1, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify16_residuals.c b/test-tool/test_writeverify16_residuals.c index b6e62ef..a648551 100644 --- a/test-tool/test_writeverify16_residuals.c +++ b/test-tool/test_writeverify16_residuals.c @@ -44,7 +44,7 @@ test_writeverify16_residuals(void) CHECK_FOR_SBC; /* check if writeverify16 is supported */ - ret = writeverify16(iscsic, tgt_lun, 0, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, 0, block_size, 0, 0, 0, 0, NULL, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -68,11 +68,11 @@ test_writeverify16_residuals(void) * we don't want autoreconnect since some targets will drop the session * on this condition. */ - iscsi_set_noautoreconnect(iscsic, 1); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 1); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==0"); - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, NULL); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, NULL); CU_ASSERT_PTR_NOT_NULL(task_ret); CU_ASSERT_NOT_EQUAL(task->status, SCSI_STATUS_CANCELLED); /* XXX redundant? */ @@ -86,7 +86,7 @@ test_writeverify16_residuals(void) logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -109,7 +109,7 @@ test_writeverify16_residuals(void) task = NULL; /* in case the previous test failed the session */ - iscsi_set_noautoreconnect(iscsic, 0); + iscsi_set_noautoreconnect(sd->iscsi_ctx, 0); logging(LOG_VERBOSE, "Try writing one block but with iSCSI expected transfer length==10000"); @@ -125,13 +125,13 @@ test_writeverify16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -167,13 +167,13 @@ test_writeverify16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -212,13 +212,13 @@ test_writeverify16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -247,7 +247,7 @@ test_writeverify16_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write16(iscsic, tgt_lun, 0, 2 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -267,13 +267,13 @@ test_writeverify16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -295,7 +295,7 @@ test_writeverify16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(iscsic, tgt_lun, 0, 2* block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -323,7 +323,7 @@ test_writeverify16_residuals(void) logging(LOG_VERBOSE, "Write two blocks of 'a'"); memset(buf, 'a', 10000); - ret = write16(iscsic, tgt_lun, 0, 2 * block_size, + ret = write16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2 * block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); @@ -343,13 +343,13 @@ test_writeverify16_residuals(void) data.size = task->expxferlen; data.data = &buf[0]; - task_ret = iscsi_scsi_command_sync(iscsic, tgt_lun, task, &data); + task_ret = iscsi_scsi_command_sync(sd->iscsi_ctx, sd->iscsi_lun, task, &data); CU_ASSERT_PTR_NOT_NULL(task_ret); logging(LOG_VERBOSE, "Verify that the target returned SUCCESS"); if (task->status != SCSI_STATUS_GOOD) { logging(LOG_VERBOSE, "[FAILED] Target returned error %s", - iscsi_get_error(iscsic)); + iscsi_get_error(sd->iscsi_ctx)); } CU_ASSERT_EQUAL(task->status, SCSI_STATUS_GOOD); @@ -371,7 +371,7 @@ test_writeverify16_residuals(void) task = NULL; logging(LOG_VERBOSE, "Read the two blocks"); - ret = read16(iscsic, tgt_lun, 0, 2* block_size, + ret = read16(sd->iscsi_ctx, sd->iscsi_lun, 0, 2* block_size, block_size, 0, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify16_simple.c b/test-tool/test_writeverify16_simple.c index cd8fa1f..ff4973d 100644 --- a/test-tool/test_writeverify16_simple.c +++ b/test-tool/test_writeverify16_simple.c @@ -43,7 +43,7 @@ test_writeverify16_simple(void) break; } - ret = writeverify16(iscsic, tgt_lun, 0, i * block_size, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); if (ret == -2) { @@ -60,7 +60,7 @@ test_writeverify16_simple(void) break; } - ret = writeverify16(iscsic, tgt_lun, num_blocks - i, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, num_blocks - i, i * block_size, block_size, 0, 0, 0, 0, buf, EXPECT_STATUS_GOOD); CU_ASSERT_EQUAL(ret, 0); diff --git a/test-tool/test_writeverify16_wrprotect.c b/test-tool/test_writeverify16_wrprotect.c index e8a708c..6ec225d 100644 --- a/test-tool/test_writeverify16_wrprotect.c +++ b/test-tool/test_writeverify16_wrprotect.c @@ -46,7 +46,7 @@ test_writeverify16_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 = writeverify16(iscsic, tgt_lun, 0, + ret = writeverify16(sd->iscsi_ctx, sd->iscsi_lun, 0, block_size, block_size, i, 0, 0, 0, buf, EXPECT_INVALID_FIELD_IN_CDB);