Skip to content

Commit

Permalink
feat: Converting int returns to eReturnValues
Browse files Browse the repository at this point in the history
Converting the int return types to eReturnValues since this is what these functions were using to return a status anyways.
This was a massive change throughout all libraries to make this change, but it is more correct and doesn't rely on a silent conversion which throws off C++ code that uses these functions.

Signed-off-by: Tyler Erickson <tyler.erickson@seagate.com>
  • Loading branch information
vonericsen committed May 8, 2024
1 parent bb53715 commit 5ad78cf
Show file tree
Hide file tree
Showing 20 changed files with 331 additions and 336 deletions.
5 changes: 0 additions & 5 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ if c.get_id().contains('gcc') or c.get_id().contains('clang')
'-Wl,-z,relro',
'-Wl,-z,now'
]
if target_machine.cpu_family() == 'ppc64'
#power pc builds generate a lot of warnings/notes about ABI changes since GCC-5
#this flag is disabling them because this is way too noisy.
warning_flags += ['-Wno-psabi']
endif
elif c.get_id().contains('msvc')
#See here for enabling/disabling msvc warnings:
#https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=msvc-170
Expand Down
2 changes: 1 addition & 1 deletion subprojects/opensea-operations
Submodule opensea-operations updated 59 files
+9 −9 include/ata_Security.h
+4 −4 include/ata_device_config_overlay.h
+1 −1 include/buffer_test.h
+7 −7 include/defect.h
+9 −9 include/depopulate.h
+2 −2 include/device_statistics.h
+4 −4 include/drive_info.h
+16 −16 include/dst.h
+1 −1 include/farm_log.h
+2 −2 include/firmware_download.h
+11 −11 include/format.h
+37 −37 include/generic_tests.h
+3 −3 include/host_erase.h
+33 −33 include/logs.h
+8 −8 include/nvme_operations.h
+1 −1 include/opensea_operation_version.h
+26 −26 include/operations.h
+37 −37 include/power_control.h
+13 −13 include/reservations.h
+11 −10 include/sanitize.h
+2 −2 include/sas_phy.h
+1 −1 include/sata_phy.h
+22 −22 include/seagate_operations.h
+2 −2 include/sector_repair.h
+9 −9 include/set_max_lba.h
+27 −27 include/smart.h
+4 −4 include/trim_unmap.h
+3 −3 include/writesame.h
+2 −2 include/zoned_operations.h
+0 −5 meson.build
+20 −20 src/ata_Security.c
+8 −8 src/ata_device_config_overlay.c
+12 −12 src/buffer_test.c
+14 −14 src/defect.c
+21 −21 src/depopulate.c
+15 −15 src/device_statistics.c
+38 −38 src/drive_info.c
+46 −40 src/dst.c
+5 −5 src/farm_log.c
+5 −5 src/firmware_download.c
+29 −29 src/format.c
+52 −52 src/generic_tests.c
+6 −6 src/host_erase.c
+64 −64 src/logs.c
+38 −38 src/nvme_operations.c
+53 −53 src/operations.c
+4 −4 src/partition_info.c
+84 −84 src/power_control.c
+26 −26 src/reservations.c
+27 −27 src/sanitize.c
+6 −6 src/sas_phy.c
+2 −2 src/sata_phy.c
+57 −57 src/seagate_operations.c
+5 −5 src/sector_repair.c
+15 −15 src/set_max_lba.c
+59 −59 src/smart.c
+8 −8 src/trim_unmap.c
+6 −6 src/writesame.c
+4 −4 src/zoned_operations.c
2 changes: 1 addition & 1 deletion subprojects/opensea-transport
Submodule opensea-transport updated 62 files
+54 −0 Make/VS.2019/opensea-transport/opensea-transport/opensea-transport.vcxproj
+9 −0 Make/VS.2019/opensea-transport/opensea-transport/opensea-transport.vcxproj.filters
+16 −15 include/aix_helper.h
+5 −5 include/asmedia_nvme_helper.h
+178 −178 include/ata_helper_func.h
+14 −14 include/cam_helper.h
+5 −5 include/ciss_helper_func.h
+37 −37 include/cmds.h
+28 −30 include/common_public.h
+19 −19 include/csmi_helper_func.h
+3 −3 include/csmi_legacy_pt_cdb_helper.h
+3 −3 include/cypress_legacy_helper.h
+4 −4 include/intel_rst_helper.h
+4 −4 include/jmicron_nvme_helper.h
+3 −3 include/nec_legacy_helper.h
+41 −37 include/nvme_helper_func.h
+4 −4 include/of_nvme_helper_func.h
+3 −3 include/prolific_legacy_helper.h
+4 −4 include/psp_legacy_helper.h
+14 −14 include/sat_helper_func.h
+1 −1 include/sata_helper_func.h
+108 −108 include/scsi_helper_func.h
+19 −19 include/sg_helper.h
+1 −1 include/sntl_helper.h
+2 −2 include/ti_legacy_helper.h
+10 −10 include/uefi_helper.h
+14 −14 include/uscsi_helper.h
+2 −2 include/version.h
+18 −18 include/vm_helper.h
+12 −12 include/win_helper.h
+0 −5 meson.build
+55 −55 src/aix_helper.c
+17 −17 src/asmedia_nvme_helper.c
+221 −221 src/ata_cmds.c
+44 −44 src/ata_helper.c
+50 −50 src/ata_legacy_cmds.c
+43 −42 src/cam_helper.c
+21 −21 src/ciss_helper.c
+58 −58 src/cmds.c
+14 −14 src/common_public.c
+55 −55 src/csmi_helper.c
+5 −5 src/csmi_legacy_pt_cdb_helper.c
+5 −5 src/cypress_legacy_helper.c
+13 −13 src/intel_rst_helper.c
+12 −12 src/jmicron_nvme_helper.c
+6 −6 src/nec_legacy_helper.c
+55 −55 src/nvme_cmds.c
+16 −16 src/nvme_helper.c
+8 −8 src/of_nvme_helper.c
+6 −6 src/prolific_legacy_helper.c
+8 −8 src/psp_legacy_helper.c
+178 −178 src/sat_helper.c
+2 −2 src/sata_helper_func.c
+202 −202 src/scsi_cmds.c
+10 −10 src/scsi_helper.c
+61 −61 src/sg_helper.c
+99 −99 src/sntl_helper.c
+4 −4 src/ti_legacy_helper.c
+44 −44 src/uefi_helper.c
+40 −40 src/uscsi_helper.c
+41 −41 src/vm_helper.c
+184 −184 src/win_helper.c
16 changes: 8 additions & 8 deletions utils/C/openSeaChest/openSeaChest_Basics.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int main(int argc, char *argv[])
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -792,7 +792,7 @@ int main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -874,7 +874,7 @@ int main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down Expand Up @@ -1347,7 +1347,7 @@ int main(int argc, char *argv[])

if (ABORT_DST_FLAG)
{
int abortResult = UNKNOWN;
eReturnValues abortResult = UNKNOWN;
if (VERBOSITY_QUIET < toolVerbosity)
{
printf("Aborting DST\n");
Expand Down Expand Up @@ -1388,7 +1388,7 @@ int main(int argc, char *argv[])

if (SHORT_DST_FLAG)
{
int32_t DSTResult = UNKNOWN;
eReturnValues DSTResult = UNKNOWN;
if (VERBOSITY_QUIET < toolVerbosity)
{
printf("Short DST\n");
Expand Down Expand Up @@ -1955,7 +1955,7 @@ int main(int argc, char *argv[])
//determine if it's timed or a range
if (overwriteSeconds == 0)
{
int overwriteRet = UNKNOWN;
eReturnValues overwriteRet = UNKNOWN;
uint64_t localStartLBA = OVERWRITE_START_FLAG;
uint64_t localRange = OVERWRITE_RANGE_FLAG;
if (USE_MAX_LBA)
Expand Down Expand Up @@ -2013,7 +2013,7 @@ int main(int argc, char *argv[])
{
if (overwriteSeconds > 0)
{
int overwriteRet = UNKNOWN;
eReturnValues overwriteRet = UNKNOWN;
overwriteRet = erase_Time(&deviceList[deviceIter], OVERWRITE_START_FLAG, overwriteSeconds, NULL, 0, HIDE_LBA_COUNTER);
switch (overwriteRet)
{
Expand Down Expand Up @@ -2141,7 +2141,7 @@ int main(int argc, char *argv[])

if (PROGRESS_CHAR != NULL)
{
int result = UNKNOWN;
eReturnValues result = UNKNOWN;
//first take whatever was entered in progressTest and convert it to uppercase to do fewer string comparisons
convert_String_To_Upper_Case(progressTest);
//do some string comparisons to figure out what we are checking for progress on
Expand Down
14 changes: 7 additions & 7 deletions utils/C/openSeaChest/openSeaChest_Configure.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ static void utility_Usage(bool shortUsage);
//! \return exitCode = error code returned by the application
//
//-----------------------------------------------------------------------------
int32_t main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/////////////////
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -1465,7 +1465,7 @@ int32_t main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -1566,7 +1566,7 @@ int32_t main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down Expand Up @@ -3390,7 +3390,7 @@ int32_t main(int argc, char *argv[])
printf("These options will be removed from openSeaChest_Configure in a future release.\n");
puisInfo info;
memset(&info, 0, sizeof(puisInfo));
int puisInfoRet = get_PUIS_Info(&deviceList[deviceIter], &info);
eReturnValues puisInfoRet = get_PUIS_Info(&deviceList[deviceIter], &info);
if (PUIS_FEATURE_SPINUP_FLAG)
{
if (info.puisEnabled)
Expand Down Expand Up @@ -3732,13 +3732,13 @@ int32_t main(int argc, char *argv[])

if (SCSI_RESET_LP_OP)
{
int resetLPResult = SUCCESS;
eReturnValues resetLPResult = SUCCESS;
if (SCSI_RESET_LP_LPC > LPC_DEFAULT_CUMULATIVE_VALUES)
{
//requesting to reset all
for (SCSI_RESET_LP_LPC = LPC_THRESHOLD_VALUES; SCSI_RESET_LP_LPC <= LPC_DEFAULT_CUMULATIVE_VALUES; ++SCSI_RESET_LP_LPC)
{
int resetLPCommandRet = reset_SCSI_Log_Page(&deviceList[deviceIter], C_CAST(eScsiLogPageControl, SCSI_RESET_LP_LPC), SCSI_RESET_LP_PAGE_NUMBER, SCSI_RESET_LP_SUBPAGE_NUMBER, !VOLATILE_FLAG);
eReturnValues resetLPCommandRet = reset_SCSI_Log_Page(&deviceList[deviceIter], C_CAST(eScsiLogPageControl, SCSI_RESET_LP_LPC), SCSI_RESET_LP_PAGE_NUMBER, SCSI_RESET_LP_SUBPAGE_NUMBER, !VOLATILE_FLAG);
if (SUCCESS != resetLPCommandRet)//this is to catch if any LPC reset value creates an error
{
resetLPResult = resetLPCommandRet;
Expand Down
22 changes: 11 additions & 11 deletions utils/C/openSeaChest/openSeaChest_Erase.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ static void utility_Usage(bool shortUsage);
//! \return exitCode = error code returned by the application
//
//-----------------------------------------------------------------------------
int32_t main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/////////////////
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -1180,7 +1180,7 @@ int32_t main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -1259,7 +1259,7 @@ int32_t main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down Expand Up @@ -2500,7 +2500,7 @@ int32_t main(int argc, char *argv[])
formatUnitParameters.defaultFormat = false;//This is true unless we need to write a pattern!!
}
formatUnitParameters.securityInitialize = false;
int formatRet = UNKNOWN;
eReturnValues formatRet = UNKNOWN;
os_Lock_Device(&deviceList[deviceIter]);
os_Unmount_File_Systems_On_Device(&deviceList[deviceIter]);
if (PATTERN_FLAG)
Expand Down Expand Up @@ -2673,7 +2673,7 @@ int32_t main(int argc, char *argv[])
default:
break;
}
int formatRet = run_NVMe_Format(&deviceList[deviceIter], nvmformatParameters, POLL_FLAG);
eReturnValues formatRet = run_NVMe_Format(&deviceList[deviceIter], nvmformatParameters, POLL_FLAG);
switch (formatRet)
{
case SUCCESS:
Expand Down Expand Up @@ -2822,7 +2822,7 @@ int32_t main(int argc, char *argv[])
}
if (DATA_ERASE_FLAG)
{
int writeSameRet = UNKNOWN;
eReturnValues writeSameRet = UNKNOWN;
//NOTE: Changed to automatically setting poll, since write same on SATA is EASILY interrupted by anything other than reading the SCT status log...which is a pain since
// the OS may issue commands when opening the handle and there is not a way to easily handle this on scanning the device. So polling should help make sure nothing
// else goes on while write same is running. - TJE
Expand Down Expand Up @@ -2975,7 +2975,7 @@ int32_t main(int argc, char *argv[])
//determine if it's timed or a range
if (overwriteSeconds == 0)
{
int overwriteRet = UNKNOWN;
eReturnValues overwriteRet = UNKNOWN;
uint64_t localStartLBA = OVERWRITE_START_FLAG;
uint64_t localRange = OVERWRITE_RANGE_FLAG;
if (USE_MAX_LBA)
Expand Down Expand Up @@ -3041,7 +3041,7 @@ int32_t main(int argc, char *argv[])
{
if (overwriteSeconds > 0)
{
int overwriteRet = UNKNOWN;
eReturnValues overwriteRet = UNKNOWN;
if (PATTERN_FLAG)
{
overwriteRet = erase_Time(&deviceList[deviceIter], OVERWRITE_START_FLAG, overwriteSeconds, PATTERN_BUFFER, deviceList[deviceIter].drive_info.deviceBlockSize, HIDE_LBA_COUNTER);
Expand Down Expand Up @@ -3099,7 +3099,7 @@ int32_t main(int argc, char *argv[])

if (PROGRESS_CHAR != NULL)
{
int result = UNKNOWN;
eReturnValues result = UNKNOWN;
//first take whatever was entered in progressTest and convert it to uppercase to do fewer string comparisons
convert_String_To_Upper_Case(progressTest);
//do some string comparisons to figure out what we are checking for progress on
Expand Down Expand Up @@ -3160,7 +3160,7 @@ int32_t main(int argc, char *argv[])
if (eraseCompleted || REFRESH_FILE_SYSTEMS)
{
//update the FS cache since just about all actions in here will need this if they do not already handle it internally.
int fsret = os_Update_File_System_Cache(&deviceList[deviceIter]);
eReturnValues fsret = os_Update_File_System_Cache(&deviceList[deviceIter]);
if (REFRESH_FILE_SYSTEMS)
{
switch (fsret)
Expand Down
8 changes: 4 additions & 4 deletions utils/C/openSeaChest/openSeaChest_Firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ static void utility_Usage(bool shortUsage);
//! \return exitCode = error code returned by the application
//
//-----------------------------------------------------------------------------
int32_t main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/////////////////
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -538,7 +538,7 @@ int32_t main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -602,7 +602,7 @@ int32_t main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down
14 changes: 7 additions & 7 deletions utils/C/openSeaChest/openSeaChest_Format.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ static void utility_Usage(bool shortUsage);
//! \return exitCode = error code returned by the application
//
//-----------------------------------------------------------------------------
int32_t main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/////////////////
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -738,7 +738,7 @@ int32_t main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -807,7 +807,7 @@ int32_t main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down Expand Up @@ -1364,7 +1364,7 @@ int32_t main(int argc, char *argv[])
formatUnitParameters.protectionIntervalExponent = FORMAT_UNIT_PROTECTION_INTERVAL_EXPONENT;
}
formatUnitParameters.securityInitialize = false;
int formatRet = run_Format_Unit(&deviceList[deviceIter], formatUnitParameters, POLL_FLAG);
eReturnValues formatRet = run_Format_Unit(&deviceList[deviceIter], formatUnitParameters, POLL_FLAG);
switch (formatRet)
{
case SUCCESS:
Expand Down Expand Up @@ -1786,7 +1786,7 @@ int32_t main(int argc, char *argv[])
default:
break;
}
int formatRet = run_NVMe_Format(&deviceList[deviceIter], nvmformatParameters, POLL_FLAG);
eReturnValues formatRet = run_NVMe_Format(&deviceList[deviceIter], nvmformatParameters, POLL_FLAG);
switch (formatRet)
{
case SUCCESS:
Expand Down Expand Up @@ -1847,7 +1847,7 @@ int32_t main(int argc, char *argv[])

if (PROGRESS_CHAR != NULL)
{
int result = UNKNOWN;
eReturnValues result = UNKNOWN;
//first take whatever was entered in progressTest and convert it to uppercase to do fewer string comparisons
convert_String_To_Upper_Case(progressTest);
//do some string comparisons to figure out what we are checking for progress on
Expand Down
8 changes: 4 additions & 4 deletions utils/C/openSeaChest/openSeaChest_GenericTests.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ static void utility_Usage(bool shortUsage);
//! \return exitCode = error code returned by the application
//
//-----------------------------------------------------------------------------
int32_t main(int argc, char *argv[])
int main(int argc, char *argv[])
{
/////////////////
// Variables //
/////////////////
//common utility variables
int ret = SUCCESS;
eReturnValues ret = SUCCESS;
int exitCode = UTIL_EXIT_NO_ERROR;
DEVICE_UTIL_VARS
DEVICE_INFO_VAR
Expand Down Expand Up @@ -657,7 +657,7 @@ int32_t main(int argc, char *argv[])

if (RUN_ON_ALL_DRIVES && !USER_PROVIDED_HANDLE)
{
eDiscoveryOptions flags = 0;
uint64_t flags = 0;
if (SUCCESS != get_Device_Count(&DEVICE_LIST_COUNT, flags))
{
if (VERBOSITY_QUIET < toolVerbosity)
Expand Down Expand Up @@ -725,7 +725,7 @@ int32_t main(int argc, char *argv[])
exit(UTIL_EXIT_ERROR_IN_COMMAND_LINE);
}

eDiscoveryOptions flags = 0;
uint64_t flags = 0;
DEVICE_LIST = C_CAST(tDevice*, calloc(DEVICE_LIST_COUNT, sizeof(tDevice)));
if (!DEVICE_LIST)
{
Expand Down
Loading

0 comments on commit 5ad78cf

Please sign in to comment.