Do not cast away constness

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2020-02-28 21:45:12 -08:00
parent 3804f3c2e0
commit 529350eab1
3 changed files with 240 additions and 240 deletions

View File

@@ -37,7 +37,7 @@ iscsi_discovery_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
void *private_data) void *private_data)
{ {
struct iscsi_pdu *pdu; struct iscsi_pdu *pdu;
char *str; const char *str;
pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_TEXT_REQUEST, pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_TEXT_REQUEST,
ISCSI_PDU_TEXT_RESPONSE, ISCSI_PDU_TEXT_RESPONSE,
@@ -62,9 +62,9 @@ iscsi_discovery_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
iscsi_pdu_set_ttt(pdu, 0xffffffff); iscsi_pdu_set_ttt(pdu, 0xffffffff);
/* sendtargets */ /* sendtargets */
str = (char *)"SendTargets=All"; str = "SendTargets=All";
if (iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)str, strlen(str)+1) if (iscsi_pdu_add_data(iscsi, pdu, (const unsigned char *)str,
!= 0) { strlen(str) + 1) != 0) {
iscsi_set_error(iscsi, "Out-of-memory: pdu add data failed."); iscsi_set_error(iscsi, "Out-of-memory: pdu add data failed.");
iscsi->drv->free_pdu(iscsi, pdu); iscsi->drv->free_pdu(iscsi, pdu);
return -1; return -1;

View File

@@ -65,421 +65,421 @@ static unsigned int maxsectors;
* *
*****************************************************************/ *****************************************************************/
static CU_TestInfo tests_compareandwrite[] = { static CU_TestInfo tests_compareandwrite[] = {
{ (char *)"Simple", test_compareandwrite_simple }, { "Simple", test_compareandwrite_simple },
{ (char *)"DpoFua", test_compareandwrite_dpofua }, { "DpoFua", test_compareandwrite_dpofua },
{ (char *)"Miscompare", test_compareandwrite_miscompare }, { "Miscompare", test_compareandwrite_miscompare },
{ (char *)"Unwritten", test_compareandwrite_unwritten }, { "Unwritten", test_compareandwrite_unwritten },
{ (char *)"InvalidDataOutSize", { "InvalidDataOutSize",
test_compareandwrite_invalid_dataout_size }, test_compareandwrite_invalid_dataout_size },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_get_lba_status[] = { static CU_TestInfo tests_get_lba_status[] = {
{ (char *)"Simple", test_get_lba_status_simple }, { "Simple", test_get_lba_status_simple },
{ (char *)"BeyondEol", test_get_lba_status_beyond_eol }, { "BeyondEol", test_get_lba_status_beyond_eol },
{ (char *)"UnmapSingle", test_get_lba_status_unmap_single }, { "UnmapSingle", test_get_lba_status_unmap_single },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_inquiry[] = { static CU_TestInfo tests_inquiry[] = {
{ (char *)"Standard", test_inquiry_standard }, { "Standard", test_inquiry_standard },
{ (char *)"AllocLength", test_inquiry_alloc_length}, { "AllocLength", test_inquiry_alloc_length},
{ (char *)"EVPD", test_inquiry_evpd}, { "EVPD", test_inquiry_evpd},
{ (char *)"BlockLimits", test_inquiry_block_limits}, { "BlockLimits", test_inquiry_block_limits},
{ (char *)"MandatoryVPDSBC", test_inquiry_mandatory_vpd_sbc}, { "MandatoryVPDSBC", test_inquiry_mandatory_vpd_sbc},
{ (char *)"SupportedVPD", test_inquiry_supported_vpd}, { "SupportedVPD", test_inquiry_supported_vpd},
{ (char *)"VersionDescriptors", test_inquiry_version_descriptors}, { "VersionDescriptors", test_inquiry_version_descriptors},
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_mandatory[] = { static CU_TestInfo tests_mandatory[] = {
{ (char *)"MandatorySBC", test_mandatory_sbc }, { "MandatorySBC", test_mandatory_sbc },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_modesense6[] = { static CU_TestInfo tests_modesense6[] = {
{ (char *)"AllPages", test_modesense6_all_pages }, { "AllPages", test_modesense6_all_pages },
{ (char *)"Control", test_modesense6_control }, { "Control", test_modesense6_control },
{ (char *)"Control-D_SENSE", test_modesense6_control_d_sense }, { "Control-D_SENSE", test_modesense6_control_d_sense },
{ (char *)"Control-SWP", test_modesense6_control_swp }, { "Control-SWP", test_modesense6_control_swp },
{ (char *)"Residuals", test_modesense6_residuals }, { "Residuals", test_modesense6_residuals },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_nomedia[] = { static CU_TestInfo tests_nomedia[] = {
{ (char *)"NoMediaSBC", test_nomedia_sbc }, { "NoMediaSBC", test_nomedia_sbc },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_orwrite[] = { static CU_TestInfo tests_orwrite[] = {
{ (char *)"Simple", test_orwrite_simple }, { "Simple", test_orwrite_simple },
{ (char *)"BeyondEol", test_orwrite_beyond_eol }, { "BeyondEol", test_orwrite_beyond_eol },
{ (char *)"ZeroBlocks", test_orwrite_0blocks }, { "ZeroBlocks", test_orwrite_0blocks },
{ (char *)"Protect", test_orwrite_wrprotect }, { "Protect", test_orwrite_wrprotect },
{ (char *)"DpoFua", test_orwrite_dpofua }, { "DpoFua", test_orwrite_dpofua },
{ (char *)"Verify", test_orwrite_verify }, { "Verify", test_orwrite_verify },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prefetch10[] = { static CU_TestInfo tests_prefetch10[] = {
{ (char *)"Simple", test_prefetch10_simple }, { "Simple", test_prefetch10_simple },
{ (char *)"BeyondEol", test_prefetch10_beyond_eol }, { "BeyondEol", test_prefetch10_beyond_eol },
{ (char *)"ZeroBlocks", test_prefetch10_0blocks }, { "ZeroBlocks", test_prefetch10_0blocks },
{ (char *)"Flags", test_prefetch10_flags }, { "Flags", test_prefetch10_flags },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prefetch16[] = { static CU_TestInfo tests_prefetch16[] = {
{ (char *)"Simple", test_prefetch16_simple }, { "Simple", test_prefetch16_simple },
{ (char *)"BeyondEol", test_prefetch16_beyond_eol }, { "BeyondEol", test_prefetch16_beyond_eol },
{ (char *)"ZeroBlocks", test_prefetch16_0blocks }, { "ZeroBlocks", test_prefetch16_0blocks },
{ (char *)"Flags", test_prefetch16_flags }, { "Flags", test_prefetch16_flags },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_preventallow[] = { static CU_TestInfo tests_preventallow[] = {
{ (char *)"Simple", test_preventallow_simple }, { "Simple", test_preventallow_simple },
{ (char *)"Eject", test_preventallow_eject }, { "Eject", test_preventallow_eject },
{ (char *)"ITNexusLoss", test_preventallow_itnexus_loss }, { "ITNexusLoss", test_preventallow_itnexus_loss },
{ (char *)"Logout", test_preventallow_logout }, { "Logout", test_preventallow_logout },
{ (char *)"WarmReset", test_preventallow_warm_reset }, { "WarmReset", test_preventallow_warm_reset },
{ (char *)"ColdReset", test_preventallow_cold_reset }, { "ColdReset", test_preventallow_cold_reset },
{ (char *)"LUNReset", test_preventallow_lun_reset }, { "LUNReset", test_preventallow_lun_reset },
{ (char *)"2ITNexuses", test_preventallow_2_itnexuses }, { "2ITNexuses", test_preventallow_2_itnexuses },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prin_read_keys[] = { static CU_TestInfo tests_prin_read_keys[] = {
{ (char *)"Simple", test_prin_read_keys_simple }, { "Simple", test_prin_read_keys_simple },
{ (char *)"Truncate", test_prin_read_keys_truncate }, { "Truncate", test_prin_read_keys_truncate },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prin_report_caps[] = { static CU_TestInfo tests_prin_report_caps[] = {
{ (char *)"Simple", test_prin_report_caps_simple }, { "Simple", test_prin_report_caps_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prout_register[] = { static CU_TestInfo tests_prout_register[] = {
{ (char *)"Simple", test_prout_register_simple }, { "Simple", test_prout_register_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prout_reserve[] = { static CU_TestInfo tests_prout_reserve[] = {
{ (char *)"Simple", { "Simple",
test_prout_reserve_simple }, test_prout_reserve_simple },
{ (char *)"AccessEA", { "AccessEA",
test_prout_reserve_access_ea }, test_prout_reserve_access_ea },
{ (char *)"AccessWE", { "AccessWE",
test_prout_reserve_access_we }, test_prout_reserve_access_we },
{ (char *)"AccessEARO", { "AccessEARO",
test_prout_reserve_access_earo }, test_prout_reserve_access_earo },
{ (char *)"AccessWERO", { "AccessWERO",
test_prout_reserve_access_wero }, test_prout_reserve_access_wero },
{ (char *)"AccessEAAR", { "AccessEAAR",
test_prout_reserve_access_eaar }, test_prout_reserve_access_eaar },
{ (char *)"AccessWEAR", { "AccessWEAR",
test_prout_reserve_access_wear }, test_prout_reserve_access_wear },
{ (char *)"OwnershipEA", { "OwnershipEA",
test_prout_reserve_ownership_ea }, test_prout_reserve_ownership_ea },
{ (char *)"OwnershipWE", { "OwnershipWE",
test_prout_reserve_ownership_we }, test_prout_reserve_ownership_we },
{ (char *)"OwnershipEARO", { "OwnershipEARO",
test_prout_reserve_ownership_earo }, test_prout_reserve_ownership_earo },
{ (char *)"OwnershipWERO", { "OwnershipWERO",
test_prout_reserve_ownership_wero }, test_prout_reserve_ownership_wero },
{ (char *)"OwnershipEAAR", { "OwnershipEAAR",
test_prout_reserve_ownership_eaar }, test_prout_reserve_ownership_eaar },
{ (char *)"OwnershipWEAR", { "OwnershipWEAR",
test_prout_reserve_ownership_wear }, test_prout_reserve_ownership_wear },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prout_clear[] = { static CU_TestInfo tests_prout_clear[] = {
{ (char *)"Simple", { "Simple",
test_prout_clear_simple }, test_prout_clear_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prout_preempt[] = { static CU_TestInfo tests_prout_preempt[] = {
{ (char *)"RemoveRegistration", { "RemoveRegistration",
test_prout_preempt_rm_reg }, test_prout_preempt_rm_reg },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_prin_serviceaction_range[] = { static CU_TestInfo tests_prin_serviceaction_range[] = {
{ (char *)"Range", test_prin_serviceaction_range }, { "Range", test_prin_serviceaction_range },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_read6[] = { static CU_TestInfo tests_read6[] = {
{ (char *)"Simple", test_read6_simple }, { "Simple", test_read6_simple },
{ (char *)"BeyondEol", test_read6_beyond_eol }, { "BeyondEol", test_read6_beyond_eol },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_read10[] = { static CU_TestInfo tests_read10[] = {
{ (char *)"Simple", test_read10_simple }, { "Simple", test_read10_simple },
{ (char *)"BeyondEol", test_read10_beyond_eol }, { "BeyondEol", test_read10_beyond_eol },
{ (char *)"ZeroBlocks", test_read10_0blocks }, { "ZeroBlocks", test_read10_0blocks },
{ (char *)"ReadProtect", test_read10_rdprotect }, { "ReadProtect", test_read10_rdprotect },
{ (char *)"DpoFua", test_read10_dpofua }, { "DpoFua", test_read10_dpofua },
{ (char *)"Async", test_async_read }, { "Async", test_async_read },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_read12[] = { static CU_TestInfo tests_read12[] = {
{ (char *)"Simple", test_read12_simple }, { "Simple", test_read12_simple },
{ (char *)"BeyondEol", test_read12_beyond_eol }, { "BeyondEol", test_read12_beyond_eol },
{ (char *)"ZeroBlocks", test_read12_0blocks }, { "ZeroBlocks", test_read12_0blocks },
{ (char *)"ReadProtect", test_read12_rdprotect }, { "ReadProtect", test_read12_rdprotect },
{ (char *)"DpoFua", test_read12_dpofua }, { "DpoFua", test_read12_dpofua },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_read16[] = { static CU_TestInfo tests_read16[] = {
{ (char *)"Simple", test_read16_simple }, { "Simple", test_read16_simple },
{ (char *)"BeyondEol", test_read16_beyond_eol }, { "BeyondEol", test_read16_beyond_eol },
{ (char *)"ZeroBlocks", test_read16_0blocks }, { "ZeroBlocks", test_read16_0blocks },
{ (char *)"ReadProtect", test_read16_rdprotect }, { "ReadProtect", test_read16_rdprotect },
{ (char *)"DpoFua", test_read16_dpofua }, { "DpoFua", test_read16_dpofua },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_readcapacity10[] = { static CU_TestInfo tests_readcapacity10[] = {
{ (char *)"Simple", test_readcapacity10_simple }, { "Simple", test_readcapacity10_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_readcapacity16[] = { static CU_TestInfo tests_readcapacity16[] = {
{ (char *)"Simple", test_readcapacity16_simple }, { "Simple", test_readcapacity16_simple },
{ (char *)"Alloclen", test_readcapacity16_alloclen }, { "Alloclen", test_readcapacity16_alloclen },
{ (char *)"PI", test_readcapacity16_protection }, { "PI", test_readcapacity16_protection },
{ (char *)"Support", test_readcapacity16_support }, { "Support", test_readcapacity16_support },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_readdefectdata10[] = { static CU_TestInfo tests_readdefectdata10[] = {
{ (char *)"Simple", test_readdefectdata10_simple }, { "Simple", test_readdefectdata10_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_readdefectdata12[] = { static CU_TestInfo tests_readdefectdata12[] = {
{ (char *)"Simple", test_readdefectdata12_simple }, { "Simple", test_readdefectdata12_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_readonly[] = { static CU_TestInfo tests_readonly[] = {
{ (char *)"ReadOnlySBC", test_readonly_sbc }, { "ReadOnlySBC", test_readonly_sbc },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_sanitize[] = { static CU_TestInfo tests_sanitize[] = {
{ (char *)"BlockErase", test_sanitize_block_erase }, { "BlockErase", test_sanitize_block_erase },
{ (char *)"BlockEraseReserved", test_sanitize_block_erase_reserved }, { "BlockEraseReserved", test_sanitize_block_erase_reserved },
{ (char *)"CryptoErase", test_sanitize_crypto_erase }, { "CryptoErase", test_sanitize_crypto_erase },
{ (char *)"CryptoEraseReserved", test_sanitize_crypto_erase_reserved }, { "CryptoEraseReserved", test_sanitize_crypto_erase_reserved },
{ (char *)"ExitFailureMode", test_sanitize_exit_failure_mode }, { "ExitFailureMode", test_sanitize_exit_failure_mode },
{ (char *)"InvalidServiceAction", test_sanitize_invalid_serviceaction }, { "InvalidServiceAction", test_sanitize_invalid_serviceaction },
{ (char *)"Overwrite", test_sanitize_overwrite }, { "Overwrite", test_sanitize_overwrite },
{ (char *)"OverwriteReserved", test_sanitize_overwrite_reserved }, { "OverwriteReserved", test_sanitize_overwrite_reserved },
{ (char *)"Readonly", test_sanitize_readonly }, { "Readonly", test_sanitize_readonly },
{ (char *)"Reservations", test_sanitize_reservations }, { "Reservations", test_sanitize_reservations },
{ (char *)"Reset", test_sanitize_reset }, { "Reset", test_sanitize_reset },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_extended_copy[] = { static CU_TestInfo tests_extended_copy[] = {
{ (char *)"Simple", test_extendedcopy_simple }, { "Simple", test_extendedcopy_simple },
{ (char *)"ParamHdr", test_extendedcopy_param }, { "ParamHdr", test_extendedcopy_param },
{ (char *)"DescrLimits", test_extendedcopy_descr_limits }, { "DescrLimits", test_extendedcopy_descr_limits },
{ (char *)"DescrType", test_extendedcopy_descr_type }, { "DescrType", test_extendedcopy_descr_type },
{ (char *)"ValidTgtDescr", test_extendedcopy_validate_tgt_descr }, { "ValidTgtDescr", test_extendedcopy_validate_tgt_descr },
{ (char *)"ValidSegDescr", test_extendedcopy_validate_seg_descr }, { "ValidSegDescr", test_extendedcopy_validate_seg_descr },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_receive_copy_results[] = { static CU_TestInfo tests_receive_copy_results[] = {
{ (char *)"CopyStatus", test_receive_copy_results_copy_status }, { "CopyStatus", test_receive_copy_results_copy_status },
{ (char *)"OpParams", test_receive_copy_results_op_params }, { "OpParams", test_receive_copy_results_op_params },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_report_supported_opcodes[] = { static CU_TestInfo tests_report_supported_opcodes[] = {
{ (char *)"Simple", test_report_supported_opcodes_simple }, { "Simple", test_report_supported_opcodes_simple },
{ (char *)"OneCommand", test_report_supported_opcodes_one_command }, { "OneCommand", test_report_supported_opcodes_one_command },
{ (char *)"RCTD", test_report_supported_opcodes_rctd }, { "RCTD", test_report_supported_opcodes_rctd },
{ (char *)"SERVACTV", test_report_supported_opcodes_servactv }, { "SERVACTV", test_report_supported_opcodes_servactv },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_reserve6[] = { static CU_TestInfo tests_reserve6[] = {
{ (char *)"Simple", test_reserve6_simple }, { "Simple", test_reserve6_simple },
{ (char *)"2Initiators", test_reserve6_2initiators }, { "2Initiators", test_reserve6_2initiators },
{ (char *)"Logout", test_reserve6_logout }, { "Logout", test_reserve6_logout },
{ (char *)"ITNexusLoss", test_reserve6_itnexus_loss }, { "ITNexusLoss", test_reserve6_itnexus_loss },
{ (char *)"TargetColdReset", test_reserve6_target_cold_reset }, { "TargetColdReset", test_reserve6_target_cold_reset },
{ (char *)"TargetWarmReset", test_reserve6_target_warm_reset }, { "TargetWarmReset", test_reserve6_target_warm_reset },
{ (char *)"LUNReset", test_reserve6_lun_reset }, { "LUNReset", test_reserve6_lun_reset },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_testunitready[] = { static CU_TestInfo tests_testunitready[] = {
{ (char *)"Simple", test_testunitready_simple }, { "Simple", test_testunitready_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_startstopunit[] = { static CU_TestInfo tests_startstopunit[] = {
{ (char *)"Simple", test_startstopunit_simple }, { "Simple", test_startstopunit_simple },
{ (char *)"PwrCnd", test_startstopunit_pwrcnd }, { "PwrCnd", test_startstopunit_pwrcnd },
{ (char *)"NoLoej", test_startstopunit_noloej }, { "NoLoej", test_startstopunit_noloej },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_unmap[] = { static CU_TestInfo tests_unmap[] = {
{ (char *)"Simple", test_unmap_simple }, { "Simple", test_unmap_simple },
{ (char *)"VPD", test_unmap_vpd }, { "VPD", test_unmap_vpd },
{ (char *)"ZeroBlocks", test_unmap_0blocks }, { "ZeroBlocks", test_unmap_0blocks },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_verify10[] = { static CU_TestInfo tests_verify10[] = {
{ (char *)"Simple", test_verify10_simple }, { "Simple", test_verify10_simple },
{ (char *)"BeyondEol", test_verify10_beyond_eol }, { "BeyondEol", test_verify10_beyond_eol },
{ (char *)"ZeroBlocks", test_verify10_0blocks }, { "ZeroBlocks", test_verify10_0blocks },
{ (char *)"VerifyProtect", test_verify10_vrprotect }, { "VerifyProtect", test_verify10_vrprotect },
{ (char *)"Flags", test_verify10_flags }, { "Flags", test_verify10_flags },
{ (char *)"Dpo", test_verify10_dpo }, { "Dpo", test_verify10_dpo },
{ (char *)"Mismatch", test_verify10_mismatch }, { "Mismatch", test_verify10_mismatch },
{ (char *)"MismatchNoCmp", test_verify10_mismatch_no_cmp }, { "MismatchNoCmp", test_verify10_mismatch_no_cmp },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_verify12[] = { static CU_TestInfo tests_verify12[] = {
{ (char *)"Simple", test_verify12_simple }, { "Simple", test_verify12_simple },
{ (char *)"BeyondEol", test_verify12_beyond_eol }, { "BeyondEol", test_verify12_beyond_eol },
{ (char *)"ZeroBlocks", test_verify12_0blocks }, { "ZeroBlocks", test_verify12_0blocks },
{ (char *)"VerifyProtect", test_verify12_vrprotect }, { "VerifyProtect", test_verify12_vrprotect },
{ (char *)"Flags", test_verify12_flags }, { "Flags", test_verify12_flags },
{ (char *)"Dpo", test_verify12_dpo }, { "Dpo", test_verify12_dpo },
{ (char *)"Mismatch", test_verify12_mismatch }, { "Mismatch", test_verify12_mismatch },
{ (char *)"MismatchNoCmp", test_verify12_mismatch_no_cmp }, { "MismatchNoCmp", test_verify12_mismatch_no_cmp },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_verify16[] = { static CU_TestInfo tests_verify16[] = {
{ (char *)"Simple", test_verify16_simple }, { "Simple", test_verify16_simple },
{ (char *)"BeyondEol", test_verify16_beyond_eol }, { "BeyondEol", test_verify16_beyond_eol },
{ (char *)"ZeroBlocks", test_verify16_0blocks }, { "ZeroBlocks", test_verify16_0blocks },
{ (char *)"VerifyProtect", test_verify16_vrprotect }, { "VerifyProtect", test_verify16_vrprotect },
{ (char *)"Flags", test_verify16_flags }, { "Flags", test_verify16_flags },
{ (char *)"Dpo", test_verify16_dpo }, { "Dpo", test_verify16_dpo },
{ (char *)"Mismatch", test_verify16_mismatch }, { "Mismatch", test_verify16_mismatch },
{ (char *)"MismatchNoCmp", test_verify16_mismatch_no_cmp }, { "MismatchNoCmp", test_verify16_mismatch_no_cmp },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_write10[] = { static CU_TestInfo tests_write10[] = {
{ (char *)"Simple", test_write10_simple }, { "Simple", test_write10_simple },
{ (char *)"BeyondEol", test_write10_beyond_eol }, { "BeyondEol", test_write10_beyond_eol },
{ (char *)"ZeroBlocks", test_write10_0blocks }, { "ZeroBlocks", test_write10_0blocks },
{ (char *)"WriteProtect", test_write10_wrprotect }, { "WriteProtect", test_write10_wrprotect },
{ (char *)"DpoFua", test_write10_dpofua }, { "DpoFua", test_write10_dpofua },
{ (char *)"Async", test_async_write }, { "Async", test_async_write },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_write12[] = { static CU_TestInfo tests_write12[] = {
{ (char *)"Simple", test_write12_simple }, { "Simple", test_write12_simple },
{ (char *)"BeyondEol", test_write12_beyond_eol }, { "BeyondEol", test_write12_beyond_eol },
{ (char *)"ZeroBlocks", test_write12_0blocks }, { "ZeroBlocks", test_write12_0blocks },
{ (char *)"WriteProtect", test_write12_wrprotect }, { "WriteProtect", test_write12_wrprotect },
{ (char *)"DpoFua", test_write12_dpofua }, { "DpoFua", test_write12_dpofua },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_write16[] = { static CU_TestInfo tests_write16[] = {
{ (char *)"Simple", test_write16_simple }, { "Simple", test_write16_simple },
{ (char *)"BeyondEol", test_write16_beyond_eol }, { "BeyondEol", test_write16_beyond_eol },
{ (char *)"ZeroBlocks", test_write16_0blocks }, { "ZeroBlocks", test_write16_0blocks },
{ (char *)"WriteProtect", test_write16_wrprotect }, { "WriteProtect", test_write16_wrprotect },
{ (char *)"DpoFua", test_write16_dpofua }, { "DpoFua", test_write16_dpofua },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writeatomic16[] = { static CU_TestInfo tests_writeatomic16[] = {
{ (char *)"Simple", test_writeatomic16_simple }, { "Simple", test_writeatomic16_simple },
{ (char *)"BeyondEol", test_writeatomic16_beyond_eol }, { "BeyondEol", test_writeatomic16_beyond_eol },
{ (char *)"ZeroBlocks", test_writeatomic16_0blocks }, { "ZeroBlocks", test_writeatomic16_0blocks },
{ (char *)"WriteProtect", test_writeatomic16_wrprotect }, { "WriteProtect", test_writeatomic16_wrprotect },
{ (char *)"DpoFua", test_writeatomic16_dpofua }, { "DpoFua", test_writeatomic16_dpofua },
{ (char *)"VPD", test_writeatomic16_vpd }, { "VPD", test_writeatomic16_vpd },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writesame10[] = { static CU_TestInfo tests_writesame10[] = {
{ (char *)"Simple", test_writesame10_simple }, { "Simple", test_writesame10_simple },
{ (char *)"BeyondEol", test_writesame10_beyond_eol }, { "BeyondEol", test_writesame10_beyond_eol },
{ (char *)"ZeroBlocks", test_writesame10_0blocks }, { "ZeroBlocks", test_writesame10_0blocks },
{ (char *)"WriteProtect", test_writesame10_wrprotect }, { "WriteProtect", test_writesame10_wrprotect },
{ (char *)"Unmap", test_writesame10_unmap }, { "Unmap", test_writesame10_unmap },
{ (char *)"UnmapUnaligned", test_writesame10_unmap_unaligned }, { "UnmapUnaligned", test_writesame10_unmap_unaligned },
{ (char *)"UnmapUntilEnd", test_writesame10_unmap_until_end }, { "UnmapUntilEnd", test_writesame10_unmap_until_end },
{ (char *)"UnmapVPD", test_writesame10_unmap_vpd }, { "UnmapVPD", test_writesame10_unmap_vpd },
{ (char *)"Check", test_writesame10_check }, { "Check", test_writesame10_check },
{ (char *)"InvalidDataOutSize", test_writesame10_invalid_dataout_size }, { "InvalidDataOutSize", test_writesame10_invalid_dataout_size },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writesame16[] = { static CU_TestInfo tests_writesame16[] = {
{ (char *)"Simple", test_writesame16_simple }, { "Simple", test_writesame16_simple },
{ (char *)"BeyondEol", test_writesame16_beyond_eol }, { "BeyondEol", test_writesame16_beyond_eol },
{ (char *)"ZeroBlocks", test_writesame16_0blocks }, { "ZeroBlocks", test_writesame16_0blocks },
{ (char *)"WriteProtect", test_writesame16_wrprotect }, { "WriteProtect", test_writesame16_wrprotect },
{ (char *)"Unmap", test_writesame16_unmap }, { "Unmap", test_writesame16_unmap },
{ (char *)"UnmapUnaligned", test_writesame16_unmap_unaligned }, { "UnmapUnaligned", test_writesame16_unmap_unaligned },
{ (char *)"UnmapUntilEnd", test_writesame16_unmap_until_end }, { "UnmapUntilEnd", test_writesame16_unmap_until_end },
{ (char *)"UnmapVPD", test_writesame16_unmap_vpd }, { "UnmapVPD", test_writesame16_unmap_vpd },
{ (char *)"Check", test_writesame16_check }, { "Check", test_writesame16_check },
{ (char *)"InvalidDataOutSize", test_writesame16_invalid_dataout_size }, { "InvalidDataOutSize", test_writesame16_invalid_dataout_size },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writeverify10[] = { static CU_TestInfo tests_writeverify10[] = {
{ (char *)"Simple", test_writeverify10_simple }, { "Simple", test_writeverify10_simple },
{ (char *)"BeyondEol", test_writeverify10_beyond_eol }, { "BeyondEol", test_writeverify10_beyond_eol },
{ (char *)"ZeroBlocks", test_writeverify10_0blocks }, { "ZeroBlocks", test_writeverify10_0blocks },
{ (char *)"WriteProtect", test_writeverify10_wrprotect }, { "WriteProtect", test_writeverify10_wrprotect },
{ (char *)"Flags", test_writeverify10_flags }, { "Flags", test_writeverify10_flags },
{ (char *)"Dpo", test_writeverify10_dpo }, { "Dpo", test_writeverify10_dpo },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writeverify12[] = { static CU_TestInfo tests_writeverify12[] = {
{ (char *)"Simple", test_writeverify12_simple }, { "Simple", test_writeverify12_simple },
{ (char *)"BeyondEol", test_writeverify12_beyond_eol }, { "BeyondEol", test_writeverify12_beyond_eol },
{ (char *)"ZeroBlocks", test_writeverify12_0blocks }, { "ZeroBlocks", test_writeverify12_0blocks },
{ (char *)"WriteProtect", test_writeverify12_wrprotect }, { "WriteProtect", test_writeverify12_wrprotect },
{ (char *)"Flags", test_writeverify12_flags }, { "Flags", test_writeverify12_flags },
{ (char *)"Dpo", test_writeverify12_dpo }, { "Dpo", test_writeverify12_dpo },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_writeverify16[] = { static CU_TestInfo tests_writeverify16[] = {
{ (char *)"Simple", test_writeverify16_simple }, { "Simple", test_writeverify16_simple },
{ (char *)"BeyondEol", test_writeverify16_beyond_eol }, { "BeyondEol", test_writeverify16_beyond_eol },
{ (char *)"ZeroBlocks", test_writeverify16_0blocks }, { "ZeroBlocks", test_writeverify16_0blocks },
{ (char *)"WriteProtect", test_writeverify16_wrprotect }, { "WriteProtect", test_writeverify16_wrprotect },
{ (char *)"Flags", test_writeverify16_flags }, { "Flags", test_writeverify16_flags },
{ (char *)"Dpo", test_writeverify16_dpo }, { "Dpo", test_writeverify16_dpo },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_multipathio[] = { static CU_TestInfo tests_multipathio[] = {
{ (char *)"Simple", test_multipathio_simple }, { "Simple", test_multipathio_simple },
{ (char *)"Reset", test_multipathio_reset }, { "Reset", test_multipathio_reset },
{ (char *)"CompareAndWrite", test_multipathio_compareandwrite }, { "CompareAndWrite", test_multipathio_compareandwrite },
{ (char *)"CompareAndWriteAsync", test_mpio_async_caw }, { "CompareAndWriteAsync", test_mpio_async_caw },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
@@ -548,50 +548,50 @@ static libiscsi_suite_info scsi_suites[] = {
}; };
static CU_TestInfo tests_iscsi_cmdsn[] = { static CU_TestInfo tests_iscsi_cmdsn[] = {
{ (char *)"iSCSICmdSnTooHigh", test_iscsi_cmdsn_toohigh }, { "iSCSICmdSnTooHigh", test_iscsi_cmdsn_toohigh },
{ (char *)"iSCSICmdSnTooLow", test_iscsi_cmdsn_toolow }, { "iSCSICmdSnTooLow", test_iscsi_cmdsn_toolow },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_datasn[] = { static CU_TestInfo tests_iscsi_datasn[] = {
{ (char *)"iSCSIDataSnInvalid", test_iscsi_datasn_invalid }, { "iSCSIDataSnInvalid", test_iscsi_datasn_invalid },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_sendtargets[] = { static CU_TestInfo tests_iscsi_sendtargets[] = {
{ (char *)"Simple", test_iscsi_sendtargets_simple }, { "Simple", test_iscsi_sendtargets_simple },
{ (char *)"Invalid", test_iscsi_sendtargets_invalid }, { "Invalid", test_iscsi_sendtargets_invalid },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_nop[] = { static CU_TestInfo tests_iscsi_nop[] = {
{ (char *)"Simple", test_iscsi_nop_simple }, { "Simple", test_iscsi_nop_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_chap[] = { static CU_TestInfo tests_iscsi_chap[] = {
{ (char *)"Simple", test_iscsi_chap_simple }, { "Simple", test_iscsi_chap_simple },
{ (char *)"Invalid", test_iscsi_chap_invalid }, { "Invalid", test_iscsi_chap_invalid },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_residuals[] = { static CU_TestInfo tests_iscsi_residuals[] = {
{ (char *)"Read10Invalid", test_read10_invalid }, { "Read10Invalid", test_read10_invalid },
{ (char *)"Read10Residuals", test_read10_residuals }, { "Read10Residuals", test_read10_residuals },
{ (char *)"Read12Residuals", test_read12_residuals }, { "Read12Residuals", test_read12_residuals },
{ (char *)"Read16Residuals", test_read16_residuals }, { "Read16Residuals", test_read16_residuals },
{ (char *)"Write10Residuals", test_write10_residuals }, { "Write10Residuals", test_write10_residuals },
{ (char *)"Write12Residuals", test_write12_residuals }, { "Write12Residuals", test_write12_residuals },
{ (char *)"Write16Residuals", test_write16_residuals }, { "Write16Residuals", test_write16_residuals },
{ (char *)"WriteVerify10Residuals", test_writeverify10_residuals }, { "WriteVerify10Residuals", test_writeverify10_residuals },
{ (char *)"WriteVerify12Residuals", test_writeverify12_residuals }, { "WriteVerify12Residuals", test_writeverify12_residuals },
{ (char *)"WriteVerify16Residuals", test_writeverify16_residuals }, { "WriteVerify16Residuals", test_writeverify16_residuals },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };
static CU_TestInfo tests_iscsi_tmf[] = { static CU_TestInfo tests_iscsi_tmf[] = {
{ (char *)"AbortTaskSimpleAsync", test_async_abort_simple }, { "AbortTaskSimpleAsync", test_async_abort_simple },
{ (char *)"LUNResetSimpleAsync", test_async_lu_reset_simple }, { "LUNResetSimpleAsync", test_async_lu_reset_simple },
CU_TEST_INFO_NULL CU_TEST_INFO_NULL
}; };

View File

@@ -141,7 +141,7 @@ test_iscsi_text_req_queue(struct iscsi_context *iscsi,
iscsi_pdu_set_pduflags(pdu, ISCSI_PDU_TEXT_FINAL); iscsi_pdu_set_pduflags(pdu, ISCSI_PDU_TEXT_FINAL);
iscsi_pdu_set_ttt(pdu, 0xffffffff); iscsi_pdu_set_ttt(pdu, 0xffffffff);
ret = iscsi_pdu_add_data(iscsi, pdu, (unsigned char *)kv_data, ret = iscsi_pdu_add_data(iscsi, pdu, (const unsigned char *)kv_data,
strlen(kv_data) + 1); strlen(kv_data) + 1);
CU_ASSERT_EQUAL_FATAL(ret, 0); CU_ASSERT_EQUAL_FATAL(ret, 0);