diff options
author | Alexander Amelkin <alexander@amelkin.msk.ru> | 2020-07-28 13:38:06 +0300 |
---|---|---|
committer | Alexander Amelkin <mocbuhtig@amelkin.msk.ru> | 2020-10-01 20:27:31 +0300 |
commit | 710888479332a46bad78f3d736eff0cbdefd2d1b (patch) | |
tree | 16216061239c41e0441d59e5c0e184a5bdb60360 | |
parent | 1245aaa387dca1cb99408869b2c1b3e2410a1352 (diff) | |
download | ipmitool-710888479332a46bad78f3d736eff0cbdefd2d1b.tar.gz |
hpmfwupg: Clean up / refactor
- Drop a useless `extern` definition
- Remove static variable `errorCount` from header, move it to
the c file where it is actually used if needed
Related to ipmitool/ipmitool#220
Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
-rw-r--r-- | include/ipmitool/ipmi_hpmfwupg.h | 19 | ||||
-rw-r--r-- | lib/ipmi_hpmfwupg.c | 17 |
2 files changed, 17 insertions, 19 deletions
diff --git a/include/ipmitool/ipmi_hpmfwupg.h b/include/ipmitool/ipmi_hpmfwupg.h index 07f597b..d9f78c6 100644 --- a/include/ipmitool/ipmi_hpmfwupg.h +++ b/include/ipmitool/ipmi_hpmfwupg.h @@ -72,23 +72,6 @@ int ipmi_hpmfwupg_main(struct ipmi_intf *, int, char **); #define HPMFWUPG_FW_MISMATCH 0x83 #define HPMFWUPG_ROLLBACK_DENIED 0x83 -/* - * This error code is used as a temporary PATCH to - * the latest Open ipmi driver. This PATCH - * will be removed once a new Open IPMI driver is released. - * (Buggy version = 39) - */ -#define ENABLE_OPENIPMI_V39_PATCH - -#ifdef ENABLE_OPENIPMI_V39_PATCH -# define RETRY_COUNT_MAX 3 -static int errorCount; -# define HPMFWUPG_IS_RETRYABLE(error) \ - ((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE) -#else -# define HPMFWUPG_IS_RETRYABLE(error) FALSE -#endif - /* HPM FIRMWARE UPGRADE GENERAL DEFINITIONS */ #define HPMFWUPG_PICMG_IDENTIFIER 0 #define HPMFWUPG_VERSION_SIZE 6 @@ -800,8 +783,6 @@ typedef struct _VERSIONINFO { char descString[HPMFWUPG_DESC_STRING_LENGTH + 1]; }VERSIONINFO, *PVERSIONINFO; -extern VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; - #define TARGET_VER (0x01) #define ROLLBACK_VER (0x02) #define IMAGE_VER (0x04) diff --git a/lib/ipmi_hpmfwupg.c b/lib/ipmi_hpmfwupg.c index 07096ce..ea9072e 100644 --- a/lib/ipmi_hpmfwupg.c +++ b/lib/ipmi_hpmfwupg.c @@ -49,6 +49,23 @@ # include <config.h> #endif +/* + * This error code is used as a temporary PATCH to + * the latest Open ipmi driver. This PATCH + * will be removed once a new Open IPMI driver is released. + * (Buggy version = 39) + */ +#define ENABLE_OPENIPMI_V39_PATCH + +#ifdef ENABLE_OPENIPMI_V39_PATCH +# define RETRY_COUNT_MAX 3 +static int errorCount; +# define HPMFWUPG_IS_RETRYABLE(error) \ + ((((error==0x83)||(error==0x82)||(error==0x80)) && (errorCount++<RETRY_COUNT_MAX))?TRUE:FALSE) +#else +# define HPMFWUPG_IS_RETRYABLE(error) FALSE +#endif + extern int verbose; VERSIONINFO gVersionInfo[HPMFWUPG_COMPONENT_ID_MAX]; |