From 6d72c6214a78a585dfae2422a810ea18fbb51f0c Mon Sep 17 00:00:00 2001 From: Nidhi Sharma Date: Tue, 14 May 2024 13:47:21 +0530 Subject: [PATCH] Quick : more fix for converting int to eReturnValue. --- subprojects/opensea-common | 2 +- subprojects/opensea-operations | 2 +- subprojects/opensea-transport | 2 +- subprojects/wingetopt | 2 +- utils/C/openSeaChest/openSeaChest_Basics.c | 20 +- utils/C/openSeaChest/openSeaChest_Configure.c | 26 +- utils/C/openSeaChest/openSeaChest_Erase.c | 40 +-- utils/C/openSeaChest/openSeaChest_Firmware.c | 18 +- utils/C/openSeaChest/openSeaChest_Format.c | 22 +- .../openSeaChest/openSeaChest_GenericTests.c | 18 +- utils/C/openSeaChest/openSeaChest_Info.c | 10 +- utils/C/openSeaChest/openSeaChest_Logs.c | 22 +- utils/C/openSeaChest/openSeaChest_NVMe.c | 28 +-- .../openSeaChest_PassthroughTest.c | 236 +++++++++--------- .../openSeaChest/openSeaChest_PowerControl.c | 38 +-- .../openSeaChest/openSeaChest_Reservations.c | 14 +- utils/C/openSeaChest/openSeaChest_SMART.c | 40 +-- utils/C/openSeaChest/openSeaChest_Sample.c | 64 ++--- utils/C/openSeaChest/openSeaChest_Security.c | 16 +- utils/C/openSeaChest/openSeaChest_ZBD.c | 12 +- 20 files changed, 316 insertions(+), 316 deletions(-) diff --git a/subprojects/opensea-common b/subprojects/opensea-common index 079d576..3961343 160000 --- a/subprojects/opensea-common +++ b/subprojects/opensea-common @@ -1 +1 @@ -Subproject commit 079d57656293c1edbf59c9a07bb30630908f95dc +Subproject commit 39613439b3739d95fba6b78dbbe269c282ef9b4e diff --git a/subprojects/opensea-operations b/subprojects/opensea-operations index 78abde9..1b751df 160000 --- a/subprojects/opensea-operations +++ b/subprojects/opensea-operations @@ -1 +1 @@ -Subproject commit 78abde9d663a06348d053bc061670c93402ed0db +Subproject commit 1b751df316325c1e56d668adcabc5bf1d2cc9c95 diff --git a/subprojects/opensea-transport b/subprojects/opensea-transport index 127f2b0..67cd65d 160000 --- a/subprojects/opensea-transport +++ b/subprojects/opensea-transport @@ -1 +1 @@ -Subproject commit 127f2b03092283567fefabb8aac70df4aaa4626d +Subproject commit 67cd65d570a2bdb7b546d73a99511d1dd6ceef30 diff --git a/subprojects/wingetopt b/subprojects/wingetopt index 9af6b88..1b5b5b8 160000 --- a/subprojects/wingetopt +++ b/subprojects/wingetopt @@ -1 +1 @@ -Subproject commit 9af6b88c66b89186dd8e5114ad1bc3fc213ab7fd +Subproject commit 1b5b5b8e0817e3cdb92e6ae99aa0ccc2d6c4984e diff --git a/utils/C/openSeaChest/openSeaChest_Basics.c b/utils/C/openSeaChest/openSeaChest_Basics.c index 92d593e..fc7e64c 100644 --- a/utils/C/openSeaChest/openSeaChest_Basics.c +++ b/utils/C/openSeaChest/openSeaChest_Basics.c @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) SHOW_CONCURRENT_RANGES_VAR LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -699,11 +699,11 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } - #if defined (__linux__) +#if defined (__linux__) if (SCAN_FLAGS.scanSD) { scanControl |= SD_HANDLES; @@ -712,7 +712,7 @@ int main(int argc, char *argv[]) { scanControl |= SG_TO_SD; } - #endif +#endif //set the drive types to show (if none are set, the lower level code assumes we need to show everything) if (SCAN_FLAGS.scanATA) { @@ -821,8 +821,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -994,9 +994,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -2075,7 +2075,7 @@ int main(int argc, char *argv[]) { double mCapacity = 0, capacity = 0; char mCapUnits[UNIT_STRING_LENGTH] = { 0 }, capUnits[UNIT_STRING_LENGTH] = { 0 }; - char* mCapUnit = &mCapUnits[0], * capUnit = &capUnits[0]; + char* mCapUnit = &mCapUnits[0], *capUnit = &capUnits[0]; mCapacity = C_CAST(double, deviceList[deviceIter].drive_info.deviceMaxLba * deviceList[deviceIter].drive_info.deviceBlockSize); capacity = mCapacity; metric_Unit_Convert(&mCapacity, &mCapUnit); @@ -2113,7 +2113,7 @@ int main(int argc, char *argv[]) { double mCapacity = 0, capacity = 0; char mCapUnits[UNIT_STRING_LENGTH] = { 0 }, capUnits[UNIT_STRING_LENGTH] = { 0 }; - char* mCapUnit = &mCapUnits[0], * capUnit = &capUnits[0]; + char* mCapUnit = &mCapUnits[0], *capUnit = &capUnits[0]; mCapacity = C_CAST(double, deviceList[deviceIter].drive_info.deviceMaxLba * deviceList[deviceIter].drive_info.deviceBlockSize); capacity = mCapacity; metric_Unit_Convert(&mCapacity, &mCapUnit); diff --git a/utils/C/openSeaChest/openSeaChest_Configure.c b/utils/C/openSeaChest/openSeaChest_Configure.c index 263f327..03af155 100644 --- a/utils/C/openSeaChest/openSeaChest_Configure.c +++ b/utils/C/openSeaChest/openSeaChest_Configure.c @@ -126,7 +126,7 @@ int main(int argc, char *argv[]) ATA_DCO_SETMAXMODE_VARS ATA_DCO_DISABLE_FEATURES_VARS - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -779,7 +779,7 @@ int main(int argc, char *argv[]) if (strncmp(optarg, "file", 4) == 0) { //format is file=filename.txt - int sscanfRes = sscanf(optarg, SCSI_SET_MP_SSCANF_FILE_FORMAT_STR , SCSI_SET_MP_FILENAME); + int sscanfRes = sscanf(optarg, SCSI_SET_MP_SSCANF_FILE_FORMAT_STR, SCSI_SET_MP_FILENAME); if (sscanfRes < 1 || sscanfRes == EOF) { print_Error_In_Cmd_Line_Args(SCSI_SET_MP_LONG_OPT_STRING, optarg); @@ -799,7 +799,7 @@ int main(int argc, char *argv[]) else { //formatted as mp[-sp]:byte:highbit:fieldWidth=value - #define PARSE_MP_PAGE_AND_SUBPAGE_LENGTH 8 +#define PARSE_MP_PAGE_AND_SUBPAGE_LENGTH 8 char pageAndSubpage[PARSE_MP_PAGE_AND_SUBPAGE_LENGTH] = { 0 }; char *token = strtok(optarg, ":="); uint8_t tokenCounter = 0; @@ -1170,7 +1170,7 @@ int main(int argc, char *argv[]) { //error, unknown option safe_Free(dcoDisableFeatList) - ATA_DCO_DISABLE_FEATURES = false; + ATA_DCO_DISABLE_FEATURES = false; print_Error_In_Cmd_Line_Args(ATA_DCO_DISABLE_FEEATURES_LONG_OPT_STRING, optarg); exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE); } @@ -1372,7 +1372,7 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } @@ -1494,8 +1494,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -1686,9 +1686,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -1880,7 +1880,7 @@ int main(int argc, char *argv[]) { dcoData dco; memset(&dco, 0, sizeof(dcoData)); - switch(dco_Identify(&deviceList[deviceIter], &dco)) + switch (dco_Identify(&deviceList[deviceIter], &dco)) { case SUCCESS: show_DCO_Identify_Data(&dco); @@ -1995,7 +1995,7 @@ int main(int argc, char *argv[]) dco.mwdma.mwdma1 = false; dco.mwdma.mwdma2 = false; //now go turn modes on to highest supported value - switch(ATA_DCO_SETMAXMODE_VALUE) + switch (ATA_DCO_SETMAXMODE_VALUE) { case 10://udma6 dco.udma.udma6 = true; @@ -3239,7 +3239,7 @@ int main(int argc, char *argv[]) { double mCapacity = 0, capacity = 0; char mCapUnits[UNIT_STRING_LENGTH] = { 0 }, capUnits[UNIT_STRING_LENGTH] = { 0 }; - char* mCapUnit = &mCapUnits[0], * capUnit = &capUnits[0]; + char* mCapUnit = &mCapUnits[0], *capUnit = &capUnits[0]; if (deviceList[deviceIter].drive_info.bridge_info.isValid) { mCapacity = C_CAST(double, deviceList[deviceIter].drive_info.bridge_info.childDeviceMaxLba * deviceList[deviceIter].drive_info.bridge_info.childDeviceBlockSize); @@ -3293,7 +3293,7 @@ int main(int argc, char *argv[]) { double mCapacity = 0, capacity = 0; char mCapUnits[UNIT_STRING_LENGTH] = { 0 }, capUnits[UNIT_STRING_LENGTH] = { 0 }; - char* mCapUnit = &mCapUnits[0], * capUnit = &capUnits[0]; + char* mCapUnit = &mCapUnits[0], *capUnit = &capUnits[0]; if (deviceList[deviceIter].drive_info.bridge_info.isValid) { mCapacity = C_CAST(double, deviceList[deviceIter].drive_info.bridge_info.childDeviceMaxLba * deviceList[deviceIter].drive_info.bridge_info.childDeviceBlockSize); diff --git a/utils/C/openSeaChest/openSeaChest_Erase.c b/utils/C/openSeaChest/openSeaChest_Erase.c index 8736048..285903b 100644 --- a/utils/C/openSeaChest/openSeaChest_Erase.c +++ b/utils/C/openSeaChest/openSeaChest_Erase.c @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) ///////////////// //common utility variables eReturnValues ret = SUCCESS; - int exitCode = UTIL_EXIT_NO_ERROR; + int exitCode = UTIL_EXIT_NO_ERROR; DEVICE_UTIL_VARS DEVICE_INFO_VAR SAT_INFO_VAR @@ -162,7 +162,7 @@ int main(int argc, char *argv[]) ERASE_RESTORE_MAX_VAR REFRESH_FILE_SYSTEMS_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -995,11 +995,11 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } - #if defined (__linux__) +#if defined (__linux__) if (SCAN_FLAGS.scanSD) { scanControl |= SD_HANDLES; @@ -1008,7 +1008,7 @@ int main(int argc, char *argv[]) { scanControl |= SG_TO_SD; } - #endif +#endif //set the drive types to show (if none are set, the lower level code assumes we need to show everything) if (SCAN_FLAGS.scanATA) { @@ -1212,8 +1212,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -1382,9 +1382,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -1394,7 +1394,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1755,7 +1755,7 @@ int main(int argc, char *argv[]) { double mCapacity = 0, capacity = 0; char mCapUnits[UNIT_STRING_LENGTH] = { 0 }, capUnits[UNIT_STRING_LENGTH] = { 0 }; - char* mCapUnit = &mCapUnits[0], * capUnit = &capUnits[0]; + char* mCapUnit = &mCapUnits[0], *capUnit = &capUnits[0]; if (deviceList[deviceIter].drive_info.bridge_info.isValid) { mCapacity = C_CAST(double, deviceList[deviceIter].drive_info.bridge_info.childDeviceMaxLba * deviceList[deviceIter].drive_info.bridge_info.childDeviceBlockSize); @@ -2133,7 +2133,7 @@ int main(int argc, char *argv[]) break; } } - + if (SANITIZE_INFO_FLAG) { sanitizeFeaturesSupported sanitizeOptions; @@ -2385,7 +2385,7 @@ int main(int argc, char *argv[]) if (VERBOSITY_QUIET < toolVerbosity) { printf("Sanitize command failed!\n"); - #if defined (_WIN32) +#if defined (_WIN32) if (!is_Windows_PE()) { printf("\tNote: Windows 8 and higher block sanitize commands.\n"); @@ -2395,7 +2395,7 @@ int main(int argc, char *argv[]) printf("\t are permitted.\n"); printf("\t The Windows PE/RE environments allow all sanitize operations.\n"); } - #endif //_WIN32 +#endif //_WIN32 } exitCode = UTIL_EXIT_OPERATION_FAILURE; break; @@ -3318,16 +3318,16 @@ void utility_Usage(bool shortUsage) print_Fast_Discovery_Help(shortUsage); print_Time_Hours_Help(shortUsage); print_Time_Minutes_Help(shortUsage); - #if !defined(DISABLE_TCG_SUPPORT) +#if !defined(DISABLE_TCG_SUPPORT) print_TCG_PSID_Help(shortUsage); - #endif +#endif print_Time_Seconds_Help(shortUsage); print_Erase_Restore_Max_Prep_Help(shortUsage); print_Refresh_Filesystems_Help(shortUsage); print_Show_Supported_Erase_Modes_Help(shortUsage); - #if !defined(DISABLE_TCG_SUPPORT) +#if !defined(DISABLE_TCG_SUPPORT) print_TCG_SID_Help(shortUsage); - #endif +#endif print_Zero_Verify_Help(shortUsage); //SATA Only Options @@ -3371,10 +3371,10 @@ void utility_Usage(bool shortUsage) print_Sanitize_Overwrite_Passes_Help(shortUsage); print_Pattern_Help(shortUsage); print_Perform_Quickest_Erase_Help(shortUsage); - #if !defined(DISABLE_TCG_SUPPORT) +#if !defined(DISABLE_TCG_SUPPORT) print_Revert_Help(shortUsage); print_RevertSP_Help(shortUsage); - #endif +#endif print_Sanitize_Help(shortUsage, util_name); print_Trim_Unmap_Help(shortUsage); print_Trim_Unmap_Range_Help(shortUsage); diff --git a/utils/C/openSeaChest/openSeaChest_Firmware.c b/utils/C/openSeaChest/openSeaChest_Firmware.c index f99d37d..2f9c3f0 100644 --- a/utils/C/openSeaChest/openSeaChest_Firmware.c +++ b/utils/C/openSeaChest/openSeaChest_Firmware.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) #endif LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -445,11 +445,11 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } - #if defined (__linux__) +#if defined (__linux__) if (SCAN_FLAGS.scanSD) { scanControl |= SD_HANDLES; @@ -458,7 +458,7 @@ int main(int argc, char *argv[]) { scanControl |= SG_TO_SD; } - #endif +#endif //set the drive types to show (if none are set, the lower level code assumes we need to show everything) if (SCAN_FLAGS.scanATA) { @@ -567,8 +567,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -722,9 +722,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -734,7 +734,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } diff --git a/utils/C/openSeaChest/openSeaChest_Format.c b/utils/C/openSeaChest/openSeaChest_Format.c index 707e0d6..1e1abf7 100644 --- a/utils/C/openSeaChest/openSeaChest_Format.c +++ b/utils/C/openSeaChest/openSeaChest_Format.c @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) #endif LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -645,7 +645,7 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } @@ -767,8 +767,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -927,9 +927,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -939,7 +939,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1485,14 +1485,14 @@ int main(int argc, char *argv[]) printf(" entering power saving modes like idle or standby until these operations have\n"); printf(" completed. These operations may take a very long time to complete.\n"); printf(" While EPC timers are suspended during this background operation, manual\n"); - printf(" transitions to lower power states is supported. Manually moving to a lower power\n"); + printf(" transitions to lower power states is supported. Manually moving to a lower power\n"); printf(" state will pause all background activity until the drive has become activate again\n"); printf(" from a command such as a read or write. If forcing a transition\n"); printf(" to idle_a, be aware that this power condition keeps the heads above the medium\n"); printf(" and is considered a special case that the drive firmware will allow it to continue\n"); printf(" these background operations. All EPC timers will be honored once the\n"); printf(" background activity is completed.\n\n"); - + } break; case NOT_SUPPORTED: @@ -1654,7 +1654,7 @@ int main(int argc, char *argv[]) } else { - printf("Successfully started repopulation.\n"); + printf("Successfully started repopulation.\n"); printf("The device may take a long time before it is ready to accept all commands again.\n"); printf("Use \"--%s repop\" or \"--%s\" to check progress.\n", PROGRESS_LONG_OPT_STRING, SHOW_PHYSICAL_ELEMENT_STATUS_LONG_OPT_STRING); } @@ -1950,7 +1950,7 @@ void utility_Usage(bool shortUsage) printf("\t%s -d %s --%s current --%s --%s user\n", util_name, deviceHandleExample, NVM_FORMAT_LONG_OPT_STRING, POLL_LONG_OPT_STRING, NVM_FORMAT_SECURE_ERASE_LONG_OPT_STRING); printf("\t%s -d %s --%s current --%s --%s 1\n", util_name, deviceHandleExample, NVM_FORMAT_LONG_OPT_STRING, POLL_LONG_OPT_STRING, NVM_FORMAT_PI_TYPE_LONG_OPT_STRING); //TODO: Format and NVM format with PI - + //return codes printf("\nReturn codes\n"); printf("============\n"); diff --git a/utils/C/openSeaChest/openSeaChest_GenericTests.c b/utils/C/openSeaChest/openSeaChest_GenericTests.c index a0966a5..0ca384c 100644 --- a/utils/C/openSeaChest/openSeaChest_GenericTests.c +++ b/utils/C/openSeaChest/openSeaChest_GenericTests.c @@ -286,7 +286,7 @@ int main(int argc, char *argv[]) else if (strncmp(longopts[optionIndex].name, ERROR_LIMIT_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(ERROR_LIMIT_LONG_OPT_STRING))) == 0) { ERROR_LIMIT_FLAG = C_CAST(uint16_t, atoi(optarg)); - if(strstr(optarg, "l")) + if (strstr(optarg, "l")) { ERROR_LIMIT_LOGICAL_COUNT = true; } @@ -686,8 +686,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -845,9 +845,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -857,7 +857,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1176,7 +1176,7 @@ int main(int argc, char *argv[]) { printf("Starting long generic test.\n"); } - if(ERROR_LIMIT_LOGICAL_COUNT) + if (ERROR_LIMIT_LOGICAL_COUNT) { ERROR_LIMIT_FLAG *= C_CAST(uint16_t, deviceList[deviceIter].drive_info.devicePhyBlockSize / deviceList[deviceIter].drive_info.deviceBlockSize); } @@ -1244,7 +1244,7 @@ int main(int argc, char *argv[]) { printf("Starting user generic test starting at LBA %"PRIu64" for the range %"PRIu64"\n", USER_GENERIC_START_FLAG, localRange); } - if(ERROR_LIMIT_LOGICAL_COUNT) + if (ERROR_LIMIT_LOGICAL_COUNT) { ERROR_LIMIT_FLAG *= C_CAST(uint16_t, deviceList[deviceIter].drive_info.devicePhyBlockSize / deviceList[deviceIter].drive_info.deviceBlockSize); } @@ -1443,7 +1443,7 @@ int main(int argc, char *argv[]) else if (OdMdIdTestSeconds > 0) { //run a timed OD MD ID test - if(ERROR_LIMIT_LOGICAL_COUNT) + if (ERROR_LIMIT_LOGICAL_COUNT) { ERROR_LIMIT_FLAG *= C_CAST(uint16_t, deviceList[deviceIter].drive_info.devicePhyBlockSize / deviceList[deviceIter].drive_info.deviceBlockSize); } diff --git a/utils/C/openSeaChest/openSeaChest_Info.c b/utils/C/openSeaChest/openSeaChest_Info.c index 78e2f65..ab8b572 100644 --- a/utils/C/openSeaChest/openSeaChest_Info.c +++ b/utils/C/openSeaChest/openSeaChest_Info.c @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) PARTITION_INFO_VAR SHOW_PHY_EVENT_COUNTERS_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -534,8 +534,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -693,7 +693,7 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -705,7 +705,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } diff --git a/utils/C/openSeaChest/openSeaChest_Logs.c b/utils/C/openSeaChest/openSeaChest_Logs.c index 4b9e348..07c274d 100644 --- a/utils/C/openSeaChest/openSeaChest_Logs.c +++ b/utils/C/openSeaChest/openSeaChest_Logs.c @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) LOG_LENGTH_BYTES_VAR LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -492,7 +492,7 @@ int main(int argc, char *argv[]) print_Elevated_Privileges_Text(); } unsigned int scanControl = DEFAULT_SCAN; - if(AGRESSIVE_SCAN_FLAG) + if (AGRESSIVE_SCAN_FLAG) { scanControl |= AGRESSIVE_SCAN; } @@ -614,8 +614,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -635,7 +635,7 @@ int main(int argc, char *argv[]) //check that we were given at least one test to perform...if not, show the help and exit if (!(DEVICE_INFO_FLAG || TEST_UNIT_READY_FLAG - || LOWLEVEL_INFO_FLAG + || LOWLEVEL_INFO_FLAG || LIST_LOGS_FLAG || LIST_ERROR_HISTORY_FLAG || GENERIC_LOG_PULL_FLAG @@ -774,9 +774,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -786,7 +786,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -925,7 +925,7 @@ int main(int argc, char *argv[]) if (PULL_LOG_MODE != PULL_LOG_PIPE_MODE) { printf("\n%s - %s - %s - %s - %s\n", deviceList[deviceIter].os_info.name, deviceList[deviceIter].drive_info.product_identification, deviceList[deviceIter].drive_info.serialNumber, deviceList[deviceIter].drive_info.product_revision, print_drive_type(&deviceList[deviceIter])); - } + } } //now start looking at what operations are going to be performed and kick them off @@ -1025,7 +1025,7 @@ int main(int argc, char *argv[]) } else { - printf("\nLog %" PRIu8 " not supported by %s\n",\ + printf("\nLog %" PRIu8 " not supported by %s\n", \ GENERIC_LOG_DATA_SET, deviceList[deviceIter].drive_info.serialNumber); } } @@ -1316,7 +1316,7 @@ void utility_Usage(bool shortUsage) printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, LOWLEVEL_INFO_LONG_OPT_STRING); printf("\t%s -d %s --%s --%s logs --%s pipe\n", util_name, deviceHandleExample, FARM_LONG_OPT_STRING, PATH_LONG_OPT_STRING, PULL_LOG_MODE_LONG_OPT_STRING); printf("\t%s -d %s --%s --%s 64KiB --%s bin\n", util_name, deviceHandleExample, FARM_COMBINED_LONG_OPT_STRING, LOG_TRANSFER_LENGTH_LONG_OPT_STRING, PULL_LOG_MODE_LONG_OPT_STRING); - printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, DEVICE_STATISTICS_LONG_OPT_STRING); + printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, DEVICE_STATISTICS_LONG_OPT_STRING); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, LIST_LOGS_LONG_OPT_STRING); printf("\t%s -d %s --%s C6h\n", util_name, deviceHandleExample, GENERIC_LOG_LONG_OPT_STRING); printf("\t%s -d %s --%s 0Dh --%s 01h --%s bin\n", util_name, deviceHandleExample, GENERIC_LOG_LONG_OPT_STRING, GENERIC_LOG_SUBPAGE_LONG_OPT_STRING, PULL_LOG_MODE_LONG_OPT_STRING); diff --git a/utils/C/openSeaChest/openSeaChest_NVMe.c b/utils/C/openSeaChest/openSeaChest_NVMe.c index 55f084d..c0e3d76 100644 --- a/utils/C/openSeaChest/openSeaChest_NVMe.c +++ b/utils/C/openSeaChest/openSeaChest_NVMe.c @@ -58,12 +58,12 @@ static void utility_Usage(bool shortUsage); //----------------------------------------------------------------------------- int main(int argc, char *argv[]) { - int exitCode = UTIL_EXIT_NO_ERROR; ///////////////// // Variables // ///////////////// //common utility variables eReturnValues ret = SUCCESS; + int exitCode = UTIL_EXIT_NO_ERROR; DEVICE_UTIL_VARS DEVICE_INFO_VAR SAT_INFO_VAR @@ -110,13 +110,13 @@ int main(int argc, char *argv[]) SHOW_SUPPORTED_FORMATS_VAR LOWLEVEL_INFO_VAR LIST_LOGS_VAR - FORCE_DRIVE_TYPE_VARS + FORCE_DRIVE_TYPE_VARS #if defined (ENABLE_HWRAID_SUPPORT) RAID_PHYSICAL_DRIVE rDevice;//TODO: This should be a list so that we can talk to more than one raid device at a time! #endif - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -505,7 +505,7 @@ int main(int argc, char *argv[]) switch (optopt) { case 0: - //check long options for missing arguments + //check long options for missing arguments break; case DEVICE_SHORT_OPT: if (VERBOSITY_QUIET < toolVerbosity) @@ -640,7 +640,7 @@ int main(int argc, char *argv[]) { scanControl |= AGRESSIVE_SCAN; } - #if defined (__linux__) +#if defined (__linux__) if (SCAN_FLAGS.scanSD) { scanControl |= SD_HANDLES; @@ -649,7 +649,7 @@ int main(int argc, char *argv[]) { scanControl |= SG_TO_SD; } - #endif +#endif //set the drive types to show (if none are set, the lower level code assumes we need to show everything) if (SCAN_FLAGS.scanATA) { @@ -892,7 +892,7 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -904,7 +904,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1578,7 +1578,7 @@ int main(int argc, char *argv[]) } } } - + if (NVME_TEMP_STATS_FLAG) { switch (nvme_Print_Temp_Statistics(&deviceList[deviceIter])) @@ -1586,8 +1586,8 @@ int main(int argc, char *argv[]) case SUCCESS: //nothing to print here since if it was successful, the log will be printed to the screen break; - case NOT_SUPPORTED: - if (VERBOSITY_QUIET < toolVerbosity) + case NOT_SUPPORTED: + if (VERBOSITY_QUIET < toolVerbosity) { printf("Printing Temperature Statistics data is not supported on this drive type.\n"); } @@ -1610,8 +1610,8 @@ int main(int argc, char *argv[]) case SUCCESS: //nothing to print here since if it was successful, the log will be printed to the screen break; - case NOT_SUPPORTED: - if (VERBOSITY_QUIET < toolVerbosity) + case NOT_SUPPORTED: + if (VERBOSITY_QUIET < toolVerbosity) { printf("Printing PCI Statistics data is not supported on this drive type.\n"); } @@ -2240,7 +2240,7 @@ void utility_Usage(bool shortUsage) printf("\tChecking and changing power states:\n"); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, CHECK_POWER_LONG_OPT_STRING); printf("\t%s -d %s --%s 1\n", util_name, deviceHandleExample, TRANSITION_POWER_STATE_LONG_OPT_STRING); - printf("\tPulling the Telemetry log:\n"); + printf("\tPulling the Telemetry log:\n"); printf("\t%s -d %s --%s host\n", util_name, deviceHandleExample, GET_TELEMETRY_LONG_OPT_STRING); printf("\t%s -d %s --%s host, --%s 2 --%s bin\n", util_name, deviceHandleExample, GET_TELEMETRY_LONG_OPT_STRING, TELEMETRY_DATA_AREA_LONG_OPT_STRING, OUTPUT_MODE_LONG_OPT_STRING); //TODO: other log options/feature options diff --git a/utils/C/openSeaChest/openSeaChest_PassthroughTest.c b/utils/C/openSeaChest/openSeaChest_PassthroughTest.c index 9105740..15bed50 100644 --- a/utils/C/openSeaChest/openSeaChest_PassthroughTest.c +++ b/utils/C/openSeaChest/openSeaChest_PassthroughTest.c @@ -63,7 +63,7 @@ typedef struct _passthroughTestParams bool noMultiSectorPIOTest; bool noReturnResponseInfoTest; bool nocheckConditionTest; - + }passthroughTestParams, *ptrPassthroughTestParams; eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs); @@ -109,7 +109,7 @@ static void print_Passthrough_Type_Hint_Help(bool shortHelp) { printf("\t--%s [sat | legacyATA]\n", PT_PTTYPE_HINT_LONG_OPT_STRING); if (!shortHelp) - { + { printf("\t\tAdd this option if the device being tested is likely to support one of\n"); printf("\t\tthe supported passthrough types. This hints to the software to perform\n"); printf("\t\tadditional testing for these passthroughs if no other support is apparent.\n"); @@ -133,7 +133,7 @@ static void print_Disable_PT_Testing_Help(bool shortHelp) { printf("\t--%s\n", DISABLE_PT_TESTING_LONG_OPT_STRING); if (!shortHelp) - { + { printf("\t\tDisables all ATA passthrough testing. Device will only be tested with SCSI commands from\n"); printf("\t\tSPC and SBC specifications.\n\n"); } @@ -148,7 +148,7 @@ static void print_Enable_Legacy_ATA_PT_Testing_Help(bool shortHelp) { printf("\t--%s\n", ENABLE_LEGACY_ATA_PT_TESTING_LONG_OPT_STRING); if (!shortHelp) - { + { printf("\t\tAdd this option to the command line to allow sending legacy passthrough CDBs from\n"); printf("\t\told USB adapters or drivers. By default these are off since these operation codes\n"); printf("\t\tmay perform unintended actions on devices that don't actually support passthrough.\n"); @@ -293,7 +293,7 @@ int main(int argc, char *argv[]) #endif LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -373,7 +373,7 @@ int main(int argc, char *argv[]) //parse long options that have no short option and required arguments here if (strncmp(longopts[optionIndex].name, PT_DRIVE_HINT_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(PT_DRIVE_HINT_LONG_OPT_STRING))) == 0) { - if (strcmp(optarg, "ata") == 0 || strcmp(optarg, "ATA") == 0 || strcmp(optarg, "sata") == 0 || strcmp(optarg, "SATA") == 0 || strcmp(optarg, "pata") == 0 || strcmp(optarg, "PATA") == 0 || strcmp(optarg, "ide") == 0 || strcmp(optarg, "IDE") == 0 ) + if (strcmp(optarg, "ata") == 0 || strcmp(optarg, "ATA") == 0 || strcmp(optarg, "sata") == 0 || strcmp(optarg, "SATA") == 0 || strcmp(optarg, "pata") == 0 || strcmp(optarg, "PATA") == 0 || strcmp(optarg, "ide") == 0 || strcmp(optarg, "IDE") == 0) { PT_DRIVE_HINT = ATA_DRIVE; } @@ -708,8 +708,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -866,7 +866,7 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -878,7 +878,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1070,7 +1070,7 @@ int main(int argc, char *argv[]) params.suspectedPassthroughType = C_CAST(ePassthroughType, PT_PTTYPE_HINT); } perform_Passthrough_Test(¶ms); - + } //At this point, close the device handle since it is no longer needed. Do not put any further IO below this. close_Device(&deviceList[deviceIter]); @@ -1324,7 +1324,7 @@ static void multi_Sector_PIO_Test_With_Logs(tDevice *device, bool gpl, uint8_t l device->drive_info.passThroughHacks.ataPTHacks.multiSectorPIOWithMultipleMode = true; //recursively call this function and try again safe_Free_aligned(log) - multi_Sector_PIO_Test_With_Logs(device, gpl, logAddress, logSize); + multi_Sector_PIO_Test_With_Logs(device, gpl, logAddress, logSize); } else { @@ -1593,7 +1593,7 @@ static void sat_DMA_UDMA_Protocol_Test(tDevice *device, M_ATTR_UNUSED bool smart else if (udmaReadRet == SUCCESS && dmaReadRet == SUCCESS) { printf("Both UDMA and DMA protocols are supported.\n"); - } + } else { set_Console_Colors(true, ERROR_COLOR); @@ -1758,7 +1758,7 @@ static void return_Response_Info_Test(tDevice *device, M_ATTR_UNUSED bool smartS set_Console_Colors(true, HACK_COLOR); printf("HACK FOUND: RS\n");//returnResponseInfoSupported set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - + } } if (device->drive_info.passThroughHacks.ataPTHacks.returnResponseInfoSupported) @@ -1784,7 +1784,7 @@ typedef struct _rawDesignator typedef struct _scsiDevInfo { //inquiry data - struct + struct { char vendorId[T10_VENDOR_ID_LEN + 1]; char productId[INQ_DATA_PRODUCT_ID_LEN + 1]; @@ -1797,7 +1797,7 @@ typedef struct _scsiDevInfo bool satVersionDescriptorFound; }inquiryData; //read capacity data - zeros mean we couldn't read one of these pieces of information. - struct + struct { uint32_t rc10MaxLBA; uint32_t rc10blockSize; @@ -1806,7 +1806,7 @@ typedef struct _scsiDevInfo uint32_t rc16physBlockSize; }readCapData; //vpd page data - struct + struct { bool gotUnitSNVPDPage; char unitSN[255]; @@ -1815,7 +1815,7 @@ typedef struct _scsiDevInfo rawDesignator designators[8]; bool gotSATVPDPage; bool gotPowerConditionsVPDPage; - struct + struct { bool standby_z; bool standby_y; @@ -1831,7 +1831,7 @@ typedef struct _scsiDevInfo bool gotExInquiryVPDPage; uint16_t vpdDSTTimeMinutes;//ext dst from VPD page. If zero, either not reported on this page, or device just doesn't do this translation bool gotBlockCharacteristicsVPDPage; - struct + struct { uint16_t rotationRate; uint8_t productType; @@ -1839,7 +1839,7 @@ typedef struct _scsiDevInfo uint8_t zonedCapabilities; }blockCharacteristicsData; bool gotBlockLimitsVPDPage; - struct + struct { uint32_t maximumXferLen; uint32_t optimalXferLen; @@ -1850,10 +1850,10 @@ typedef struct _scsiDevInfo //TODO: based on reported VPD pages (mode page policy and/or feature sets, etc), create a list of mode pages that are expected to be supported for the mode page test. }vpdData; //Log Page data - struct + struct { bool readErrorsFound; - struct + struct { union { uint32_t readRecoveryAttempts;//ATA @@ -1865,13 +1865,13 @@ typedef struct _scsiDevInfo }; }readErrorData; bool gotTemperature; - struct + struct { uint8_t temperature; uint8_t referenceTemperature; }temperatureData; bool gotStartStop; - struct + struct { union { uint32_t headLoadEvents; @@ -1883,28 +1883,28 @@ typedef struct _scsiDevInfo }; }startStopData; bool gotSelfTestData; - struct + struct { uint32_t totalSelfTestEntries;//Only doing this because it is more complicated to compare the fields with ATA and is not really worth it right now - TJE }selfTestData; bool gotSolidStateData; - struct + struct { uint8_t percentUsedIndicator; }solidStateData; bool gotBackgroundScan; - struct + struct { uint64_t accumulatedPowerOnMinutes;//60 * ATA Power on hours statistic }backgroundData; bool gotZonedStatistics; - struct + struct { //TODO: zoned statistics uint8_t reserved; }zonedData; bool gotGeneralStatistics; - struct + struct { uint64_t numberOfReadCommands; uint64_t numberOfWriteCommands; @@ -1912,12 +1912,12 @@ typedef struct _scsiDevInfo uint64_t numberOfLogicalBlocksTransmitted; }generalStatisticsData; bool gotPendingDefects; - struct + struct { uint32_t pendingDefectsCount; }pendingDefectsData; bool gotInformationalExceptions; - struct + struct { uint8_t asc; uint8_t ascq; @@ -1929,32 +1929,32 @@ typedef struct _scsiDevInfo struct { bool gotControlPage; - struct + struct { bool d_sense; uint16_t extDSTCompletionTimeSeconds;//Seconds //TODO: busy timeout period??? }controlData; bool gotControlExtensionPage;//not in NVMe - struct + struct { uint8_t maxSenseDataLength;//what is it currently set to here...can also be changed here. }controlExtData; bool gotReadWriteErrorRecoveryPage; - struct + struct { bool awre;//true for everything today. Possibly false if it is an old drive....can tell by checking defaults instead of current values. bool arre;//false for ATA, true for NVMe uint16_t recoveryTimeLimit;//0 for all ATA devices according to SAT. NVMe will set this to value of a feature. }rwErrRecData; bool gotCachingPage; - struct + struct { bool wce; bool dra;//not on NVMe ever. }cachingData; bool gotInformationalExceptionsControlPage; - struct + struct { uint8_t mrie; bool ewasc; @@ -1962,7 +1962,7 @@ typedef struct _scsiDevInfo bool perf; }infoExcepData; bool gotRigidDiskPage; - struct + struct { //Storing everything from this page for now. uint32_t numberOfCylinders; @@ -1976,7 +1976,7 @@ typedef struct _scsiDevInfo uint16_t mediumRotationRate; }rigidDiskData; bool gotPowerConditionControlPage;//StdSCSI page - struct + struct { uint8_t pageLength;//to help detect legacy devices since this used to be a shorter page bool standbyY; @@ -1992,7 +1992,7 @@ typedef struct _scsiDevInfo uint32_t standbyYTimer; }powerConditionCtrlData; bool gotPataControlPage;//ATA specific for PATA devices. - struct + struct { bool mwd2; bool mwd1; @@ -2008,7 +2008,7 @@ typedef struct _scsiDevInfo bool udma0; }pataCtrlData; bool gotATAPowerConditionPage;//ATA specific page for APM - struct + struct { bool apmp; uint8_t apmValue; @@ -2025,7 +2025,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("Checking VPD page support\n"); printf("=========================\n"); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - + uint8_t supportedPages[36] = { 0 }; uint8_t dummiedPageCount = 0; bool dummiedPages = false; @@ -2095,7 +2095,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) } uint16_t pagesread = 0; //TODO: validate peripheral qualifier and peripheral device type on every page with std inquiry data - for (uint32_t vpdIter = 4; vpdIter < C_CAST(uint32_t,(supportedVPDPagesLength + 4)) && vpdIter < INQ_RETURN_DATA_LENGTH; vpdIter++) + for (uint32_t vpdIter = 4; vpdIter < C_CAST(uint32_t, (supportedVPDPagesLength + 4)) && vpdIter < INQ_RETURN_DATA_LENGTH; vpdIter++) { bool genericVPDPageReadOutput = true; bool readVPDPage = false; @@ -2234,13 +2234,13 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) switch (codeSet) { case 1://binary values - break; + break; case 2://ASCII printable characters - isASCII = true; - break; + isASCII = true; + break; case 3://UTF-8 codes - isUTF8 = true; - break; + isUTF8 = true; + break; case 0://reserved default://reserved break; @@ -2413,13 +2413,13 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("\t\t\t IEEE Company ID: "); for (uint32_t ieeeVIDOffset = designatorOffset; ieeeVIDOffset < C_CAST(uint32_t, (designatorOffset + 3)); ++ieeeVIDOffset) { - printf("%02" PRIX8 , pageToRead[ieeeVIDOffset]); + printf("%02" PRIX8, pageToRead[ieeeVIDOffset]); } printf("\n"); printf("\t\t\t Vendor Specific Extension Identifier: "); for (uint32_t vuExtIDOffset = designatorOffset + 3; vuExtIDOffset < C_CAST(uint32_t, (designatorOffset + 8)); ++vuExtIDOffset) { - printf("%02" PRIX8 , pageToRead[vuExtIDOffset]); + printf("%02" PRIX8, pageToRead[vuExtIDOffset]); } printf("\n"); break; @@ -2428,19 +2428,19 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("\t\t\t IEEE Company ID: "); for (uint32_t ieeeVIDOffset = designatorOffset; ieeeVIDOffset < C_CAST(uint32_t, (designatorOffset + 3)); ++ieeeVIDOffset) { - printf("%02" PRIX8 , pageToRead[ieeeVIDOffset]); + printf("%02" PRIX8, pageToRead[ieeeVIDOffset]); } printf("\n"); printf("\t\t\t Vendor Specific Extension Identifier: "); for (uint32_t vuExtIDOffset = designatorOffset + 3; vuExtIDOffset < C_CAST(uint32_t, (designatorOffset + 8)); ++vuExtIDOffset) { - printf("%02" PRIX8 , pageToRead[vuExtIDOffset]); + printf("%02" PRIX8, pageToRead[vuExtIDOffset]); } printf("\n"); printf("\t\t\t Directory ID: "); for (uint32_t dIDOffset = designatorOffset + 8; dIDOffset < C_CAST(uint32_t, (designatorOffset + 12)); ++dIDOffset) { - printf("%02" PRIX8 , pageToRead[dIDOffset]); + printf("%02" PRIX8, pageToRead[dIDOffset]); } printf("\n"); break; @@ -2449,19 +2449,19 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("\t\t\t Identifier Extension: "); for (uint32_t idExtOffset = designatorOffset; idExtOffset < C_CAST(uint32_t, (designatorOffset + 8)); ++idExtOffset) { - printf("%02" PRIX8 , pageToRead[idExtOffset]); + printf("%02" PRIX8, pageToRead[idExtOffset]); } printf("\n"); printf("\t\t\t IEEE Company ID: "); for (uint32_t ieeeVIDOffset = designatorOffset + 8; ieeeVIDOffset < C_CAST(uint32_t, (designatorOffset + 11)); ++ieeeVIDOffset) { - printf("%02" PRIX8 , pageToRead[ieeeVIDOffset]); + printf("%02" PRIX8, pageToRead[ieeeVIDOffset]); } printf("\n"); printf("\t\t\t Vendor Specific Extension Identifier: "); for (uint32_t vuExtIDOffset = designatorOffset + 11; vuExtIDOffset < C_CAST(uint32_t, (designatorOffset + 16)); ++vuExtIDOffset) { - printf("%02" PRIX8 , pageToRead[vuExtIDOffset]); + printf("%02" PRIX8, pageToRead[vuExtIDOffset]); } printf("\n"); break; @@ -2471,7 +2471,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) //print it out in hex for (uint32_t euiOffset = designatorOffset; euiOffset < C_CAST(uint32_t, (designatorOffset + designatorLength)); ++euiOffset) { - printf("%02" PRIX8 , pageToRead[euiOffset]); + printf("%02" PRIX8, pageToRead[euiOffset]); } printf("\n"); break; @@ -2498,10 +2498,10 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) case 3://Locally Assigned - binary only printf("\t\t\t NAA Type 3 - Locally Assigned\n"); //Locally administered value - printf("\t\t\t Locally Administered Value: %01" PRIX8 , M_Nibble0(pageToRead[designatorOffset]));//print the first nibble, the rest is all individual bytes + printf("\t\t\t Locally Administered Value: %01" PRIX8, M_Nibble0(pageToRead[designatorOffset]));//print the first nibble, the rest is all individual bytes for (uint16_t lavOffset = designatorOffset + 1; lavOffset < (designatorLength + 4); ++lavOffset) { - printf("%02" PRIX8 , pageToRead[lavOffset]); + printf("%02" PRIX8, pageToRead[lavOffset]); } printf("\n"); break; @@ -2533,7 +2533,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) } else { - printf("%02" PRIX8 , pageToRead[unaaOffset]); + printf("%02" PRIX8, pageToRead[unaaOffset]); } } printf("\n"); @@ -2653,21 +2653,21 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) switch (protocolIdentifier) { case 9://UAS - { - uint8_t deviceAddress = M_GETBITRANGE(pageToRead[designatorOffset], 6, 0); - uint8_t interfaceNumber = pageToRead[designatorOffset + 2]; - printf("\t\t\t UAS Target Port Identifier:\n"); - printf("\t\t\t Device Address: %02" PRIX8 "h\n", deviceAddress); - printf("\t\t\t Interface Number: %02" PRIX8 "h\n", interfaceNumber); - } - break; + { + uint8_t deviceAddress = M_GETBITRANGE(pageToRead[designatorOffset], 6, 0); + uint8_t interfaceNumber = pageToRead[designatorOffset + 2]; + printf("\t\t\t UAS Target Port Identifier:\n"); + printf("\t\t\t Device Address: %02" PRIX8 "h\n", deviceAddress); + printf("\t\t\t Interface Number: %02" PRIX8 "h\n", interfaceNumber); + } + break; case 0xA://SCSI over PCIe - { - uint16_t routingID = M_BytesTo2ByteValue(pageToRead[designatorOffset], pageToRead[designatorOffset + 1]); - printf("\t\t\t PCIe Routing Identifier:\n"); - printf("\t\t\t Routing ID: %04" PRIX16 "h\n", routingID); - } - break; + { + uint16_t routingID = M_BytesTo2ByteValue(pageToRead[designatorOffset], pageToRead[designatorOffset + 1]); + printf("\t\t\t PCIe Routing Identifier:\n"); + printf("\t\t\t Routing ID: %04" PRIX16 "h\n", routingID); + } + break; default://unknown or not defined in SPC5 when this was written printf("\t\t\t Unknown Protocol Specific Port Identifier type!\n"); print_Data_Buffer(&pageToRead[designatorOffset], designatorLength, true); @@ -2694,7 +2694,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) } for (uint16_t uuidOffset = designatorOffset; uuidOffset < (designatorLength + 4); ++uuidOffset) { - printf("%02" PRIX8 , pageToRead[uuidOffset]); + printf("%02" PRIX8, pageToRead[uuidOffset]); } printf("\n"); break; @@ -2712,7 +2712,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) } } //checking if we got an MD5 when we shouldn't have! - if (gotMD5 && (gotEUI64 || gotNAA || gotSCSINameString || gotUUID )) + if (gotMD5 && (gotEUI64 || gotNAA || gotSCSINameString || gotUUID)) { set_Console_Colors(true, WARNING_COLOR); printf("WARNING: Device reported MD5 designator while also reporting a\n"); @@ -2727,7 +2727,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("\t\t\t MD5 Logical Unit Identifier: "); for (; md5Offset < 16; ++md5Offset) { - printf("%02" PRIX8 , pageToRead[md5Offset]); + printf("%02" PRIX8, pageToRead[md5Offset]); } printf("\n"); } @@ -3230,7 +3230,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) set_Console_Colors(true, ERROR_COLOR); printf("ERROR: VPD Page length is less than specified in SBC! Expected %" PRIX16 "h, but got %" PRIX16 "h\n", 0x003C, vpdPageLength); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - } + } else { genericVPDPageReadOutput = false; @@ -3242,7 +3242,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) printf("\tOptimal Transfer Length Granularity: "); if (M_BytesTo2ByteValue(pageToRead[6], pageToRead[7]) > 0) { - printf("%" PRIu16 " Logical Blocks\n", M_BytesTo2ByteValue(pageToRead[6], pageToRead[7])); + printf("%" PRIu16 " Logical Blocks\n", M_BytesTo2ByteValue(pageToRead[6], pageToRead[7])); } else { @@ -3631,7 +3631,7 @@ static void scsi_VPD_Pages(tDevice *device, ptrScsiDevInformation scsiDevInfo) { //vendor specific printf("Vendor Specific VPD Page %02" PRIX8 "h\n", supportedPages[vpdIter]); - } + } else { //unknown page @@ -3661,7 +3661,7 @@ static eReturnValues scsi_Information(tDevice *device, ptrScsiDevInformation scs printf("Reading Inquiry Data\n"); printf("====================\n"); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - + if (SUCCESS == scsi_Inquiry(device, (uint8_t *)&device->drive_info.scsiVpdData.inquiryData, 96, 0, false, false)) { bool continueTesting = false; @@ -3983,7 +3983,7 @@ static eReturnValues scsi_Information(tDevice *device, ptrScsiDevInformation scs } } - + if (!continueTesting) { return NOT_SUPPORTED; @@ -4097,7 +4097,7 @@ static eReturnValues use_Mode_Sense_6(tDevice * device, uint8_t pageCode, bool * { get_Sense_Data_Fields(device->drive_info.lastCommandSenseData, SPC3_SENSE_LEN, &senseFields); if (senseFields.scsiStatusCodes.senseKey == SENSE_KEY_ILLEGAL_REQUEST && senseFields.scsiStatusCodes.asc == 0x20 && senseFields.scsiStatusCodes.ascq == 0x00) - { + { set_Console_Colors(true, ERROR_COLOR); printf("ERROR: This device does not appear to support either mode sense 10 or mode sense 6!\n"); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); @@ -4173,7 +4173,7 @@ static eReturnValues get_SCSI_Mode_Page_Data(tDevice * device, uint8_t pageCode, printf("HACK FOUND: NMSP\n");//mode page subpages are not supported by this device and it does not properly validate all fields of the CDB device->drive_info.passThroughHacks.scsiHacks.noModeSubPages = true; set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - } + } else { //Everything looks ok, so double check the datalength @@ -4235,7 +4235,7 @@ static eReturnValues get_SCSI_Mode_Page_Data(tDevice * device, uint8_t pageCode, printf("HACK FOUND: NMSP\n");//mode page subpages are not supported by this device and it does not properly validate all fields of the CDB device->drive_info.passThroughHacks.scsiHacks.noModeSubPages = true; set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - } + } else { //Everything looks ok, so double check the datalength @@ -4391,7 +4391,7 @@ static eReturnValues scsi_Mode_Information(tDevice *device, ptrScsiDevInformatio safe_Free_aligned(modeData) } safe_Free_aligned(modeData) - + //read write error recovery mode page modeDataLength = MP_READ_WRITE_ERROR_RECOVERY_LEN + commonModeDataLength; modeData = C_CAST(uint8_t *, calloc_aligned(modeDataLength, sizeof(uint8_t), device->os_info.minimumAlignment)); @@ -4425,7 +4425,7 @@ static eReturnValues scsi_Mode_Information(tDevice *device, ptrScsiDevInformatio { printf("Enabled\n"); } - else + else { printf("Disabled\n"); } @@ -4435,7 +4435,7 @@ static eReturnValues scsi_Mode_Information(tDevice *device, ptrScsiDevInformatio { printf("Enabled\n"); } - else + else { printf("Disabled\n"); } @@ -4495,7 +4495,7 @@ static eReturnValues scsi_Mode_Information(tDevice *device, ptrScsiDevInformatio } } safe_Free_aligned(modeData) - + //rigid disk geometry page modeDataLength = MP_RIGID_DISK_GEOMETRY_LEN + commonModeDataLength; modeData = C_CAST(uint8_t *, calloc_aligned(modeDataLength, sizeof(uint8_t), device->os_info.minimumAlignment)); @@ -4573,7 +4573,7 @@ static eReturnValues scsi_Mode_Information(tDevice *device, ptrScsiDevInformatio } } safe_Free_aligned(modeData) - + //informational exceptions mode page modeDataLength = MP_INFORMATION_EXCEPTIONS_LEN + commonModeDataLength; modeData = C_CAST(uint8_t *, calloc_aligned(modeDataLength, sizeof(uint8_t), device->os_info.minimumAlignment)); @@ -4940,7 +4940,7 @@ static eReturnValues scsi_Log_Information(tDevice *device, ptrScsiDevInformation //TODO: Read the length of the current page/subpage, then read the whole thing. Keep this pointer for the rest of the loop below. uint8_t *pageToRead = C_CAST(uint8_t*, calloc_aligned(logPageLength, sizeof(uint8_t), device->os_info.minimumAlignment)); - if (SUCCESS == scsi_Log_Sense_Cmd(device, false, LPC_CUMULATIVE_VALUES,pageCode,subPageCode, 0, pageToRead, logPageLength)) + if (SUCCESS == scsi_Log_Sense_Cmd(device, false, LPC_CUMULATIVE_VALUES, pageCode, subPageCode, 0, pageToRead, logPageLength)) { logPageLength = M_BytesTo2ByteValue(pageToRead[2], pageToRead[3]); uint8_t* temp = realloc_aligned(pageToRead, logPageLength, logPageLength + 4, device->os_info.minimumAlignment); @@ -4966,7 +4966,7 @@ static eReturnValues scsi_Log_Information(tDevice *device, ptrScsiDevInformation set_Console_Colors(true, ERROR_COLOR); printf("ERROR: Expected subpage %" PRIX8 "h, but got %" PRIX8 "h\n", subPageCode, pageToRead[1]); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); - } + } else { readLogPage = true; @@ -5735,7 +5735,7 @@ static eReturnValues scsi_Log_Information(tDevice *device, ptrScsiDevInformation printf("\tPending Defect Count: %" PRIu32 "\n", scsiDevInfo->logData.pendingDefectsData.pendingDefectsCount); break; default: - if (parameterCode >0 && parameterCode <= 0xF000) + if (parameterCode > 0 && parameterCode <= 0xF000) { printf("\tPending Defect %" PRIu16 "\n", parameterCode); uint32_t poh = M_BytesTo4ByteValue(pageToRead[offset + 4], pageToRead[offset + 5], pageToRead[offset + 6], pageToRead[offset + 7]); @@ -6065,7 +6065,7 @@ typedef struct _scsiRWSupport static eReturnValues scsi_Read_Check(tDevice *device, bool zeroLengthTransfers, ptrScsiRWSupport rwSupport, bool testZeroLengthTransfersToo) { - if (!device || ! rwSupport) + if (!device || !rwSupport) { return BAD_PARAMETER; } @@ -6116,7 +6116,7 @@ static eReturnValues scsi_Read_Check(tDevice *device, bool zeroLengthTransfers, } //read 10 - if (SUCCESS == scsi_Read_10(device, 0, false, false, false, 0, 0, C_CAST(uint16_t, transferLength), ptrData,transferLengthBytes)) + if (SUCCESS == scsi_Read_10(device, 0, false, false, false, 0, 0, C_CAST(uint16_t, transferLength), ptrData, transferLengthBytes)) { rwSupport->tenBytes = true; set_Console_Colors(true, HACK_COLOR); @@ -6127,7 +6127,7 @@ static eReturnValues scsi_Read_Check(tDevice *device, bool zeroLengthTransfers, } //read 12 - if (SUCCESS == scsi_Read_12(device, 0, false, false, false, 0, 0, transferLength,ptrData,transferLengthBytes)) + if (SUCCESS == scsi_Read_12(device, 0, false, false, false, 0, 0, transferLength, ptrData, transferLengthBytes)) { rwSupport->twelveBytes = true; set_Console_Colors(true, HACK_COLOR); @@ -6138,7 +6138,7 @@ static eReturnValues scsi_Read_Check(tDevice *device, bool zeroLengthTransfers, } //read 16 - if (SUCCESS == scsi_Read_16(device, 0, false, false, false, 0, 0, transferLength,ptrData,transferLengthBytes)) + if (SUCCESS == scsi_Read_16(device, 0, false, false, false, 0, 0, transferLength, ptrData, transferLengthBytes)) { rwSupport->sixteenBytes = true; set_Console_Colors(true, HACK_COLOR); @@ -6228,7 +6228,7 @@ static bool does_Sense_Data_Show_Invalid_Field_In_CDB(tDevice *device) // return invalidField; // } -static int other_SCSI_Cmd_Support(tDevice *device, ptrOtherSCSICmdSupport scsiCmds) +static eReturnValues other_SCSI_Cmd_Support(tDevice *device, ptrOtherSCSICmdSupport scsiCmds) { if (!device || !scsiCmds) { @@ -6266,7 +6266,7 @@ static int other_SCSI_Cmd_Support(tDevice *device, ptrOtherSCSICmdSupport scsiCm printf("ERROR: Report LUNS failed. This is a critical command!\n"); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); } - + if (SUCCESS == scsi_SecurityProtocol_In(device, 0, 0, false, 512, scsiDataBytes)) { scsiCmds->securityProtocol = true; @@ -6364,7 +6364,7 @@ static int other_SCSI_Cmd_Support(tDevice *device, ptrOtherSCSICmdSupport scsiCm printf("Testing SCSI default self-test.\n"); //send diagnostic for default device self test. Wait up to 5 minutes for this command since some devices could take longer to process this //TODO: it is possible for self-test to fail, which we should catch since it performed the test and didn't return invalid operation code or invalid field in CDB - /*int selfTestResult =*/ scsi_Send_Diagnostic(device, 0, 0, 1, 0, 0, 0, NULL, 0, 5 * 60); + /*eReturnValues selfTestResult =*/ scsi_Send_Diagnostic(device, 0, 0, 1, 0, 0, 0, NULL, 0, 5 * 60); if (!does_Sense_Data_Show_Invalid_OP(device)) { scsiCmds->sendDiagnostic = true; @@ -6501,7 +6501,7 @@ static eReturnValues scsi_Error_Handling_Test(tDevice *device, double *badComman return SUCCESS; } -static int sct_GPL_Test(tDevice *device, bool smartSupported, bool gplSupported, bool sctSupported) +static eReturnValues sct_GPL_Test(tDevice *device, bool smartSupported, bool gplSupported, bool sctSupported) { if (!device) { @@ -7033,7 +7033,7 @@ static bool test_SAT_Capabilities(ptrPassthroughTestParams inputs, ptrScsiDevInf { uint8_t data[512] = { 0 }; eReturnValues retrySAT16 = ata_Read_Log_Ext(inputs->device, ATA_LOG_DIRECTORY, 0, data, 512, false, 0); - if(retrySAT16 == SUCCESS) + if (retrySAT16 == SUCCESS) { printf("SAT 16-byte passthrough supported, but only for 48bit commands!\n"); satSupported = true; @@ -7146,7 +7146,7 @@ static bool test_SAT_Capabilities(ptrPassthroughTestParams inputs, ptrScsiDevInf //In next tests, need to make sure we actually get response information that makes sense. // Will try SMART, get native max LBA first. Then try sending the drive to standby and checking the power mode, then spinning it up and checking again. // Need to make sure we look for ext RTFRs as well. - + if (!inputs->nocheckConditionTest) { check_Condition_Bit_Test(inputs->device, smartSupported, smartLoggingSupported); @@ -7216,17 +7216,17 @@ static bool test_SAT_Capabilities(ptrPassthroughTestParams inputs, ptrScsiDevInf { printf("\tNo Unit serial number reported. Skipping this check\n"); } - + if (scsiInformation->vpdData.gotBlockCharacteristicsVPDPage) { //Check rotation rate (if SCSI reported it)...if this doesn't match, check if it is byte swapped and throw a warning. - if(inputs->device->drive_info.IdentifyData.ata.Word217 != 0 && inputs->device->drive_info.IdentifyData.ata.Word217 != scsiInformation->vpdData.blockCharacteristicsData.rotationRate) + if (inputs->device->drive_info.IdentifyData.ata.Word217 != 0 && inputs->device->drive_info.IdentifyData.ata.Word217 != scsiInformation->vpdData.blockCharacteristicsData.rotationRate) { set_Console_Colors(true, WARNING_COLOR); printf("WARNING: Rotation rate doesn't Match! Got %" PRIu16 ", expected %" PRIu16 "\n", scsiInformation->vpdData.blockCharacteristicsData.rotationRate, inputs->device->drive_info.IdentifyData.ata.Word217); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); byte_Swap_16(&scsiInformation->vpdData.blockCharacteristicsData.rotationRate); - if(inputs->device->drive_info.IdentifyData.ata.Word217 != scsiInformation->vpdData.blockCharacteristicsData.rotationRate) + if (inputs->device->drive_info.IdentifyData.ata.Word217 != scsiInformation->vpdData.blockCharacteristicsData.rotationRate) { set_Console_Colors(true, ERROR_COLOR); printf("ERROR: Even after byteswapping, the rotation rate still doesn't match!!!\n"); @@ -7239,10 +7239,10 @@ static bool test_SAT_Capabilities(ptrPassthroughTestParams inputs, ptrScsiDevInf set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); } } - + //Check form factor (if SCSI reported it)..if this doesn't match, show a warning since this page was otherwise reported. if (M_Nibble0(inputs->device->drive_info.IdentifyData.ata.Word168) != 0 && M_Nibble0(inputs->device->drive_info.IdentifyData.ata.Word168) != scsiInformation->vpdData.blockCharacteristicsData.formFactor) - { + { set_Console_Colors(true, ERROR_COLOR); printf("ERROR: Formfactor doesn't match! Got %" PRIu8 ", expected %" PRIu8 "\n", scsiInformation->vpdData.blockCharacteristicsData.formFactor, M_Nibble0(inputs->device->drive_info.IdentifyData.ata.Word168)); set_Console_Colors(true, CONSOLE_COLOR_DEFAULT); @@ -7291,7 +7291,7 @@ static bool test_SAT_Capabilities(ptrPassthroughTestParams inputs, ptrScsiDevInf //check block sizes and maxLBA values //Throw a warning that the reverse 4k emulation crap is not useful since we are way past Windows XP at this point. - + //TODO: Based on other SCSI reported information, read the ATA logs that the information should come from to compare and make sure it matches, or is close (>= what SCSI reported) // This should be device statistics, other identify data not checked above, command/feature support, EPC settings, etc @@ -7760,7 +7760,7 @@ static eReturnValues ata_PT_Read(tDevice *device, uint64_t lba, bool async, uint } #define MAX_ATA_SECTORS_TO_TEST UINT32_C(4096) -static int ata_Passthrough_Max_Transfer_Length_Test(tDevice *device, uint32_t scsiReportedMax, uint32_t scsiReportedOptimal) +static eReturnValues ata_Passthrough_Max_Transfer_Length_Test(tDevice *device, uint32_t scsiReportedMax, uint32_t scsiReportedOptimal) { uint32_t maxTestSizeBlocks = MAX_ATA_SECTORS_TO_TEST; if (scsiReportedMax > 0) @@ -7788,9 +7788,9 @@ static int ata_Passthrough_Max_Transfer_Length_Test(tDevice *device, uint32_t sc return MEMORY_FAILURE; } //start at 1 sector, then double until 32k. From here, increment one sector at a time since most USB devices only handle 32k properly. - uint32_t transferLengthSectors = 1; + uint32_t transferLengthSectors = 1; eReturnValues readResult = SUCCESS; - while(transferLengthSectors <= maxTestSizeBlocks && readResult == SUCCESS) + while (transferLengthSectors <= maxTestSizeBlocks && readResult == SUCCESS) { readResult = ata_PT_Read(device, 0, false, data, transferLengthSectors * device->drive_info.bridge_info.childDeviceBlockSize); scsi_Test_Unit_Ready(device, NULL); @@ -7880,7 +7880,7 @@ eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs) scsi_Error_Handling_Test(inputs->device, &relativeCommandProcessingPerformance); scsi_Max_Transfer_Length_Test(inputs->device, scsiInformation.vpdData.blockLimitsData.maximumXferLen, scsiInformation.vpdData.blockLimitsData.optimalXferLen); - + //3. Start checking for SAT or VS NVMe passthrough, unless given information to use a different passthrough. //TODO: Make sure to do this only for direct access block devices OR zoned block devices //TODO: Move these passthrough tests to separate functions. @@ -8065,7 +8065,7 @@ eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs) printf("\tPlease include the full output from the tool when sending to seaboard@seagate.com\n"); } printf("\tCommand Processing (bad relative to good): %0.02f\n", relativeCommandProcessingPerformance); - + if (inputs->device->drive_info.passThroughHacks.scsiHacks.maxTransferLength < (MAX_SCSI_SECTORS_TO_TEST * inputs->device->drive_info.deviceBlockSize)) { printf("\tSCSI Max Transfer Size: %" PRIu32 "\n", inputs->device->drive_info.passThroughHacks.scsiHacks.maxTransferLength); @@ -8328,9 +8328,9 @@ eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs) printf(" LIMPT,"); if (inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.getLogPage && (inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.identifyGeneric || - (inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.identifyController && inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.identifyNamespace) - ) - ) + (inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.identifyController && inputs->device->drive_info.passThroughHacks.nvmePTHacks.limitedCommandsSupported.identifyNamespace) + ) + ) { printf(" IDGLP,"); } @@ -8367,7 +8367,7 @@ eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs) printf("\tfixed to prevent these hangs, that is the best solution!\n"); ++recommendationCounter; } - #if defined (__linux__) +#if defined (__linux__) if (inputs->device->drive_info.passThroughHacks.passthroughType == ATA_PASSTHROUGH_UNKNOWN) { printf("%" PRIu8 "\tThis device doesn't support passthrough OR this device is being blacklisted\n", recommendationCounter); @@ -8377,7 +8377,7 @@ eReturnValues perform_Passthrough_Test(ptrPassthroughTestParams inputs) printf("\thandling them correctly in UAS mode.\n"); ++recommendationCounter; } - #endif +#endif if (scsiInformation.vpdData.gotBlockLimitsVPDPage) { //TODO:Check if we hit the maximum in our test: MAX_SCSI_SECTORS_TO_TEST diff --git a/utils/C/openSeaChest/openSeaChest_PowerControl.c b/utils/C/openSeaChest/openSeaChest_PowerControl.c index 047803a..9932da0 100644 --- a/utils/C/openSeaChest/openSeaChest_PowerControl.c +++ b/utils/C/openSeaChest/openSeaChest_PowerControl.c @@ -322,7 +322,7 @@ int main(int argc, char *argv[]) //set the value to change to (watts) //use the lf specifier otherwise it thinks it's a standard float and you won't get the right value. int scanRet = sscanf(optarg, "%lf", &SET_POWER_CONSUMPTION_WATTS_VALUE); -//ctc the check down here needed to change scanRet!=EOF to scanRet==EOF, otherwise command line inputs weren't processed! + //ctc the check down here needed to change scanRet!=EOF to scanRet==EOF, otherwise command line inputs weren't processed! if (scanRet == 0 || scanRet == EOF) { print_Error_In_Cmd_Line_Args(SET_POWER_CONSUMPTION_LONG_OPT_STRING, optarg); @@ -430,7 +430,7 @@ int main(int argc, char *argv[]) print_Error_In_Cmd_Line_Args(SAS_PARTIAL_LONG_OPT_STRING, optarg); exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE); } - } + } else if (strcmp(longopts[optionIndex].name, SAS_SLUMBER_LONG_OPT_STRING) == 0) { if (strcmp(optarg, "info") == 0) @@ -452,7 +452,7 @@ int main(int argc, char *argv[]) print_Error_In_Cmd_Line_Args(SAS_SLUMBER_LONG_OPT_STRING, optarg); exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE); } - } + } else if (strcmp(longopts[optionIndex].name, SET_PHY_SAS_PHY_LONG_OPT_STRING) == 0) { SET_PHY_SAS_PHY_IDENTIFIER = C_CAST(uint8_t, atoi(optarg)); @@ -638,7 +638,7 @@ int main(int argc, char *argv[]) print_Error_In_Cmd_Line_Args(REQUEST_POWER_TELEMETRY_MEASUREMENT_LONG_OPT_STRING, optarg); exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE); } - } + } else if (strcmp(longopts[optionIndex].name, REQUEST_POWER_TELEMETRY_MEASUREMENT_MODE_LONG_OPT_STRING) == 0) { if (strcmp("all", optarg) == 0) @@ -962,8 +962,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -1040,7 +1040,7 @@ int main(int argc, char *argv[]) version.version = DEVICE_BLOCK_VERSION; version.size = sizeof(tDevice); - if (TEST_UNIT_READY_FLAG || CHECK_POWER_FLAG || TRANSITION_POWER_MODE_FLAG || SPIN_DOWN_FLAG + if (TEST_UNIT_READY_FLAG || CHECK_POWER_FLAG || TRANSITION_POWER_MODE_FLAG || SPIN_DOWN_FLAG || (TRANSITION_POWER_STATE_TO >= 0) ) { @@ -1146,7 +1146,7 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -1158,7 +1158,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1494,7 +1494,7 @@ int main(int argc, char *argv[]) { nvmeSupportedPowerStates ps; memset(&ps, 0, sizeof(nvmeSupportedPowerStates)); - switch(get_NVMe_Power_States(&deviceList[deviceIter], &ps)) + switch (get_NVMe_Power_States(&deviceList[deviceIter], &ps)) { case SUCCESS: print_NVM_Power_States(&ps); @@ -2145,7 +2145,7 @@ int main(int argc, char *argv[]) { epcSettings deviceEPCSettings; memset(&deviceEPCSettings, 0, sizeof(epcSettings)); - switch(get_EPC_Settings(&deviceList[deviceIter], &deviceEPCSettings)) + switch (get_EPC_Settings(&deviceList[deviceIter], &deviceEPCSettings)) { case SUCCESS: print_EPC_Settings(&deviceList[deviceIter], &deviceEPCSettings); @@ -2240,9 +2240,9 @@ int main(int argc, char *argv[]) } } - if(SET_APM_LEVEL_FLAG) + if (SET_APM_LEVEL_FLAG) { - switch(set_APM_Level(&deviceList[deviceIter], SET_APM_LEVEL_VALUE_FLAG)) + switch (set_APM_Level(&deviceList[deviceIter], SET_APM_LEVEL_VALUE_FLAG)) { case SUCCESS: if (VERBOSITY_QUIET < toolVerbosity) @@ -2296,29 +2296,29 @@ int main(int argc, char *argv[]) if (SHOW_APM_LEVEL_FLAG) { - switch(get_APM_Level(&deviceList[deviceIter], &SHOW_APM_LEVEL_VALUE_FLAG)) + switch (get_APM_Level(&deviceList[deviceIter], &SHOW_APM_LEVEL_VALUE_FLAG)) { case SUCCESS: if (VERBOSITY_QUIET < toolVerbosity) { printf("Current APM Level is %"PRIu8" (", SHOW_APM_LEVEL_VALUE_FLAG); - if(SHOW_APM_LEVEL_VALUE_FLAG == 0x01) + if (SHOW_APM_LEVEL_VALUE_FLAG == 0x01) { printf("Minimum power consumption with Standby mode"); } - else if(SHOW_APM_LEVEL_VALUE_FLAG >= 0x02 && SHOW_APM_LEVEL_VALUE_FLAG <= 0x7F) + else if (SHOW_APM_LEVEL_VALUE_FLAG >= 0x02 && SHOW_APM_LEVEL_VALUE_FLAG <= 0x7F) { printf("Intermediate power management with Standby mode"); } - else if(SHOW_APM_LEVEL_VALUE_FLAG == 0x80) + else if (SHOW_APM_LEVEL_VALUE_FLAG == 0x80) { printf("Minimum power consumption without Standby mode"); } - else if(SHOW_APM_LEVEL_VALUE_FLAG >= 0x81 && SHOW_APM_LEVEL_VALUE_FLAG <= 0xFD) + else if (SHOW_APM_LEVEL_VALUE_FLAG >= 0x81 && SHOW_APM_LEVEL_VALUE_FLAG <= 0xFD) { printf("Intermediate power management without Standby mode"); } - else if(SHOW_APM_LEVEL_VALUE_FLAG == 0xFE) + else if (SHOW_APM_LEVEL_VALUE_FLAG == 0xFE) { printf("Maximum Performance"); } diff --git a/utils/C/openSeaChest/openSeaChest_Reservations.c b/utils/C/openSeaChest/openSeaChest_Reservations.c index 22f4d87..70af150 100644 --- a/utils/C/openSeaChest/openSeaChest_Reservations.c +++ b/utils/C/openSeaChest/openSeaChest_Reservations.c @@ -105,7 +105,7 @@ int main(int argc, char *argv[]) LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -530,8 +530,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -1053,7 +1053,7 @@ int main(int argc, char *argv[]) exitCode = UTIL_EXIT_OPERATION_NOT_SUPPORTED; } } - + if (SHOW_RESERVATIONS) { if (prSupported) @@ -1140,7 +1140,7 @@ int main(int argc, char *argv[]) } //persistent reservation type must be provided for these options. - if(!PERSISTENT_RESREVATION_TYPE_VALID && (PERSISTENT_RESERVATION_RESERVE || PERSISTENT_RESERVATION_RELEASE || PERSISTENT_RESERVATION_PREEMPT)) + if (!PERSISTENT_RESREVATION_TYPE_VALID && (PERSISTENT_RESERVATION_RESERVE || PERSISTENT_RESERVATION_RELEASE || PERSISTENT_RESERVATION_PREEMPT)) { if (VERBOSITY_QUIET < toolVerbosity) { @@ -1217,7 +1217,7 @@ int main(int argc, char *argv[]) exitCode = UTIL_EXIT_OPERATION_NOT_SUPPORTED; } } - + if (PERSISTENT_RESERVATION_RESERVE) { if (prSupported) @@ -1399,7 +1399,7 @@ void utility_Usage(bool shortUsage) printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, SHOW_REGISTRATION_KEYS_LONG_OPT_STRING); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, SHOW_RESERVATIONS_LONG_OPT_STRING); //TODO: examples of creating a reservation, clearing, aborting, preempting, releasing - + //return codes printf("\nReturn codes\n"); printf("============\n"); diff --git a/utils/C/openSeaChest/openSeaChest_SMART.c b/utils/C/openSeaChest/openSeaChest_SMART.c index a669a25..5754de9 100644 --- a/utils/C/openSeaChest/openSeaChest_SMART.c +++ b/utils/C/openSeaChest/openSeaChest_SMART.c @@ -275,7 +275,7 @@ int main(int argc, char *argv[]) else if (strncmp(longopts[optionIndex].name, ERROR_LIMIT_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(ERROR_LIMIT_LONG_OPT_STRING))) == 0) { ERROR_LIMIT_FLAG = C_CAST(uint16_t, atoi(optarg)); - if(strstr(optarg, "l")) + if (strstr(optarg, "l")) { ERROR_LIMIT_LOGICAL_COUNT = true; } @@ -304,11 +304,11 @@ int main(int argc, char *argv[]) else if (strncmp(longopts[optionIndex].name, SMART_FEATURE_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(SMART_FEATURE_LONG_OPT_STRING))) == 0) { SMART_FEATURE_FLAG = true; - if(strcmp(optarg, "enable") == 0) + if (strcmp(optarg, "enable") == 0) { SMART_FEATURE_STATE_FLAG = true; } - else if(strcmp(optarg, "disable") == 0) + else if (strcmp(optarg, "disable") == 0) { SMART_FEATURE_STATE_FLAG = false; } @@ -321,7 +321,7 @@ int main(int argc, char *argv[]) else if (strncmp(longopts[optionIndex].name, SET_MRIE_MODE_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(SET_MRIE_MODE_LONG_OPT_STRING))) == 0) { SET_MRIE_MODE_FLAG = true; - if(strcmp(optarg, "default") == 0) + if (strcmp(optarg, "default") == 0) { SET_MRIE_MODE_DEFAULT = true; } @@ -333,11 +333,11 @@ int main(int argc, char *argv[]) else if (strncmp(longopts[optionIndex].name, SMART_ATTR_AUTOSAVE_FEATURE_LONG_OPT_STRING, M_Min(strlen(longopts[optionIndex].name), strlen(SMART_ATTR_AUTOSAVE_FEATURE_LONG_OPT_STRING))) == 0) { SMART_ATTR_AUTOSAVE_FEATURE_FLAG = true; - if(strcmp(optarg, "enable") == 0) + if (strcmp(optarg, "enable") == 0) { SMART_ATTR_AUTOSAVE_FEATURE_STATE_FLAG = true; } - else if(strcmp(optarg, "disable") == 0) + else if (strcmp(optarg, "disable") == 0) { SMART_ATTR_AUTOSAVE_FEATURE_STATE_FLAG = false; } @@ -760,8 +760,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -931,9 +931,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -943,7 +943,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } @@ -1303,7 +1303,7 @@ int main(int argc, char *argv[]) break; } } - break; + break; default://error if (VERBOSITY_QUIET < toolVerbosity) { @@ -1800,7 +1800,7 @@ int main(int argc, char *argv[]) { printf("DST And Clean\n"); } - if(ERROR_LIMIT_LOGICAL_COUNT) + if (ERROR_LIMIT_LOGICAL_COUNT) { ERROR_LIMIT_FLAG *= C_CAST(uint16_t, deviceList[deviceIter].drive_info.devicePhyBlockSize / deviceList[deviceIter].drive_info.deviceBlockSize); } @@ -1885,7 +1885,7 @@ int main(int argc, char *argv[]) } } - if(SMART_FEATURE_FLAG) + if (SMART_FEATURE_FLAG) { switch (enable_Disable_SMART_Feature(&deviceList[deviceIter], SMART_FEATURE_STATE_FLAG)) { @@ -1893,7 +1893,7 @@ int main(int argc, char *argv[]) if (VERBOSITY_QUIET < toolVerbosity) { printf("Successfully "); - if(SMART_FEATURE_STATE_FLAG) + if (SMART_FEATURE_STATE_FLAG) { printf("Enabled"); } @@ -1952,7 +1952,7 @@ int main(int argc, char *argv[]) } } - if(SMART_ATTR_AUTOSAVE_FEATURE_FLAG) + if (SMART_ATTR_AUTOSAVE_FEATURE_FLAG) { switch (enable_Disable_SMART_Attribute_Autosave(&deviceList[deviceIter], SMART_ATTR_AUTOSAVE_FEATURE_STATE_FLAG)) { @@ -1960,7 +1960,7 @@ int main(int argc, char *argv[]) if (VERBOSITY_QUIET < toolVerbosity) { printf("Successfully "); - if(SMART_ATTR_AUTOSAVE_FEATURE_STATE_FLAG) + if (SMART_ATTR_AUTOSAVE_FEATURE_STATE_FLAG) { printf("Enabled"); } @@ -2136,11 +2136,11 @@ void utility_Usage(bool shortUsage) printf("\t%s --%s\n", util_name, SCAN_LONG_OPT_STRING); printf("\t%s -d %s -%c\n", util_name, deviceHandleExample, DEVICE_INFO_SHORT_OPT); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, SAT_INFO_LONG_OPT_STRING); - printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, LOWLEVEL_INFO_LONG_OPT_STRING); + printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, LOWLEVEL_INFO_LONG_OPT_STRING); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, SMART_CHECK_LONG_OPT_STRING); printf("\t%s -d %s --%s --%s\n", util_name, deviceHandleExample, SHORT_DST_LONG_OPT_STRING, CAPTIVE_LONG_OPT_STRING); printf("\t%s -d %s --%s --%s\n", util_name, deviceHandleExample, CONVEYANCE_DST_LONG_OPT_STRING, POLL_LONG_OPT_STRING); - printf("\t%s -d %s --%s --%s\n", util_name, deviceHandleExample, LONG_DST_LONG_OPT_STRING, POLL_LONG_OPT_STRING); + printf("\t%s -d %s --%s --%s\n", util_name, deviceHandleExample, LONG_DST_LONG_OPT_STRING, POLL_LONG_OPT_STRING); printf("\t%s -d %s --%s short\n", util_name, deviceHandleExample, IDD_TEST_LONG_OPT_STRING); printf("\t%s -d %s --%s long --%s\n", util_name, deviceHandleExample, IDD_TEST_LONG_OPT_STRING, CAPTIVE_LONG_OPT_STRING); printf("\t%s -d %s --%s\n", util_name, deviceHandleExample, ABORT_DST_LONG_OPT_STRING); @@ -2157,7 +2157,7 @@ void utility_Usage(bool shortUsage) printf("\t%s -d %s --%s summary --%s raw\n", util_name, deviceHandleExample, SHOW_SMART_ERROR_LOG_LONG_OPT_STRING, SMART_ERROR_LOG_FORMAT_LONG_OPT_STRING); printf("\t%s -d %s --%s g --%s bfi\n", util_name, deviceHandleExample, SCSI_DEFECTS_LONG_OPT_STRING, SCSI_DEFECTS_DESCRIPTOR_MODE_LONG_OPT_STRING); printf("\t%s -d %s --%s --%s 40\n", util_name, deviceHandleExample, DST_AND_CLEAN_LONG_OPT_STRING, ERROR_LIMIT_LONG_OPT_STRING); - + //return codes printf("\nReturn codes\n"); printf("============\n"); diff --git a/utils/C/openSeaChest/openSeaChest_Sample.c b/utils/C/openSeaChest/openSeaChest_Sample.c index d1da207..0590621 100644 --- a/utils/C/openSeaChest/openSeaChest_Sample.c +++ b/utils/C/openSeaChest/openSeaChest_Sample.c @@ -64,12 +64,12 @@ int main(int argc, char *argv[]) LICENSE_VAR ECHO_COMMAND_LINE_VAR SCAN_FLAG_VAR - NO_BANNER_VAR + NO_BANNER_VAR AGRESSIVE_SCAN_FLAG_VAR SHOW_BANNER_VAR SHOW_HELP_VAR TEST_UNIT_READY_VAR - FAST_DISCOVERY_VAR + FAST_DISCOVERY_VAR MODEL_MATCH_VARS FW_MATCH_VARS CHILD_MODEL_MATCH_VARS @@ -86,7 +86,7 @@ int main(int argc, char *argv[]) #endif LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -98,7 +98,7 @@ int main(int argc, char *argv[]) SAT_INFO_LONG_OPT, USB_CHILD_INFO_LONG_OPT, SCAN_LONG_OPT, - NO_BANNER_OPT, + NO_BANNER_OPT, AGRESSIVE_SCAN_LONG_OPT, SCAN_FLAGS_LONG_OPT, VERSION_LONG_OPT, @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) LICENSE_LONG_OPT, ECHO_COMMAND_LIN_LONG_OPT, TEST_UNIT_READY_LONG_OPT, - FAST_DISCOVERY_LONG_OPT, + FAST_DISCOVERY_LONG_OPT, ONLY_SEAGATE_LONG_OPT, MODEL_MATCH_LONG_OPT, FW_MATCH_LONG_OPT, @@ -295,7 +295,7 @@ int main(int argc, char *argv[]) if ((VERBOSITY_QUIET < toolVerbosity) && !NO_BANNER_FLAG) { - openseachest_utility_Info(util_name, buildVersion, OPENSEA_TRANSPORT_VERSION); + openseachest_utility_Info(util_name, buildVersion, OPENSEA_TRANSPORT_VERSION); } if (SHOW_BANNER_FLAG) @@ -305,7 +305,7 @@ int main(int argc, char *argv[]) if (LICENSE_FLAG) { - print_EULA_To_Screen(false, false); + print_EULA_To_Screen(); } if (SCAN_FLAG || AGRESSIVE_SCAN_FLAG) @@ -437,8 +437,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -488,10 +488,10 @@ int main(int argc, char *argv[]) flags = DO_NOT_WAKE_DRIVE; } - if (FAST_DISCOVERY_FLAG) - { - flags = FAST_SCAN; - } + if (FAST_DISCOVERY_FLAG) + { + flags = FAST_SCAN; + } //set flags that can be passed down in get device regarding forcing specific ATA modes. if (FORCE_ATA_PIO_FLAG) @@ -540,13 +540,13 @@ int main(int argc, char *argv[]) printf("Unable to get device list\n"); } if (!is_Running_Elevated()) - { - exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); - } - else - { - exit(UTIL_EXIT_OPERATION_FAILURE); - } + { + exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); + } + else + { + exit(UTIL_EXIT_OPERATION_FAILURE); + } } } } @@ -587,7 +587,7 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -599,15 +599,15 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) - { - exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); - } - else - { - exit(UTIL_EXIT_OPERATION_FAILURE); - } - } + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) + { + exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); + } + else + { + exit(UTIL_EXIT_OPERATION_FAILURE); + } + } } } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); @@ -820,7 +820,7 @@ void utility_Usage(bool shortUsage) print_Help_Help(shortUsage); print_License_Help(shortUsage); print_Model_Match_Help(shortUsage); - print_No_Banner_Help(shortUsage); + print_No_Banner_Help(shortUsage); print_Firmware_Revision_Match_Help(shortUsage); print_Only_Seagate_Help(shortUsage); print_Quiet_Help(shortUsage, util_name); @@ -839,7 +839,7 @@ void utility_Usage(bool shortUsage) print_Agressive_Scan_Help(shortUsage); print_SAT_Info_Help(shortUsage); print_Test_Unit_Ready_Help(shortUsage); - print_Fast_Discovery_Help(shortUsage); + print_Fast_Discovery_Help(shortUsage); //utility tests/operations go here - alphabetized //multiple interfaces diff --git a/utils/C/openSeaChest/openSeaChest_Security.c b/utils/C/openSeaChest/openSeaChest_Security.c index 996b194..403d1d5 100644 --- a/utils/C/openSeaChest/openSeaChest_Security.c +++ b/utils/C/openSeaChest/openSeaChest_Security.c @@ -137,7 +137,7 @@ int main(int argc, char *argv[]) ATA_SECURITY_FREEZELOCK_OP_VAR LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -912,10 +912,10 @@ int main(int argc, char *argv[]) } exit(UTIL_EXIT_INVALID_DEVICE_HANDLE); } - + if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -1081,10 +1081,10 @@ int main(int argc, char *argv[]) ret = get_Device(HANDLE_LIST[handleIter], &deviceList[handleIter]); #if !defined(_WIN32) #if !defined(VMK_CROSS_COMP) - if ((deviceList[handleIter].os_info.fd < 0) || + if ((deviceList[handleIter].os_info.fd < 0) || #else - if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + if (((deviceList[handleIter].os_info.fd < 0) && + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif (ret == FAILURE || ret == PERMISSION_DENIED)) #else @@ -1096,7 +1096,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); } diff --git a/utils/C/openSeaChest/openSeaChest_ZBD.c b/utils/C/openSeaChest/openSeaChest_ZBD.c index 02e7ae4..109e5f5 100644 --- a/utils/C/openSeaChest/openSeaChest_ZBD.c +++ b/utils/C/openSeaChest/openSeaChest_ZBD.c @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) #endif LOWLEVEL_INFO_VAR - int args = 0; + int args = 0; int argIndex = 0; int optionIndex = 0; @@ -526,8 +526,8 @@ int main(int argc, char *argv[]) } if ((FORCE_SCSI_FLAG && FORCE_ATA_FLAG) - || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) - || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) + || (FORCE_SCSI_FLAG && FORCE_NVME_FLAG) + || (FORCE_ATA_FLAG && FORCE_NVME_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG && FORCE_ATA_UDMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_DMA_FLAG) || (FORCE_ATA_PIO_FLAG && FORCE_ATA_UDMA_FLAG) @@ -681,9 +681,9 @@ int main(int argc, char *argv[]) if ((deviceList[handleIter].os_info.fd < 0) || #else if (((deviceList[handleIter].os_info.fd < 0) && - (deviceList[handleIter].os_info.nvmeFd == NULL)) || + (deviceList[handleIter].os_info.nvmeFd == NULL)) || #endif - (ret == FAILURE || ret == PERMISSION_DENIED)) + (ret == FAILURE || ret == PERMISSION_DENIED)) #else if ((deviceList[handleIter].os_info.fd == INVALID_HANDLE_VALUE) || (ret == FAILURE || ret == PERMISSION_DENIED)) #endif @@ -693,7 +693,7 @@ int main(int argc, char *argv[]) printf("Error: Could not open handle to %s\n", HANDLE_LIST[handleIter]); } free_Handle_List(&HANDLE_LIST, DEVICE_LIST_COUNT); - if(ret == PERMISSION_DENIED || !is_Running_Elevated()) + if (ret == PERMISSION_DENIED || !is_Running_Elevated()) { exit(UTIL_EXIT_NEED_ELEVATED_PRIVILEGES); }