diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/auto/arm_accton_as4610.yml b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/auto/arm_accton_as4610.yml index 3c684974..cfbcaa1a 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/auto/arm_accton_as4610.yml +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/auto/arm_accton_as4610.yml @@ -24,45 +24,44 @@ ############################################################ cdefs: &cdefs -- ONLPSIM_CONFIG_INCLUDE_LOGGING: +- ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING: doc: "Include or exclude logging." default: 1 -- ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT: +- ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT: doc: "Default enabled log options." default: AIM_LOG_OPTIONS_DEFAULT -- ONLPSIM_CONFIG_LOG_BITS_DEFAULT: +- ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT: doc: "Default enabled log bits." default: AIM_LOG_BITS_DEFAULT -- ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT: +- ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT: doc: "Default enabled custom log bits." default: 0 -- ONLPSIM_CONFIG_PORTING_STDLIB: +- ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB: doc: "Default all porting macros to use the C standard libraries." default: 1 -- ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: +- ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: doc: "Include standard library headers for stdlib porting macros." - default: ONLPSIM_CONFIG_PORTING_STDLIB -- ONLPSIM_CONFIG_INCLUDE_UCLI: + default: ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB +- ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI: doc: "Include generic uCli support." default: 0 -- ONLPSIM_CONFIG_SFP_COUNT: +- ARM_ACCTON_AS4610_CONFIG_SFP_COUNT: doc: "SFP Count." default: 0 definitions: cdefs: - ONLPSIM_CONFIG_HEADER: + ARM_ACCTON_AS4610_CONFIG_HEADER: defs: *cdefs basename: arm_accton_as4610_config portingmacro: - ONLPSIM: + ARM_ACCTON_AS4610: macros: - malloc - free - memset - memcpy - - strncpy - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_config.h b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_config.h index 09c084d9..561698b6 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_config.h +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_config.h @@ -32,96 +32,96 @@ * @{ * *****************************************************************************/ -#ifndef __ONLPSIM_CONFIG_H__ -#define __ONLPSIM_CONFIG_H__ +#ifndef __ARM_ACCTON_AS4610_CONFIG_H__ +#define __ARM_ACCTON_AS4610_CONFIG_H__ #ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG #include #endif -#ifdef ONLPSIM_INCLUDE_CUSTOM_CONFIG +#ifdef ARM_ACCTON_AS4610_INCLUDE_CUSTOM_CONFIG #include #endif -/* */ +/* */ #include /** - * ONLPSIM_CONFIG_INCLUDE_LOGGING + * ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING * * Include or exclude logging. */ -#ifndef ONLPSIM_CONFIG_INCLUDE_LOGGING -#define ONLPSIM_CONFIG_INCLUDE_LOGGING 1 +#ifndef ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING +#define ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING 1 #endif /** - * ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT + * ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT * * Default enabled log options. */ -#ifndef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT -#define ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT +#define ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT #endif /** - * ONLPSIM_CONFIG_LOG_BITS_DEFAULT + * ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT * * Default enabled log bits. */ -#ifndef ONLPSIM_CONFIG_LOG_BITS_DEFAULT -#define ONLPSIM_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT +#define ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT #endif /** - * ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT * * Default enabled custom log bits. */ -#ifndef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT -#define ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#ifndef ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 #endif /** - * ONLPSIM_CONFIG_PORTING_STDLIB + * ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB * * Default all porting macros to use the C standard libraries. */ -#ifndef ONLPSIM_CONFIG_PORTING_STDLIB -#define ONLPSIM_CONFIG_PORTING_STDLIB 1 +#ifndef ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB +#define ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB 1 #endif /** - * ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS * * Include standard library headers for stdlib porting macros. */ -#ifndef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS -#define ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLPSIM_CONFIG_PORTING_STDLIB +#ifndef ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB #endif /** - * ONLPSIM_CONFIG_INCLUDE_UCLI + * ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI * * Include generic uCli support. */ -#ifndef ONLPSIM_CONFIG_INCLUDE_UCLI -#define ONLPSIM_CONFIG_INCLUDE_UCLI 0 +#ifndef ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI +#define ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI 0 #endif /** - * ONLPSIM_CONFIG_SFP_COUNT + * ARM_ACCTON_AS4610_CONFIG_SFP_COUNT * * SFP Count. */ -#ifndef ONLPSIM_CONFIG_SFP_COUNT -#define ONLPSIM_CONFIG_SFP_COUNT 0 +#ifndef ARM_ACCTON_AS4610_CONFIG_SFP_COUNT +#define ARM_ACCTON_AS4610_CONFIG_SFP_COUNT 0 #endif @@ -154,9 +154,9 @@ const char* arm_accton_as4610_config_lookup(const char* setting); */ int arm_accton_as4610_config_show(struct aim_pvs_s* pvs); -/* */ +/* */ #include "arm_accton_as4610_porting.h" -#endif /* __ONLPSIM_CONFIG_H__ */ +#endif /* __ARM_ACCTON_AS4610_CONFIG_H__ */ /* @} */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_dox.h b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_dox.h index 8a83adb6..072bc7d7 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_dox.h +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_dox.h @@ -28,8 +28,8 @@ * arm_accton_as4610 Doxygen Header * ***********************************************************/ -#ifndef __ONLPSIM_DOX_H__ -#define __ONLPSIM_DOX_H__ +#ifndef __ARM_ACCTON_AS4610_DOX_H__ +#define __ARM_ACCTON_AS4610_DOX_H__ /** * @defgroup arm_accton_as4610 arm_accton_as4610 - onlpsim Description @@ -48,4 +48,4 @@ The documentation overview for this module should go here. * */ -#endif /* __ONLPSIM_DOX_H__ */ +#endif /* __ARM_ACCTON_AS4610_DOX_H__ */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_porting.h b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_porting.h index e29b8611..e888318e 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_porting.h +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/inc/arm_accton_as4610/arm_accton_as4610_porting.h @@ -32,12 +32,12 @@ * @{ * ***********************************************************/ -#ifndef __ONLPSIM_PORTING_H__ -#define __ONLPSIM_PORTING_H__ +#ifndef __ARM_ACCTON_AS4610_PORTING_H__ +#define __ARM_ACCTON_AS4610_PORTING_H__ /* */ -#if ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#if ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 #include #include #include @@ -45,88 +45,78 @@ #include #endif -#ifndef ONLPSIM_MALLOC +#ifndef ARM_ACCTON_AS4610_MALLOC #if defined(GLOBAL_MALLOC) - #define ONLPSIM_MALLOC GLOBAL_MALLOC - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MALLOC malloc + #define ARM_ACCTON_AS4610_MALLOC GLOBAL_MALLOC + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_MALLOC malloc #else - #error The macro ONLPSIM_MALLOC is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_MALLOC is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_FREE +#ifndef ARM_ACCTON_AS4610_FREE #if defined(GLOBAL_FREE) - #define ONLPSIM_FREE GLOBAL_FREE - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_FREE free + #define ARM_ACCTON_AS4610_FREE GLOBAL_FREE + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_FREE free #else - #error The macro ONLPSIM_FREE is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_FREE is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_MEMSET +#ifndef ARM_ACCTON_AS4610_MEMSET #if defined(GLOBAL_MEMSET) - #define ONLPSIM_MEMSET GLOBAL_MEMSET - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MEMSET memset + #define ARM_ACCTON_AS4610_MEMSET GLOBAL_MEMSET + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_MEMSET memset #else - #error The macro ONLPSIM_MEMSET is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_MEMSET is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_MEMCPY +#ifndef ARM_ACCTON_AS4610_MEMCPY #if defined(GLOBAL_MEMCPY) - #define ONLPSIM_MEMCPY GLOBAL_MEMCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MEMCPY memcpy + #define ARM_ACCTON_AS4610_MEMCPY GLOBAL_MEMCPY + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_MEMCPY memcpy #else - #error The macro ONLPSIM_MEMCPY is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_MEMCPY is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define ONLPSIM_STRNCPY GLOBAL_STRNCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRNCPY strncpy - #else - #error The macro ONLPSIM_STRNCPY is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_VSNPRINTF +#ifndef ARM_ACCTON_AS4610_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) - #define ONLPSIM_VSNPRINTF GLOBAL_VSNPRINTF - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_VSNPRINTF vsnprintf + #define ARM_ACCTON_AS4610_VSNPRINTF GLOBAL_VSNPRINTF + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_VSNPRINTF vsnprintf #else - #error The macro ONLPSIM_VSNPRINTF is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_VSNPRINTF is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_SNPRINTF +#ifndef ARM_ACCTON_AS4610_SNPRINTF #if defined(GLOBAL_SNPRINTF) - #define ONLPSIM_SNPRINTF GLOBAL_SNPRINTF - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_SNPRINTF snprintf + #define ARM_ACCTON_AS4610_SNPRINTF GLOBAL_SNPRINTF + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_SNPRINTF snprintf #else - #error The macro ONLPSIM_SNPRINTF is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_SNPRINTF is required but cannot be defined. #endif #endif -#ifndef ONLPSIM_STRLEN +#ifndef ARM_ACCTON_AS4610_STRLEN #if defined(GLOBAL_STRLEN) - #define ONLPSIM_STRLEN GLOBAL_STRLEN - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRLEN strlen + #define ARM_ACCTON_AS4610_STRLEN GLOBAL_STRLEN + #elif ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB == 1 + #define ARM_ACCTON_AS4610_STRLEN strlen #else - #error The macro ONLPSIM_STRLEN is required but cannot be defined. + #error The macro ARM_ACCTON_AS4610_STRLEN is required but cannot be defined. #endif #endif /* */ -#endif /* __ONLPSIM_PORTING_H__ */ +#endif /* __ARM_ACCTON_AS4610_PORTING_H__ */ /* @} */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_config.c b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_config.c index 375c5de7..d8992493 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_config.c +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_config.c @@ -25,50 +25,50 @@ #include -/* */ +/* */ #define __arm_accton_as4610_config_STRINGIFY_NAME(_x) #_x #define __arm_accton_as4610_config_STRINGIFY_VALUE(_x) __arm_accton_as4610_config_STRINGIFY_NAME(_x) arm_accton_as4610_config_settings_t arm_accton_as4610_config_settings[] = { -#ifdef ONLPSIM_CONFIG_INCLUDE_LOGGING - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_LOGGING), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_LOGGING) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING) }, #else -{ ONLPSIM_CONFIG_INCLUDE_LOGGING(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_INCLUDE_LOGGING(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT) }, #else -{ ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_LOG_BITS_DEFAULT - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_BITS_DEFAULT) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT) }, #else -{ ONLPSIM_CONFIG_LOG_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, #else -{ ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_PORTING_STDLIB - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_STDLIB), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_STDLIB) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB) }, #else -{ ONLPSIM_CONFIG_PORTING_STDLIB(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_PORTING_STDLIB(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, #else -{ ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_INCLUDE_UCLI - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_UCLI), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_UCLI) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI) }, #else -{ ONLPSIM_CONFIG_INCLUDE_UCLI(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif -#ifdef ONLPSIM_CONFIG_SFP_COUNT - { __arm_accton_as4610_config_STRINGIFY_NAME(ONLPSIM_CONFIG_SFP_COUNT), __arm_accton_as4610_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_SFP_COUNT) }, +#ifdef ARM_ACCTON_AS4610_CONFIG_SFP_COUNT + { __arm_accton_as4610_config_STRINGIFY_NAME(ARM_ACCTON_AS4610_CONFIG_SFP_COUNT), __arm_accton_as4610_config_STRINGIFY_VALUE(ARM_ACCTON_AS4610_CONFIG_SFP_COUNT) }, #else -{ ONLPSIM_CONFIG_SFP_COUNT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, +{ ARM_ACCTON_AS4610_CONFIG_SFP_COUNT(__arm_accton_as4610_config_STRINGIFY_NAME), "__undefined__" }, #endif { NULL, NULL } }; @@ -97,5 +97,5 @@ arm_accton_as4610_config_show(struct aim_pvs_s* pvs) return i; } -/* */ +/* */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_int.h b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_int.h index 07f4fb00..18c6e300 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_int.h +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_int.h @@ -23,10 +23,10 @@ * ***********************************************************/ -#ifndef __ONLPSIM_INT_H__ -#define __ONLPSIM_INT_H__ +#ifndef __ARM_ACCTON_AS4610_INT_H__ +#define __ARM_ACCTON_AS4610_INT_H__ #include -#endif /* __ONLPSIM_INT_H__ */ +#endif /* __ARM_ACCTON_AS4610_INT_H__ */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.c b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.c index c05e6cef..d6f889ca 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.c +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.c @@ -30,9 +30,9 @@ * arm_accton_as4610 log struct. */ AIM_LOG_STRUCT_DEFINE( - ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT, - ONLPSIM_CONFIG_LOG_BITS_DEFAULT, + ARM_ACCTON_AS4610_CONFIG_LOG_OPTIONS_DEFAULT, + ARM_ACCTON_AS4610_CONFIG_LOG_BITS_DEFAULT, NULL, /* Custom log map */ - ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ARM_ACCTON_AS4610_CONFIG_LOG_CUSTOM_BITS_DEFAULT ); diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.h b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.h index 44cc9bd4..dc959bd1 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.h +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_log.h @@ -23,10 +23,10 @@ * ***********************************************************/ -#ifndef __ONLPSIM_LOG_H__ -#define __ONLPSIM_LOG_H__ +#ifndef __ARM_ACCTON_AS4610_LOG_H__ +#define __ARM_ACCTON_AS4610_LOG_H__ #define AIM_LOG_MODULE_NAME arm_accton_as4610 #include -#endif /* __ONLPSIM_LOG_H__ */ +#endif /* __ARM_ACCTON_AS4610_LOG_H__ */ diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_module.c b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_module.c index 11bb2b47..46897c2a 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_module.c +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_module.c @@ -30,7 +30,7 @@ static int datatypes_init__(void) { -#define ONLPSIM_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#define ARM_ACCTON_AS4610_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); #include return 0; } diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_ucli.c b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_ucli.c index 39483bbb..312da9d0 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_ucli.c +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/arm_accton_as4610_ucli.c @@ -25,7 +25,7 @@ #include -#if ONLPSIM_CONFIG_INCLUDE_UCLI == 1 +#if ARM_ACCTON_AS4610_CONFIG_INCLUDE_UCLI == 1 #include #include diff --git a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/platform_lib.c b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/platform_lib.c index 8746297e..f957697d 100644 --- a/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/platform_lib.c +++ b/packages/platforms/accton/armxx/arm-accton-as4610/arm_accton_as4610/module/src/platform_lib.c @@ -130,7 +130,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) strncmp(model_name, "YM-1151D", strlen("YM-1151D")) == 0 || strncmp(model_name, "YM-1601A", strlen("YM-1601A")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_F2B; } diff --git a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/auto/powerpc_accton_as4600_54t.yml b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/auto/powerpc_accton_as4600_54t.yml index e6f4196e..472146f4 100644 --- a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/auto/powerpc_accton_as4600_54t.yml +++ b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/auto/powerpc_accton_as4600_54t.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h index 36954258..83b589c3 100644 --- a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h +++ b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/inc/powerpc_accton_as4600_54t/powerpc_accton_as4600_54t_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef POWERPC_ACCTON_AS4600_54T_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_ACCTON_AS4600_54T_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_ACCTON_AS4600_54T_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_ACCTON_AS4600_54T_STRNCPY strncpy - #else - #error The macro POWERPC_ACCTON_AS4600_54T_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_ACCTON_AS4600_54T_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_ACCTON_AS4600_54T_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/src/platform_lib.c b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/src/platform_lib.c index 0865f20a..ac7c481b 100644 --- a/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/src/platform_lib.c +++ b/packages/platforms/accton/powerpc/as4600-54t/onlp/builds/powerpc_accton_as4600_54t/module/src/platform_lib.c @@ -333,7 +333,7 @@ int as4600_54t_get_psu_type(int pid, char* modelname, int modelname_len) if(modelname) { /* Return the model name in the given buffer */ - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return ret; diff --git a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/auto/powerpc_accton_as5610_52x.yml b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/auto/powerpc_accton_as5610_52x.yml index ae36490f..c5f201f8 100644 --- a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/auto/powerpc_accton_as5610_52x.yml +++ b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/auto/powerpc_accton_as5610_52x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h index 6ad1547d..465fc026 100644 --- a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h +++ b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/inc/powerpc_accton_as5610_52x/powerpc_accton_as5610_52x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef POWERPC_ACCTON_AS5610_52X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_ACCTON_AS5610_52X_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_ACCTON_AS5610_52X_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_ACCTON_AS5610_52X_STRNCPY strncpy - #else - #error The macro POWERPC_ACCTON_AS5610_52X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_ACCTON_AS5610_52X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_ACCTON_AS5610_52X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/src/platform_lib.c b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/src/platform_lib.c index 7816b3bb..bdcd2008 100644 --- a/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/src/platform_lib.c +++ b/packages/platforms/accton/powerpc/as5610-52x/onlp/builds/powerpc_accton_as5610_52x/module/src/platform_lib.c @@ -529,7 +529,7 @@ as5610_52x_psu_type_t as5610_52x_get_psu_type(int id, char* modelname, int model if(modelname) { /* Return the model name in the given buffer */ - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return ret; diff --git a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/auto/powerpc_accton_as5710_54x.yml b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/auto/powerpc_accton_as5710_54x.yml index aa4a563f..0f30a595 100644 --- a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/auto/powerpc_accton_as5710_54x.yml +++ b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/auto/powerpc_accton_as5710_54x.yml @@ -54,7 +54,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h index c6688c6d..dbac1766 100644 --- a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h +++ b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/inc/powerpc_accton_as5710_54x/powerpc_accton_as5710_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef POWERPC_ACCTON_AS5710_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_ACCTON_AS5710_54X_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_ACCTON_AS5710_54X_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_ACCTON_AS5710_54X_STRNCPY strncpy - #else - #error The macro POWERPC_ACCTON_AS5710_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_ACCTON_AS5710_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_ACCTON_AS5710_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/src/platform_lib.c b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/src/platform_lib.c index 95b10fa9..a9695d2c 100644 --- a/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/powerpc/as5710-54x/onlp/builds/powerpc_accton_as5710_54x/module/src/platform_lib.c @@ -135,13 +135,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_AC_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_AC_B2F; } @@ -154,20 +154,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, 9); + aim_strlcpy(modelname, model_name, 9); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_48V_F2B; } if (strncmp(model_name, "PSU-12V-650", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_DC_HWMON_NODE(psu_fan_dir) : PSU2_DC_HWMON_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/auto/powerpc_accton_as6700_32x.yml b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/auto/powerpc_accton_as6700_32x.yml index 11b3a8da..76d8e701 100644 --- a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/auto/powerpc_accton_as6700_32x.yml +++ b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/auto/powerpc_accton_as6700_32x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h index 49a49125..16c71f80 100644 --- a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h +++ b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/inc/powerpc_accton_as6700_32x/powerpc_accton_as6700_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef POWERPC_ACCTON_AS6700_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_ACCTON_AS6700_32X_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_ACCTON_AS6700_32X_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_ACCTON_AS6700_32X_STRNCPY strncpy - #else - #error The macro POWERPC_ACCTON_AS6700_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_ACCTON_AS6700_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_ACCTON_AS6700_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/src/platform_lib.c b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/src/platform_lib.c index a625c2de..c9de90c7 100644 --- a/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/powerpc/as6700-32x/onlp/builds/powerpc_accton_as6700_32x/module/src/platform_lib.c @@ -128,13 +128,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_B2F; } @@ -147,13 +147,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_F2B; } diff --git a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/auto/x86_64_accton_as4222_28pe.yml b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/auto/x86_64_accton_as4222_28pe.yml index 4e8f49d3..efa21e57 100755 --- a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/auto/x86_64_accton_as4222_28pe.yml +++ b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/auto/x86_64_accton_as4222_28pe.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/inc/x86_64_accton_as4222_28pe/x86_64_accton_as4222_28pe_porting.h b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/inc/x86_64_accton_as4222_28pe/x86_64_accton_as4222_28pe_porting.h index d9ac434d..6e68a0ba 100755 --- a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/inc/x86_64_accton_as4222_28pe/x86_64_accton_as4222_28pe_porting.h +++ b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/inc/x86_64_accton_as4222_28pe/x86_64_accton_as4222_28pe_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS4222_28PE_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS4222_28PE_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS4222_28PE_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS4222_28PE_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS4222_28PE_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS4222_28PE_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS4222_28PE_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/src/ledi.c b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/src/ledi.c index 765e95c3..3fa15344 100755 --- a/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as4222-28pe/onlp/builds/x86_64_accton_as4222_28pe/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as4222_28pe_led::" @@ -52,7 +52,7 @@ enum onlp_led_id LED_FAN, LED_PSU, }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -128,7 +128,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -136,14 +136,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -151,7 +151,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -174,15 +174,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -233,13 +233,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -256,4 +256,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/auto/x86_64_accton_as4630_54pe.yml b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/auto/x86_64_accton_as4630_54pe.yml index c52a7724..5d5a9016 100755 --- a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/auto/x86_64_accton_as4630_54pe.yml +++ b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/auto/x86_64_accton_as4630_54pe.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/inc/x86_64_accton_as4630_54pe/x86_64_accton_as4630_54pe_porting.h b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/inc/x86_64_accton_as4630_54pe/x86_64_accton_as4630_54pe_porting.h index fc30cb5e..82df289b 100755 --- a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/inc/x86_64_accton_as4630_54pe/x86_64_accton_as4630_54pe_porting.h +++ b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/inc/x86_64_accton_as4630_54pe/x86_64_accton_as4630_54pe_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS4630_54PE_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS4630_54PE_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS4630_54PE_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS4630_54PE_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS4630_54PE_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS4630_54PE_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS4630_54PE_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/src/platform_lib.c index 482b2b03..47c16874 100755 --- a/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as4630-54pe/onlp/builds/x86_64_accton_as4630_54pe/module/src/platform_lib.c @@ -109,21 +109,21 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (!strncmp(model_name, "FSH082", strlen("FSH082"))) { if (modelname) - strncpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1)); + aim_strlcpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1)); return PSU_TYPE_ACBEL; } if (!strncmp(model_name, "YM-2651Y", strlen("YM-2651Y"))) { if (modelname) - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); return PSU_TYPE_YM2651Y; } if (!strncmp(model_name, "YPEB1200A", strlen("YPEB1200A"))) { if (modelname) - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); return PSU_TYPE_YPEB1200A; } return PSU_TYPE_UNKNOWN; diff --git a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/auto/x86_64_accton_as5512_54x.yml b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/auto/x86_64_accton_as5512_54x.yml index faef9683..5da00f42 100644 --- a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/auto/x86_64_accton_as5512_54x.yml +++ b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/auto/x86_64_accton_as5512_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/inc/x86_64_accton_as5512_54x/x86_64_accton_as5512_54x_porting.h b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/inc/x86_64_accton_as5512_54x/x86_64_accton_as5512_54x_porting.h index 2533fede..eaaf505c 100644 --- a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/inc/x86_64_accton_as5512_54x/x86_64_accton_as5512_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/inc/x86_64_accton_as5512_54x/x86_64_accton_as5512_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5512_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5512_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5512_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5512_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5512_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5512_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5512_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/fani.c b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/fani.c index c8004c0c..d7688276 100644 --- a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/fani.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as5512_54x_fan/" @@ -155,7 +156,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan/fanr fault status (turn on when any one fails) */ @@ -205,7 +206,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) int psu_id, is_ac=0; int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; psu_type_t psu_type; /* get fan other cap status according to psu type @@ -335,7 +336,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -416,5 +417,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - - diff --git a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/ledi.c b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/ledi.c index 79399200..0f8e46d9 100644 --- a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/ledi.c @@ -28,7 +28,7 @@ #include #include #include - +#include #include #define VALIDATE(_id) \ @@ -196,7 +196,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int fd, len, nbytes=1, local_id; char data[2] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -270,7 +270,7 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int fd, len, driver_mode, nbytes=1, local_id; char data[2] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); diff --git a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/platform_lib.c index 74b785f1..819f47f7 100644 --- a/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5512-54x/onlp/builds/x86_64_accton_as5512_54x/module/src/platform_lib.c @@ -133,13 +133,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_B2F; } @@ -152,13 +152,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_F2B; } diff --git a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/auto/x86_64_accton_as5712_54x.yml b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/auto/x86_64_accton_as5712_54x.yml index 5920c139..365610a7 100644 --- a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/auto/x86_64_accton_as5712_54x.yml +++ b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/auto/x86_64_accton_as5712_54x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h index 428ecaa0..dca4925f 100644 --- a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/inc/x86_64_accton_as5712_54x/x86_64_accton_as5712_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5712_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5712_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5712_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5712_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5712_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5712_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5712_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/src/platform_lib.c index 8055f9c4..3fd13b84 100644 --- a/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5712-54x/onlp/builds/x86_64_accton_as5712_54x/module/src/platform_lib.c @@ -40,20 +40,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) if ((buffer == NULL) || (buf_size < 0)) { return -1; - } - - if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { - return -1; } - if ((len = write(fd, buffer, buf_size)) < 0) { - close(fd); + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); return -1; } if ((close(fd) == -1)) { return -1; - } + } if ((len > buf_size) || (data_len != 0 && len != data_len)) { return -1; @@ -71,25 +71,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len) } int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) - { + { int fd; int len; if ((buffer == NULL) || (buf_size < 0)) { return -1; - } + } if ((fd = open(filename, O_RDONLY)) == -1) { - return -1; + return -1; } if ((len = read(fd, buffer, buf_size)) < 0) { - close(fd); + close(fd); + return -1; + } + + if ((close(fd) == -1)) { return -1; - } - - if ((close(fd) == -1)) { - return -1; } if ((len > buf_size) || (data_len != 0 && len != data_len)) { @@ -106,7 +106,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le if (data_len >= buf_size || data_len < 0) { return -1; } - + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); if (ret == 0) { @@ -117,7 +117,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le buffer[buf_size-1] = '\0'; } } - + return ret; } @@ -135,25 +135,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } @@ -161,20 +161,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) /* Check 3Y-Power AC model name */ memset(model_name, 0, sizeof(model_name)); - node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); + node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JCR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_F2B; } else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JDR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_B2F; } @@ -188,14 +188,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01G")] = 0; - strncpy(modelname, model_name, 10); + aim_strlcpy(modelname, model_name, 10); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01-01G")] = 0; - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_DC_48V_F2B; } @@ -208,7 +208,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value) { int ret = 0; char path[64] = {0}; - + *value = 0; if (PSU1_ID == id) { @@ -248,4 +248,3 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value) return ONLP_STATUS_OK; } - diff --git a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/auto/x86_64_accton_as5812_54t.yml b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/auto/x86_64_accton_as5812_54t.yml index a6146a3f..a182305e 100644 --- a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/auto/x86_64_accton_as5812_54t.yml +++ b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/auto/x86_64_accton_as5812_54t.yml @@ -46,7 +46,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/inc/x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_porting.h b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/inc/x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_porting.h index 015545a2..095b88bd 100644 --- a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/inc/x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_porting.h +++ b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/inc/x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5812_54T_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5812_54T_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5812_54T_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5812_54T_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5812_54T_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5812_54T_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5812_54T_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/fani.c b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/fani.c index 6a0f9772..32d1a014 100644 --- a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/fani.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "platform_lib.h" #include "x86_64_accton_as5812_54t/x86_64_accton_as5812_54t_config.h" @@ -44,7 +45,7 @@ #define FAN_1_ON_PSU1 6 #define FAN_1_ON_PSU2 7 -#define PROJECT_NAME +#define PROJECT_NAME #define LEN_FILE_NAME 50 @@ -134,7 +135,7 @@ onlp_fan_info_t linfo[] = { printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ if (close(fd) == -1) \ return ONLP_STATUS_E_INTERNAL - + /* PSU relative marco */ #define SET_PSU_TYPE_AC_F2B_FAN(info) \ @@ -144,7 +145,7 @@ onlp_fan_info_t linfo[] = { #define SET_PSU_TYPE_AC_B2F_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE - + #define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) @@ -157,46 +158,46 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan/fanr fault status (turn on when any one fails) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - /* get fan/fanr direction (both : the same) + /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*F2B*/ info->status |= ONLP_FAN_STATUS_F2B; - else + else info->status |= ONLP_FAN_STATUS_B2F; /* get fan/fanr speed (take the average of two speeds) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->rpm = atoi(r_data); - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->rpm = (info->rpm + atoi(r_data))/2; /* get speed percentage from rpm */ info->percentage = (info->rpm * 100)/x86_64_accton_as5812_54t_CONFIG_SYS_FAN_FRONT_RPM_MAX; - /* check present */ + /* check present */ if (info->rpm > 0) - info->status |= ONLP_FAN_STATUS_PRESENT; + info->status |= ONLP_FAN_STATUS_PRESENT; return ONLP_STATUS_OK; } @@ -211,7 +212,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info) if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) { info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED; info->rpm = val; - info->percentage = (info->rpm * 100) / 21600; + info->percentage = (info->rpm * 100) / 21600; } return ONLP_STATUS_OK; @@ -223,16 +224,16 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) int psu_id; int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; psu_type_t psu_type; - - /* get fan other cap status according to psu type + + /* get fan other cap status according to psu type */ psu_id = (local_id-FAN_1_ON_PSU1) + 1; - DEBUG_PRINT("[psu_id: %d]", psu_id); - + DEBUG_PRINT("[psu_id: %d]", psu_id); + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ - DEBUG_PRINT("[psu_type: %d]", psu_type); + DEBUG_PRINT("[psu_type: %d]", psu_type); switch (psu_type) { case PSU_TYPE_AC_COMPUWARE_F2B: @@ -251,26 +252,26 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) break; default: if (LOCAL_DEBUG) - printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); break; } - + if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B || psu_type == PSU_TYPE_AC_COMPUWARE_B2F ) { - /* get fan fault status + /* get fan fault status */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - + /* get fan speed */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - info->rpm = atoi(r_data); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); /* get speed percentage from rpm */ info->percentage = (info->rpm * 100)/19328; @@ -314,11 +315,11 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) { case FAN_1_ON_PSU1: case FAN_1_ON_PSU2: - rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); break; default: - rc =_onlp_fani_info_get_fan(local_id, info); + rc =_onlp_fani_info_get_fan(local_id, info); break; } @@ -349,10 +350,10 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm) */ int onlp_fani_percentage_set(onlp_oid_t id, int p) -{ +{ int fd, len, nbytes=10, local_id; - char data[10] = {0}; - char fullpath[70] = {0}; + char data[10] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -362,7 +363,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) if (p == 0){ return ONLP_STATUS_E_INVALID; } - + /* get fullpath */ switch (local_id) { @@ -380,7 +381,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p); } - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); break; } @@ -397,13 +398,13 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) /* Create output file descriptor */ fd = open(fullpath, O_WRONLY, 0644); if(fd == -1){ - return ONLP_STATUS_E_INTERNAL; + return ONLP_STATUS_E_INTERNAL; } - + len = write (fd, data, (ssize_t) nbytes); if(len != nbytes){ - close(fd); - return ONLP_STATUS_E_INTERNAL; + close(fd); + return ONLP_STATUS_E_INTERNAL; } close(fd); @@ -447,5 +448,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - - diff --git a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/ledi.c b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/ledi.c index 6c9e0796..cbe2627a 100644 --- a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -58,15 +59,15 @@ enum led_light_mode { /*must be the same with the definition @ kernel driver */ int led_light_map_mode[][2] = { - {LED_MODE_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_OFF, ONLP_LED_MODE_OFF}, {LED_MODE_GREEN, ONLP_LED_MODE_GREEN}, {LED_MODE_AMBER, ONLP_LED_MODE_ORANGE}, - {LED_MODE_RED, ONLP_LED_MODE_RED}, + {LED_MODE_RED, ONLP_LED_MODE_RED}, {LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, {LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING}, {LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING}, - {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, -}; + {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, +}; #define prefix_path "/sys/class/leds/accton_as5812_54t_led::" @@ -84,7 +85,7 @@ enum onlp_led_id LED_FAN2, LED_FAN3, LED_FAN4, - LED_FAN5, + LED_FAN5, }; static char last_path[][10] = /* must map with onlp_led_id */ @@ -99,7 +100,7 @@ static char last_path[][10] = /* must map with onlp_led_id */ "fan2", "fan3", "fan4", - "fan5", + "fan5", }; /* @@ -135,27 +136,27 @@ static onlp_led_info_t linfo[] = }, { { ONLP_LED_ID_CREATE(LED_FAN1), "Chassis LED 6 (FAN1 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, + ONLP_LED_STATUS_PRESENT, ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED, }, { { ONLP_LED_ID_CREATE(LED_FAN2), "Chassis LED 7 (FAN2 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, + ONLP_LED_STATUS_PRESENT, ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED, }, { { ONLP_LED_ID_CREATE(LED_FAN3), "Chassis LED 8 (FAN3 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, + ONLP_LED_STATUS_PRESENT, ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED, }, { { ONLP_LED_ID_CREATE(LED_FAN4), "Chassis LED 9 (FAN4 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, + ONLP_LED_STATUS_PRESENT, ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED, }, { { ONLP_LED_ID_CREATE(LED_FAN5), "Chassis LED 10 (FAN5 LED)", 0 }, - ONLP_LED_STATUS_PRESENT, + ONLP_LED_STATUS_PRESENT, ONLP_LED_CAPS_GREEN | ONLP_LED_CAPS_RED, }, }; @@ -168,7 +169,7 @@ static int convert_led_light_mode_to_onl(int led_ligth_mode) { if (led_ligth_mode == led_light_map_mode[i][0]) { - return led_light_map_mode[i][1]; + return led_light_map_mode[i][1]; } } return ONLP_LED_MODE_ON; @@ -182,7 +183,7 @@ static int convert_led_light_mode_to_driver(int led_ligth_mode) { if (led_ligth_mode == led_light_map_mode[i][1]) { - return led_light_map_mode[i][0]; + return led_light_map_mode[i][0]; } } return 0; @@ -208,40 +209,40 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) int fd, len, nbytes=1, local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ if (strchr(last_path[local_id], '/') != NULL) { - sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); } else { - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); } - - /* Set the onlp_oid_hdr_t and capabilities */ + + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; /* Set current mode */ if ((fd = open(fullpath, O_RDONLY)) == -1) - { + { return ONLP_STATUS_E_INTERNAL; } - + if ((len = read(fd, data, nbytes)) <= 0) { - close(fd); + close(fd); return ONLP_STATUS_E_INTERNAL; } - + /* If the read byte count is less, the format is different and calc will be wrong*/ if (close(fd) == -1) - { + { return ONLP_STATUS_E_INTERNAL; } @@ -286,37 +287,37 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int fd, len, driver_mode, nbytes=1, local_id; - char data[2] = {0}; - char fullpath[50] = {0}; + char data[2] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ if (strchr(last_path[local_id], '/') != NULL) { - sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); } else { - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); } - + driver_mode = convert_led_light_mode_to_driver(mode); sprintf(data, "%d", driver_mode); - + /* Create output file descriptor */ fd = open(fullpath, O_WRONLY, 0644); if(fd == -1){ - return ONLP_STATUS_E_INTERNAL; + return ONLP_STATUS_E_INTERNAL; } - + len = write (fd, data, (ssize_t) nbytes); if(len != nbytes){ - close(fd); - return ONLP_STATUS_E_INTERNAL; - } + close(fd); + return ONLP_STATUS_E_INTERNAL; + } close(fd); return ONLP_STATUS_OK; @@ -330,4 +331,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/platform_lib.c index 8055f9c4..3fd13b84 100644 --- a/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5812-54t/onlp/builds/x86_64_accton_as5812_54t/module/src/platform_lib.c @@ -40,20 +40,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) if ((buffer == NULL) || (buf_size < 0)) { return -1; - } - - if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { - return -1; } - if ((len = write(fd, buffer, buf_size)) < 0) { - close(fd); + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); return -1; } if ((close(fd) == -1)) { return -1; - } + } if ((len > buf_size) || (data_len != 0 && len != data_len)) { return -1; @@ -71,25 +71,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len) } int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) - { + { int fd; int len; if ((buffer == NULL) || (buf_size < 0)) { return -1; - } + } if ((fd = open(filename, O_RDONLY)) == -1) { - return -1; + return -1; } if ((len = read(fd, buffer, buf_size)) < 0) { - close(fd); + close(fd); + return -1; + } + + if ((close(fd) == -1)) { return -1; - } - - if ((close(fd) == -1)) { - return -1; } if ((len > buf_size) || (data_len != 0 && len != data_len)) { @@ -106,7 +106,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le if (data_len >= buf_size || data_len < 0) { return -1; } - + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); if (ret == 0) { @@ -117,7 +117,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le buffer[buf_size-1] = '\0'; } } - + return ret; } @@ -135,25 +135,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } @@ -161,20 +161,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) /* Check 3Y-Power AC model name */ memset(model_name, 0, sizeof(model_name)); - node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); + node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JCR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_F2B; } else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JDR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_B2F; } @@ -188,14 +188,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01G")] = 0; - strncpy(modelname, model_name, 10); + aim_strlcpy(modelname, model_name, 10); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01-01G")] = 0; - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_DC_48V_F2B; } @@ -208,7 +208,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value) { int ret = 0; char path[64] = {0}; - + *value = 0; if (PSU1_ID == id) { @@ -248,4 +248,3 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value) return ONLP_STATUS_OK; } - diff --git a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/auto/x86_64_accton_as5812_54x.yml b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/auto/x86_64_accton_as5812_54x.yml index b2e4345c..8237a1a4 100644 --- a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/auto/x86_64_accton_as5812_54x.yml +++ b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/auto/x86_64_accton_as5812_54x.yml @@ -46,7 +46,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h index c90124c3..eab19395 100644 --- a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/inc/x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5812_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5812_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5812_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5812_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5812_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5812_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5812_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/fani.c b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/fani.c index 9c9200c1..a9289b6d 100644 --- a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/fani.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "platform_lib.h" #include "x86_64_accton_as5812_54x/x86_64_accton_as5812_54x_config.h" @@ -44,7 +45,7 @@ #define FAN_1_ON_PSU1 6 #define FAN_1_ON_PSU2 7 -#define PROJECT_NAME +#define PROJECT_NAME #define LEN_FILE_NAME 50 @@ -53,7 +54,7 @@ typedef struct last_path_S char status[LEN_FILE_NAME]; char speed[LEN_FILE_NAME]; char direction[LEN_FILE_NAME]; - char ctrl_speed[LEN_FILE_NAME]; + char ctrl_speed[LEN_FILE_NAME]; char r_status[LEN_FILE_NAME]; char r_speed[LEN_FILE_NAME]; }last_path_T; @@ -76,10 +77,10 @@ static last_path_T last_path[] = /* must map with onlp_fan_id */ MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_2_ON_MAIN_BOARD), MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_3_ON_MAIN_BOARD), MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_4_ON_MAIN_BOARD), - MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD), + MAKE_FAN_LAST_PATH_ON_MAIN_BOARD(PROJECT_NAME, FAN_5_ON_MAIN_BOARD), - MAKE_FAN_LAST_PATH_ON_PSU(57-003c), - MAKE_FAN_LAST_PATH_ON_PSU(58-003f), + MAKE_FAN_LAST_PATH_ON_PSU(57-003c), + MAKE_FAN_LAST_PATH_ON_PSU(58-003f), }; #define MAKE_FAN_INFO_NODE_ON_MAIN_BOARD(id) \ @@ -134,7 +135,7 @@ onlp_fan_info_t linfo[] = { printf("[Debug][%s][%d][read data: %s]\n", __FUNCTION__, __LINE__, r_data); \ if (close(fd) == -1) \ return ONLP_STATUS_E_INTERNAL - + /* PSU relative marco */ #define SET_PSU_TYPE_AC_F2B_FAN(info) \ @@ -144,7 +145,7 @@ onlp_fan_info_t linfo[] = { #define SET_PSU_TYPE_AC_B2F_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE - + #define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) @@ -157,46 +158,46 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; - + char fullpath[PATH_MAX] = {0}; + /* get fan/fanr fault status (turn on when any one fails) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_status); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - /* get fan/fanr direction (both : the same) + /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*F2B*/ info->status |= ONLP_FAN_STATUS_F2B; - else + else info->status |= ONLP_FAN_STATUS_B2F; /* get fan/fanr speed (take the average of two speeds) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->rpm = atoi(r_data); - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->rpm = (info->rpm + atoi(r_data))/2; /* get speed percentage from rpm */ info->percentage = (info->rpm * 100)/x86_64_accton_as5812_54x_CONFIG_SYS_FAN_FRONT_RPM_MAX; - /* check present */ + /* check present */ if (info->rpm > 0) - info->status |= ONLP_FAN_STATUS_PRESENT; + info->status |= ONLP_FAN_STATUS_PRESENT; return ONLP_STATUS_OK; } @@ -211,7 +212,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info) if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) { info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED; info->rpm = val; - info->percentage = (info->rpm * 100) / 21600; + info->percentage = (info->rpm * 100) / 21600; } return ONLP_STATUS_OK; @@ -223,16 +224,16 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) int psu_id; int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; psu_type_t psu_type; - - /* get fan other cap status according to psu type + + /* get fan other cap status according to psu type */ psu_id = (local_id-FAN_1_ON_PSU1) + 1; - DEBUG_PRINT("[psu_id: %d]", psu_id); - + DEBUG_PRINT("[psu_id: %d]", psu_id); + psu_type = get_psu_type(psu_id, NULL, 0); /* psu_id = 1 , present PSU1. pus_id =2 , present PSU2 */ - DEBUG_PRINT("[psu_type: %d]", psu_type); + DEBUG_PRINT("[psu_type: %d]", psu_type); switch (psu_type) { case PSU_TYPE_AC_COMPUWARE_F2B: @@ -251,26 +252,26 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) break; default: if (LOCAL_DEBUG) - printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); + printf("[Debug][%s][%d][psu_type=%d]\n", __FUNCTION__, __LINE__, psu_type); break; } - + if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B || psu_type == PSU_TYPE_AC_COMPUWARE_B2F ) { - /* get fan fault status + /* get fan fault status */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - + /* get fan speed */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - info->rpm = atoi(r_data); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); /* get speed percentage from rpm */ info->percentage = (info->rpm * 100)/19328; @@ -280,7 +281,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) { return _onlp_fani_info_get_fan_on_psu_ym2401(psu_id, info); } - + return ONLP_STATUS_OK; } @@ -302,26 +303,26 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) int local_id; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + *info = linfo[local_id]; - + if (LOCAL_DEBUG) printf("\n[Debug][%s][%d][local_id: %d]", __FUNCTION__, __LINE__, local_id); - + switch (local_id) { case FAN_1_ON_PSU1: case FAN_1_ON_PSU2: - rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); break; default: - rc =_onlp_fani_info_get_fan(local_id, info); + rc =_onlp_fani_info_get_fan(local_id, info); break; - } - + } + return rc; } @@ -350,20 +351,20 @@ onlp_fani_rpm_set(onlp_oid_t id, int rpm) */ int onlp_fani_percentage_set(onlp_oid_t id, int p) -{ +{ int fd, len, nbytes=10, local_id; - char data[10] = {0}; - char fullpath[70] = {0}; + char data[10] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); /* reject p=0 (p=0, stop fan) */ if (p == 0){ return ONLP_STATUS_E_INVALID; } - + /* get fullpath */ switch (local_id) { @@ -381,7 +382,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p); } - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, last_path[local_id].ctrl_speed); break; } @@ -389,23 +390,23 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, last_path[local_id].ctrl_speed); break; } - + sprintf(data, "%d", p); if (LOCAL_DEBUG) printf("[Debug][%s][%d][openfile: %s][data=%s]\n", __FUNCTION__, __LINE__, fullpath, data); - + /* Create output file descriptor */ fd = open(fullpath, O_WRONLY, 0644); if(fd == -1){ - return ONLP_STATUS_E_INTERNAL; + return ONLP_STATUS_E_INTERNAL; } - + len = write (fd, data, (ssize_t) nbytes); if(len != nbytes){ - close(fd); - return ONLP_STATUS_E_INTERNAL; - } + close(fd); + return ONLP_STATUS_E_INTERNAL; + } close(fd); return ONLP_STATUS_OK; @@ -448,5 +449,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - - diff --git a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/ledi.c b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/ledi.c index c84ebe5a..5c834131 100644 --- a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -50,20 +51,20 @@ enum led_light_mode { /*must be the same with the definition @ kernel driver */ LED_MODE_GREEN_BLINK, LED_MODE_AMBER_BLINK, LED_MODE_RED_BLINK, - LED_MODE_AUTO, + LED_MODE_AUTO, }; int led_light_map_mode[][2] = { - {LED_MODE_OFF, ONLP_LED_MODE_OFF}, + {LED_MODE_OFF, ONLP_LED_MODE_OFF}, {LED_MODE_GREEN, ONLP_LED_MODE_GREEN}, {LED_MODE_AMBER, ONLP_LED_MODE_ORANGE}, - {LED_MODE_RED, ONLP_LED_MODE_RED}, + {LED_MODE_RED, ONLP_LED_MODE_RED}, {LED_MODE_GREEN_BLINK, ONLP_LED_MODE_GREEN_BLINKING}, {LED_MODE_AMBER_BLINK, ONLP_LED_MODE_ORANGE_BLINKING}, {LED_MODE_RED_BLINK, ONLP_LED_MODE_RED_BLINKING}, - {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, -}; + {LED_MODE_AUTO, ONLP_LED_MODE_AUTO}, +}; #define prefix_path "/sys/class/leds/accton_as5812_54x_led::" @@ -81,7 +82,7 @@ enum onlp_led_id LED_FAN2, LED_FAN3, LED_FAN4, - LED_FAN5, + LED_FAN5, }; static char last_path[][10] = /* must map with onlp_led_id */ @@ -96,7 +97,7 @@ static char last_path[][10] = /* must map with onlp_led_id */ "fan2", "fan3", "fan4", - "fan5", + "fan5", }; /* @@ -160,7 +161,7 @@ static int conver_led_light_mode_to_onl(int led_ligth_mode) { if (led_ligth_mode == led_light_map_mode[i][0]) { - return led_light_map_mode[i][1]; + return led_light_map_mode[i][1]; } } return 0; @@ -174,7 +175,7 @@ static int conver_led_light_mode_to_driver(int led_ligth_mode) { if (led_ligth_mode == led_light_map_mode[i][1]) { - return led_light_map_mode[i][0]; + return led_light_map_mode[i][0]; } } return 0; @@ -200,40 +201,40 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) int fd, len, nbytes=1, local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ if (strchr(last_path[local_id], '/') != NULL) { - sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); } else { - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); } - - /* Set the onlp_oid_hdr_t and capabilities */ + + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; /* Set current mode */ if ((fd = open(fullpath, O_RDONLY)) == -1) - { + { return ONLP_STATUS_E_INTERNAL; } - + if ((len = read(fd, data, nbytes)) <= 0) { - close(fd); + close(fd); return ONLP_STATUS_E_INTERNAL; } - + /* If the read byte count is less, the format is different and calc will be wrong*/ if (close(fd) == -1) - { + { return ONLP_STATUS_E_INTERNAL; } @@ -278,37 +279,37 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int fd, len, driver_mode, nbytes=1, local_id; - char data[2] = {0}; - char fullpath[50] = {0}; + char data[2] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ if (strchr(last_path[local_id], '/') != NULL) { - sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); + sprintf(fullpath, "%s%s", prefix_path, last_path[local_id]); } else { - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); } - + driver_mode = conver_led_light_mode_to_driver(mode); sprintf(data, "%d", driver_mode); - + /* Create output file descriptor */ fd = open(fullpath, O_WRONLY, 0644); if(fd == -1){ - return ONLP_STATUS_E_INTERNAL; + return ONLP_STATUS_E_INTERNAL; } - + len = write (fd, data, (ssize_t) nbytes); if(len != nbytes){ - close(fd); - return ONLP_STATUS_E_INTERNAL; - } + close(fd); + return ONLP_STATUS_E_INTERNAL; + } close(fd); return ONLP_STATUS_OK; @@ -322,4 +323,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/platform_lib.c index aa49b53d..48a29093 100755 --- a/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5812-54x/onlp/builds/x86_64_accton_as5812_54x/module/src/platform_lib.c @@ -42,20 +42,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) if ((buffer == NULL) || (buf_size < 0)) { return -1; - } - - if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { - return -1; } - if ((len = write(fd, buffer, buf_size)) < 0) { - close(fd); + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); return -1; } if ((close(fd) == -1)) { return -1; - } + } if ((len > buf_size) || (data_len != 0 && len != data_len)) { return -1; @@ -73,25 +73,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len) } int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) - { + { int fd; int len; if ((buffer == NULL) || (buf_size < 0)) { return -1; - } + } if ((fd = open(filename, O_RDONLY)) == -1) { - return -1; + return -1; } if ((len = read(fd, buffer, buf_size)) < 0) { - close(fd); + close(fd); + return -1; + } + + if ((close(fd) == -1)) { return -1; - } - - if ((close(fd) == -1)) { - return -1; } if ((len > buf_size) || (data_len != 0 && len != data_len)) { @@ -108,7 +108,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le if (data_len >= buf_size || data_len < 0) { return -1; } - + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); if (ret == 0) { @@ -119,7 +119,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le buffer[buf_size-1] = '\0'; } } - + return ret; } @@ -137,25 +137,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } @@ -163,20 +163,20 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) /* Check 3Y-Power AC model name */ memset(model_name, 0, sizeof(model_name)); - node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); + node = (id == PSU1_ID) ? PSU1_AC_3YPOWER_EEPROM_NODE(psu_model_name) : PSU2_AC_3YPOWER_EEPROM_NODE(psu_model_name); if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JCR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_F2B; } else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JDR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_B2F; } @@ -190,14 +190,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01G")] = 0; - strncpy(modelname, model_name, 10); + aim_strlcpy(modelname, model_name, 10); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01-01G")] = 0; - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_DC_48V_F2B; } @@ -210,7 +210,7 @@ int psu_ym2401_pmbus_info_get(int id, char *node, int *value) { int ret = 0; char path[64] = {0}; - + *value = 0; if (PSU1_ID == id) { @@ -256,14 +256,14 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value) int psu_serial_number_get(int id, psu_type_t psu_type, char *serial, int serial_len) { int size = 0; - int ret = ONLP_STATUS_OK; + int ret = ONLP_STATUS_OK; char *prefix = NULL; char *filename = NULL; if (serial == NULL || serial_len < PSU_SERIAL_NUMBER_LEN) { return ONLP_STATUS_E_PARAM; } - + memset((void *)serial, 0x0, serial_len); switch (psu_type) { case PSU_TYPE_AC_COMPUWARE_F2B: @@ -292,4 +292,4 @@ int psu_serial_number_get(int id, psu_type_t psu_type, char *serial, int serial_ serial[PSU_SERIAL_NUMBER_LEN] = '\0'; return ONLP_STATUS_OK; -} \ No newline at end of file +} diff --git a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/auto/x86_64_accton_as5822_54x.yml b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/auto/x86_64_accton_as5822_54x.yml index dee275d0..f2a5c99d 100644 --- a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/auto/x86_64_accton_as5822_54x.yml +++ b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/auto/x86_64_accton_as5822_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/inc/x86_64_accton_as5822_54x/x86_64_accton_as5822_54x_porting.h b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/inc/x86_64_accton_as5822_54x/x86_64_accton_as5822_54x_porting.h index b854933b..9a98022a 100644 --- a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/inc/x86_64_accton_as5822_54x/x86_64_accton_as5822_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/inc/x86_64_accton_as5822_54x/x86_64_accton_as5822_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5822_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5822_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5822_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5822_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5822_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5822_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5822_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/src/platform_lib.c index fc7450b3..5cbe14ab 100644 --- a/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5822-54x/onlp/builds/x86_64_accton_as5822_54x/module/src/platform_lib.c @@ -121,7 +121,7 @@ int get_psu_serial_number(int id, char *serial, int serial_len) { char *node = NULL; char sn[PSU_SERIAL_NUMBER_LEN + 1] = {0}; - + /* Check AC model name */ node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_serial_numer) : PSU2_AC_HWMON_NODE(psu_serial_numer); @@ -130,7 +130,7 @@ int get_psu_serial_number(int id, char *serial, int serial_len) } if (serial) { - strncpy(serial, sn, sizeof(sn)); + aim_strlcpy(serial, sn, sizeof(sn)); } return ONLP_STATUS_OK; @@ -149,7 +149,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } if (strncmp(model_name, "YM-2401JCR", 10) == 0) { @@ -203,4 +203,4 @@ int psu_ym2401_pmbus_info_set(int id, char *node, int value) } return ONLP_STATUS_OK; -} \ No newline at end of file +} diff --git a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/auto/x86_64_accton_as5912_54x.yml b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/auto/x86_64_accton_as5912_54x.yml index 57a73bb1..d1509503 100644 --- a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/auto/x86_64_accton_as5912_54x.yml +++ b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/auto/x86_64_accton_as5912_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/inc/x86_64_accton_as5912_54x/x86_64_accton_as5912_54x_porting.h b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/inc/x86_64_accton_as5912_54x/x86_64_accton_as5912_54x_porting.h index afb223c3..6115ceea 100644 --- a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/inc/x86_64_accton_as5912_54x/x86_64_accton_as5912_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/inc/x86_64_accton_as5912_54x/x86_64_accton_as5912_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5912_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5912_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5912_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5912_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5912_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5912_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5912_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/src/platform_lib.c index a79bb0b0..081b595a 100644 --- a/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5912-54x/onlp/builds/x86_64_accton_as5912_54x/module/src/platform_lib.c @@ -135,7 +135,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/auto/x86_64_accton_as5912_54xk.yml b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/auto/x86_64_accton_as5912_54xk.yml index aeb3583d..42bad5b2 100644 --- a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/auto/x86_64_accton_as5912_54xk.yml +++ b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/auto/x86_64_accton_as5912_54xk.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/inc/x86_64_accton_as5912_54xk/x86_64_accton_as5912_54xk_porting.h b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/inc/x86_64_accton_as5912_54xk/x86_64_accton_as5912_54xk_porting.h index d5c16f08..d4b84916 100644 --- a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/inc/x86_64_accton_as5912_54xk/x86_64_accton_as5912_54xk_porting.h +++ b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/inc/x86_64_accton_as5912_54xk/x86_64_accton_as5912_54xk_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5912_54XK_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5912_54XK_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5912_54XK_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5912_54XK_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5912_54XK_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5912_54XK_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5912_54XK_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/src/platform_lib.c index 1837a772..12fbbfad 100644 --- a/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5912-54xk/onlp/builds/x86_64_accton_as5912_54xk/module/src/platform_lib.c @@ -57,7 +57,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model, modelname_len-1); + aim_strlcpy(modelname, model, modelname_len-1); } path = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/auto/x86_64_accton_as5916_26xb.yml b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/auto/x86_64_accton_as5916_26xb.yml index 047e4969..5dc885ca 100644 --- a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/auto/x86_64_accton_as5916_26xb.yml +++ b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/auto/x86_64_accton_as5916_26xb.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/inc/x86_64_accton_as5916_26xb/x86_64_accton_as5916_26xb_porting.h b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/inc/x86_64_accton_as5916_26xb/x86_64_accton_as5916_26xb_porting.h index ba711cd1..c47a49a7 100644 --- a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/inc/x86_64_accton_as5916_26xb/x86_64_accton_as5916_26xb_porting.h +++ b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/inc/x86_64_accton_as5916_26xb/x86_64_accton_as5916_26xb_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_26XB_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_26XB_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_26XB_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_26XB_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_26XB_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_26XB_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_26XB_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/src/psui.c b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/src/psui.c index 15c2c7f6..71e07a10 100755 --- a/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/src/psui.c +++ b/packages/platforms/accton/x86-64/as5916-26xb/onlp/builds/x86_64_accton_as5916_26xb/module/src/psui.c @@ -154,7 +154,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) char *string = NULL; int len = onlp_file_read_str(&string, "%s""psu%d_model", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->model, string, len); + aim_strlcpy(info->model, string, len); aim_free(string); info->caps |= get_DCorAC_cap (info->model); } @@ -162,7 +162,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) /* Read serial */ len = onlp_file_read_str(&string, "%s""psu%d_serial", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->serial, string, len); + aim_strlcpy(info->serial, string, len); aim_free(string); } diff --git a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/auto/x86_64_accton_as5916_54x.yml b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/auto/x86_64_accton_as5916_54x.yml index 987f682f..fc552d78 100644 --- a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/auto/x86_64_accton_as5916_54x.yml +++ b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/auto/x86_64_accton_as5916_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/inc/x86_64_accton_as5916_54x/x86_64_accton_as5916_54x_porting.h b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/inc/x86_64_accton_as5916_54x/x86_64_accton_as5916_54x_porting.h index 8e156611..86909420 100644 --- a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/inc/x86_64_accton_as5916_54x/x86_64_accton_as5916_54x_porting.h +++ b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/inc/x86_64_accton_as5916_54x/x86_64_accton_as5916_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/src/platform_lib.c index 1837a772..12fbbfad 100644 --- a/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5916-54x/onlp/builds/x86_64_accton_as5916_54x/module/src/platform_lib.c @@ -57,7 +57,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model, modelname_len-1); + aim_strlcpy(modelname, model, modelname_len-1); } path = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/auto/x86_64_accton_as5916_54xk.yml b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/auto/x86_64_accton_as5916_54xk.yml index 9efc6401..2699abcd 100644 --- a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/auto/x86_64_accton_as5916_54xk.yml +++ b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/auto/x86_64_accton_as5916_54xk.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/inc/x86_64_accton_as5916_54xk/x86_64_accton_as5916_54xk_porting.h b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/inc/x86_64_accton_as5916_54xk/x86_64_accton_as5916_54xk_porting.h index 21afc8be..40939741 100644 --- a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/inc/x86_64_accton_as5916_54xk/x86_64_accton_as5916_54xk_porting.h +++ b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/inc/x86_64_accton_as5916_54xk/x86_64_accton_as5916_54xk_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_54XK_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_54XK_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_54XK_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_54XK_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_54XK_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_54XK_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_54XK_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/src/platform_lib.c index 1837a772..12fbbfad 100644 --- a/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5916-54xk/onlp/builds/x86_64_accton_as5916_54xk/module/src/platform_lib.c @@ -57,7 +57,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model, modelname_len-1); + aim_strlcpy(modelname, model, modelname_len-1); } path = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/auto/x86_64_accton_as5916_54xks.yml b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/auto/x86_64_accton_as5916_54xks.yml index b669e3dd..7e4db52d 100755 --- a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/auto/x86_64_accton_as5916_54xks.yml +++ b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/auto/x86_64_accton_as5916_54xks.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/inc/x86_64_accton_as5916_54xks/x86_64_accton_as5916_54xks_porting.h b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/inc/x86_64_accton_as5916_54xks/x86_64_accton_as5916_54xks_porting.h index f81fb0e6..ffe38910 100755 --- a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/inc/x86_64_accton_as5916_54xks/x86_64_accton_as5916_54xks_porting.h +++ b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/inc/x86_64_accton_as5916_54xks/x86_64_accton_as5916_54xks_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_54XKS_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_54XKS_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_54XKS_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_54XKS_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_54XKS_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_54XKS_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_54XKS_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/src/psui.c b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/src/psui.c index 156f9bdb..6a40c32d 100644 --- a/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/src/psui.c +++ b/packages/platforms/accton/x86-64/as5916-54xks/onlp/builds/x86_64_accton_as5916_54xks/module/src/psui.c @@ -138,14 +138,14 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) char *string = NULL; int len = onlp_file_read_str(&string, "%s""psu%d_model", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->model, string, len); + aim_strlcpy(info->model, string, len); aim_free(string); } /* Read serial */ len = onlp_file_read_str(&string, "%s""psu%d_serial", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->serial, string, len); + aim_strlcpy(info->serial, string, len); aim_free(string); } diff --git a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/auto/x86_64_accton_as5916_54xl.yml b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/auto/x86_64_accton_as5916_54xl.yml index d7e48101..228c7db6 100755 --- a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/auto/x86_64_accton_as5916_54xl.yml +++ b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/auto/x86_64_accton_as5916_54xl.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/inc/x86_64_accton_as5916_54xl/x86_64_accton_as5916_54xl_porting.h b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/inc/x86_64_accton_as5916_54xl/x86_64_accton_as5916_54xl_porting.h index fdce3dd9..8ea1d758 100755 --- a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/inc/x86_64_accton_as5916_54xl/x86_64_accton_as5916_54xl_porting.h +++ b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/inc/x86_64_accton_as5916_54xl/x86_64_accton_as5916_54xl_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_54XL_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_54XL_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_54XL_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_54XL_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_54XL_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_54XL_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_54XL_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/src/psui.c b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/src/psui.c index 8a2e715c..f09ed313 100755 --- a/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/src/psui.c +++ b/packages/platforms/accton/x86-64/as5916-54xl/onlp/builds/x86_64_accton_as5916_54xl/module/src/psui.c @@ -138,14 +138,14 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) char *string = NULL; int len = onlp_file_read_str(&string, "%s""psu%d_model", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->model, string, len); + aim_strlcpy(info->model, string, len); aim_free(string); } /* Read serial */ len = onlp_file_read_str(&string, "%s""psu%d_serial", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->serial, string, len); + aim_strlcpy(info->serial, string, len); aim_free(string); } diff --git a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/auto/x86_64_accton_as5916_54xm.yml b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/auto/x86_64_accton_as5916_54xm.yml index 5631cabb..8f0aa3b7 100644 --- a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/auto/x86_64_accton_as5916_54xm.yml +++ b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/auto/x86_64_accton_as5916_54xm.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/inc/x86_64_accton_as5916_54xm/x86_64_accton_as5916_54xm_porting.h b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/inc/x86_64_accton_as5916_54xm/x86_64_accton_as5916_54xm_porting.h index 95f19041..a6f96a8c 100644 --- a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/inc/x86_64_accton_as5916_54xm/x86_64_accton_as5916_54xm_porting.h +++ b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/inc/x86_64_accton_as5916_54xm/x86_64_accton_as5916_54xm_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS5916_54XM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS5916_54XM_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS5916_54XM_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS5916_54XM_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS5916_54XM_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS5916_54XM_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS5916_54XM_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/platform_lib.c index 7db9630c..f08605fd 100644 --- a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/platform_lib.c @@ -83,7 +83,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/thermali.c b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/thermali.c index 1e9f4161..2257a2a9 100755 --- a/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/thermali.c +++ b/packages/platforms/accton/x86-64/as5916-54xm/onlp/builds/x86_64_accton_as5916_54xm/module/src/thermali.c @@ -175,7 +175,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) devfile = fname; /*Replace description*/ - strncpy(tmp, *des, sizeof(tmp)); + aim_strlcpy(tmp, *des, sizeof(tmp)); snprintf(*des, sizeof(*des), tmp, t1_addr); } diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/auto/x86_64_accton_as6712_32x.yml b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/auto/x86_64_accton_as6712_32x.yml index 2f325861..a97437d6 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/auto/x86_64_accton_as6712_32x.yml +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/auto/x86_64_accton_as6712_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h index ed715da6..88333a74 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/inc/x86_64_accton_as6712_32x/x86_64_accton_as6712_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS6712_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS6712_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS6712_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS6712_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS6712_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS6712_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS6712_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/make.mk b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/make.mk index ac67385a..0149cec9 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/make.mk +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/make.mk @@ -1,6 +1,6 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) @@ -8,3 +8,4 @@ x86_64_accton_as6712_32x_INCLUDES := -I $(THIS_DIR)inc x86_64_accton_as6712_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_accton_as6712_32x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as6712_32x ucli:x86_64_accton_as6712_32x +x86_64_accton_as6712_32x_CFLAGS := -Wno-sizeof-pointer-memaccess diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/fani.c b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/fani.c index eb34c50e..2455c551 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/fani.c @@ -28,6 +28,7 @@ #include #include #include "platform_lib.h" +#include #define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as6712_32x_fan/" #define PREFIX_PATH_ON_PSU "/sys/bus/i2c/devices/" @@ -137,7 +138,7 @@ onlp_fan_info_t linfo[] = { #define SET_PSU_TYPE_AC_B2F_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE - + #define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) @@ -150,7 +151,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan/fanr fault status (turn on when any one fails) */ @@ -166,13 +167,13 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*F2B*/ info->status |= ONLP_FAN_STATUS_F2B; - else - info->status |= ONLP_FAN_STATUS_B2F; + else + info->status |= ONLP_FAN_STATUS_B2F; /* get fan/fanr speed (take the min from two speeds) */ @@ -205,7 +206,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info) if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) { info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED; info->rpm = val; - info->percentage = (info->rpm * 100) / 21600; + info->percentage = (info->rpm * 100) / 21600; } return ONLP_STATUS_OK; @@ -217,7 +218,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) int psu_id; int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; psu_type_t psu_type; /* get fan fault status @@ -343,7 +344,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -371,7 +372,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p); } - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); break; } case FAN_1_ON_MAIN_BOARD: @@ -439,4 +440,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/ledi.c index 1a86d143..28479fd0 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as6712_32x_led::" @@ -58,20 +58,20 @@ enum onlp_led_id LED_FAN4, LED_FAN5 }; - + enum led_light_mode { /* psu led mode */ LED_MODE_PSU_OFF = 0, LED_MODE_PSU_GREEN, - LED_MODE_PSU_AMBER, + LED_MODE_PSU_AMBER, LED_MODE_PSU_AUTO = 7, - + /* diag led mode*/ LED_MODE_DIAG_OFF = 0, LED_MODE_DIAG_GREEN, - LED_MODE_DIAG_AMBER, + LED_MODE_DIAG_AMBER, LED_MODE_DIAG_GREEN_BLINK = 4, - + /* locator led mode*/ LED_MODE_LOC_OFF = 0, LED_MODE_LOC_AMBER = 2, @@ -202,7 +202,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -210,14 +210,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -225,7 +225,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -249,15 +249,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -308,12 +308,12 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0) { @@ -331,4 +331,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/platform_lib.c index 3bb90fc8..cd59c208 100644 --- a/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as6712-32x/onlp/builds/x86_64_accton_as6712_32x/module/src/platform_lib.c @@ -134,25 +134,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } @@ -166,14 +166,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JCR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_F2B; } else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JDR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_B2F; } @@ -187,14 +187,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01G")] = 0; - strncpy(modelname, model_name, 10); + aim_strlcpy(modelname, model_name, 10); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01-01G")] = 0; - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_DC_48V_F2B; } diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/auto/x86_64_accton_as6812_32x.yml b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/auto/x86_64_accton_as6812_32x.yml index 254c8db0..6dd34239 100644 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/auto/x86_64_accton_as6812_32x.yml +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/auto/x86_64_accton_as6812_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/inc/x86_64_accton_as6812_32x/x86_64_accton_as6812_32x_porting.h b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/inc/x86_64_accton_as6812_32x/x86_64_accton_as6812_32x_porting.h index 9c3056c1..97d73df1 100644 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/inc/x86_64_accton_as6812_32x/x86_64_accton_as6812_32x_porting.h +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/inc/x86_64_accton_as6812_32x/x86_64_accton_as6812_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS6812_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS6812_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS6812_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS6812_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS6812_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS6812_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS6812_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/make.mk b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/make.mk index b56fb37a..955e764d 100644 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/make.mk +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/make.mk @@ -1,10 +1,10 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) x86_64_accton_as6812_32x_INCLUDES := -I $(THIS_DIR)inc x86_64_accton_as6812_32x_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_accton_as6812_32x_DEPENDMODULE_ENTRIES := init:x86_64_accton_as6812_32x ucli:x86_64_accton_as6812_32x - +x86_64_accton_as6812_32x_CFLAGS := -Wno-sizeof-pointer-memaccess diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/fani.c b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/fani.c index 2659e85a..e9db782c 100644 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/fani.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/devices/platform/as6812_32x_fan/" @@ -137,7 +138,7 @@ onlp_fan_info_t linfo[] = { #define SET_PSU_TYPE_AC_B2F_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_B2F); \ info->caps |= ONLP_FAN_CAPS_SET_PERCENTAGE | ONLP_FAN_CAPS_GET_RPM | ONLP_FAN_CAPS_GET_PERCENTAGE - + #define SET_PSU_TYPE_UM400D_F2B_FAN(info) \ info->status |= (ONLP_FAN_STATUS_PRESENT | ONLP_FAN_STATUS_F2B) @@ -150,7 +151,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan/fanr fault status (turn on when any one fails) */ @@ -166,13 +167,13 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*F2B*/ info->status |= ONLP_FAN_STATUS_F2B; - else - info->status |= ONLP_FAN_STATUS_B2F; + else + info->status |= ONLP_FAN_STATUS_B2F; /* get fan/fanr speed (take the min from two speeds) */ @@ -205,7 +206,7 @@ _onlp_fani_info_get_fan_on_psu_ym2401(int pid, onlp_fan_info_t* info) if (psu_ym2401_pmbus_info_get(pid, "psu_fan1_speed_rpm", &val) == ONLP_STATUS_OK) { info->status |= (val > 0) ? 0 : ONLP_FAN_STATUS_FAILED; info->rpm = val; - info->percentage = (info->rpm * 100) / 21600; + info->percentage = (info->rpm * 100) / 21600; } return ONLP_STATUS_OK; @@ -217,7 +218,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) int psu_id; int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; psu_type_t psu_type; /* get fan fault status @@ -251,18 +252,18 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) if (psu_type == PSU_TYPE_AC_COMPUWARE_F2B || psu_type == PSU_TYPE_AC_COMPUWARE_B2F ) { - /* get fan fault status + /* get fan fault status */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) info->status |= ONLP_FAN_STATUS_FAILED; - + /* get fan speed */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - info->rpm = atoi(r_data); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); /* get speed percentage from rpm */ info->percentage = (info->rpm * 100)/MAX_PSU_FAN_SPEED; @@ -343,7 +344,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -371,7 +372,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) return psu_ym2401_pmbus_info_set(psu_id, "psu_fan1_duty_cycle_percentage", p); } - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); break; } case FAN_1_ON_MAIN_BOARD: @@ -439,4 +440,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/ledi.c index ad20a1d2..c71e1959 100644 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as6812_32x_led::" @@ -58,20 +58,20 @@ enum onlp_led_id LED_FAN4, LED_FAN5 }; - + enum led_light_mode { /* psu led mode */ LED_MODE_PSU_OFF = 0, LED_MODE_PSU_GREEN, - LED_MODE_PSU_AMBER, + LED_MODE_PSU_AMBER, LED_MODE_PSU_AUTO = 7, - + /* diag led mode*/ LED_MODE_DIAG_OFF = 0, LED_MODE_DIAG_GREEN, - LED_MODE_DIAG_AMBER, + LED_MODE_DIAG_AMBER, LED_MODE_DIAG_GREEN_BLINK = 4, - + /* locator led mode*/ LED_MODE_LOC_OFF = 0, LED_MODE_LOC_AMBER = 2, @@ -202,7 +202,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -210,14 +210,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -225,7 +225,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -245,15 +245,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -304,13 +304,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -327,4 +327,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/platform_lib.c index 789ac74d..712b4ff4 100755 --- a/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as6812-32x/onlp/builds/x86_64_accton_as6812_32x/module/src/platform_lib.c @@ -136,25 +136,25 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", STRLEN("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", STRLEN("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } else if (strncmp(model_name, "CPR-6011-2M11", STRLEN("CPR-6011-2M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_F2B; } else if (strncmp(model_name, "CPR-6011-2M21", STRLEN("CPR-6011-2M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)); + aim_strlcpy(modelname, model_name, sizeof(model_name)); } return PSU_TYPE_AC_COMPUWARE_B2F; } @@ -168,14 +168,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2401JCR", STRLEN("YM-2401JCR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JCR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_F2B; } else if (strncmp(model_name, "YM-2401JDR", STRLEN("YM-2401JDR")) == 0) { if (modelname) { model_name[STRLEN("YM-2401JDR")] = 0; - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } return PSU_TYPE_AC_3YPOWER_B2F; } @@ -189,14 +189,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "um400d01G", STRLEN("um400d01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01G")] = 0; - strncpy(modelname, model_name, 10); + aim_strlcpy(modelname, model_name, 10); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", STRLEN("um400d01-01G")) == 0) { if (modelname) { model_name[STRLEN("um400d01-01G")] = 0; - strncpy(modelname, model_name, 13); + aim_strlcpy(modelname, model_name, 13); } return PSU_TYPE_DC_48V_F2B; } diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/auto/x86_64_accton_as7112_54x.yml b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/auto/x86_64_accton_as7112_54x.yml index fa5fe1ef..8e78c2d1 100755 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/auto/x86_64_accton_as7112_54x.yml +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/auto/x86_64_accton_as7112_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/inc/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x_porting.h b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/inc/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x_porting.h index de7205ec..d2a4c020 100755 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/inc/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x_porting.h +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/inc/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7112_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7112_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7112_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7112_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7112_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7112_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7112_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/fani.c b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/fani.c index 13b4487b..e4cfcfaf 100755 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/fani.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/bus/i2c/devices/0-0063/" @@ -166,7 +167,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* check if fan is present */ @@ -186,14 +187,14 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) return ONLP_STATUS_OK; } - /* get fan/fanr direction (both : the same) + /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*B2F*/ info->status |= ONLP_FAN_STATUS_B2F; - else + else info->status |= ONLP_FAN_STATUS_F2B; /* get fan speed (take the min from two speeds) @@ -219,7 +220,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan direction */ @@ -311,7 +312,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -394,4 +395,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/ledi.c index 9a108a99..1a5b0d1a 100755 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "platform_lib.h" @@ -174,7 +175,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -233,7 +234,7 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -256,4 +257,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/platform_lib.c index d747c970..f4728f8a 100755 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/module/src/platform_lib.c @@ -153,7 +153,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) ) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } //printf("Vic Said It is AC Type %s\n",modelname); @@ -177,7 +177,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -196,7 +196,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x.mk b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x.mk index 1c601603..0cf21401 100644 --- a/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x.mk +++ b/packages/platforms/accton/x86-64/as7112-54x/onlp/builds/x86_64_accton_as7112_54x/x86_64_accton_as7112_54x.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_accton_as7112_54x module. # -# Autogenerated 2019-07-13 17:26:43.980186 +# Autogenerated 2019-07-30 18:47:57.583722 # ############################################################################### x86_64_accton_as7112_54x_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/auto/x86_64_accton_as7312_54x.yml b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/auto/x86_64_accton_as7312_54x.yml index a05542b8..a53f0dbd 100644 --- a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/auto/x86_64_accton_as7312_54x.yml +++ b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/auto/x86_64_accton_as7312_54x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/inc/x86_64_accton_as7312_54x/x86_64_accton_as7312_54x_porting.h b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/inc/x86_64_accton_as7312_54x/x86_64_accton_as7312_54x_porting.h index d891e909..342743a3 100644 --- a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/inc/x86_64_accton_as7312_54x/x86_64_accton_as7312_54x_porting.h +++ b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/inc/x86_64_accton_as7312_54x/x86_64_accton_as7312_54x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7312_54X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7312_54X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7312_54X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7312_54X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7312_54X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7312_54X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7312_54X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/ledi.c index 9357e422..1445523d 100644 --- a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as7312_54x_led::" @@ -53,7 +53,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -132,7 +132,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -140,14 +140,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -155,7 +155,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -188,15 +188,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -235,14 +235,14 @@ onlp_ledi_set(onlp_oid_t id, int on_or_off) } else { int rv; - onlp_led_mode_t mode = ONLP_LED_MODE_OFF; + onlp_led_mode_t mode = ONLP_LED_MODE_OFF; onlp_led_info_t led_info; rv = onlp_ledi_info_get(id, &led_info); if (rv < 0) return rv; /*If multiple color is supported, take the mode at highest bit.*/ - mode = _log2(led_info.caps); + mode = _log2(led_info.caps); return onlp_ledi_mode_set(id, mode); } } @@ -257,13 +257,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -280,4 +280,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/platform_lib.c index e820a63e..d2295db3 100644 --- a/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7312-54x/onlp/builds/x86_64_accton_as7312_54x/module/src/platform_lib.c @@ -111,7 +111,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/auto/x86_64_accton_as7312_54xs.yml b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/auto/x86_64_accton_as7312_54xs.yml index 5a36f036..9464fd1c 100644 --- a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/auto/x86_64_accton_as7312_54xs.yml +++ b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/auto/x86_64_accton_as7312_54xs.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/inc/x86_64_accton_as7312_54xs/x86_64_accton_as7312_54xs_porting.h b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/inc/x86_64_accton_as7312_54xs/x86_64_accton_as7312_54xs_porting.h index 7b679b76..c6d2ab7f 100644 --- a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/inc/x86_64_accton_as7312_54xs/x86_64_accton_as7312_54xs_porting.h +++ b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/inc/x86_64_accton_as7312_54xs/x86_64_accton_as7312_54xs_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7312_54XS_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7312_54XS_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7312_54XS_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7312_54XS_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7312_54XS_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7312_54XS_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7312_54XS_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/ledi.c b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/ledi.c index a2ac4451..38103764 100644 --- a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as7312_54xs_led::" @@ -53,7 +53,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -132,7 +132,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -140,14 +140,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -155,7 +155,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -175,17 +175,13 @@ int onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; - char data[2] = {0}; - char fullpath[50] = {0}; - + char data[2] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - local_id = ONLP_OID_ID_GET(id); - /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - - /* Set the onlp_oid_hdr_t and capabilities */ + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; /* Set LED mode */ @@ -235,13 +231,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -258,4 +254,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/platform_lib.c index d44f0364..c7d564c2 100755 --- a/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7312-54xs/onlp/builds/x86_64_accton_as7312_54xs/module/src/platform_lib.c @@ -109,7 +109,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, I2C_PSU_MODEL_NAME_LEN - 1); + aim_strlcpy(modelname, model_name, I2C_PSU_MODEL_NAME_LEN - 1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/auto/x86_64_accton_as7316_26xb.yml b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/auto/x86_64_accton_as7316_26xb.yml index e7c0b12f..91a6c98d 100644 --- a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/auto/x86_64_accton_as7316_26xb.yml +++ b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/auto/x86_64_accton_as7316_26xb.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/inc/x86_64_accton_as7316_26xb/x86_64_accton_as7316_26xb_porting.h b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/inc/x86_64_accton_as7316_26xb/x86_64_accton_as7316_26xb_porting.h index 331e1693..68ecaada 100644 --- a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/inc/x86_64_accton_as7316_26xb/x86_64_accton_as7316_26xb_porting.h +++ b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/inc/x86_64_accton_as7316_26xb/x86_64_accton_as7316_26xb_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7316_26XB_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7316_26XB_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7316_26XB_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7316_26XB_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7316_26XB_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7316_26XB_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7316_26XB_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/src/psui.c b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/src/psui.c index 15c2c7f6..71e07a10 100644 --- a/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/src/psui.c +++ b/packages/platforms/accton/x86-64/as7316-26xb/onlp/builds/x86_64_accton_as7316_26xb/module/src/psui.c @@ -154,7 +154,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) char *string = NULL; int len = onlp_file_read_str(&string, "%s""psu%d_model", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->model, string, len); + aim_strlcpy(info->model, string, len); aim_free(string); info->caps |= get_DCorAC_cap (info->model); } @@ -162,7 +162,7 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) /* Read serial */ len = onlp_file_read_str(&string, "%s""psu%d_serial", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->serial, string, len); + aim_strlcpy(info->serial, string, len); aim_free(string); } diff --git a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/auto/x86_64_accton_as7326_56x.yml b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/auto/x86_64_accton_as7326_56x.yml index a3b20480..5bc47514 100644 --- a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/auto/x86_64_accton_as7326_56x.yml +++ b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/auto/x86_64_accton_as7326_56x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/inc/x86_64_accton_as7326_56x/x86_64_accton_as7326_56x_porting.h b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/inc/x86_64_accton_as7326_56x/x86_64_accton_as7326_56x_porting.h index cfa28f2c..3c0df241 100644 --- a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/inc/x86_64_accton_as7326_56x/x86_64_accton_as7326_56x_porting.h +++ b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/inc/x86_64_accton_as7326_56x/x86_64_accton_as7326_56x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7326_56X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7326_56X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7326_56X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7326_56X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7326_56X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7326_56X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7326_56X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/ledi.c index 7d6b6dca..beb4cbbd 100644 --- a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as7326_56x_led::" @@ -158,7 +158,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -166,14 +166,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -181,7 +181,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -202,15 +202,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -261,13 +261,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -284,4 +284,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/platform_lib.c index c3e61500..84b10036 100644 --- a/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7326-56x/onlp/builds/x86_64_accton_as7326_56x/module/src/platform_lib.c @@ -80,7 +80,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/auto/x86_64_accton_as7512_32x.yml b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/auto/x86_64_accton_as7512_32x.yml index 8bc8e187..ccfe78bb 100644 --- a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/auto/x86_64_accton_as7512_32x.yml +++ b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/auto/x86_64_accton_as7512_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h index 4c3b0fbd..851ff819 100644 --- a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h +++ b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/inc/x86_64_accton_as7512_32x/x86_64_accton_as7512_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7512_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7512_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7512_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7512_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7512_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7512_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7512_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/fani.c b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/fani.c index 830b90fd..16aff21b 100644 --- a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/fani.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/bus/i2c/devices/2-0066/" @@ -34,7 +35,7 @@ #define MAX_FAN_SPEED 18000 #define MAX_PSU_FAN_SPEED 25500 -#define PROJECT_NAME +#define PROJECT_NAME #define LEN_FILE_NAME 80 #define FAN_RESERVED 0 @@ -144,7 +145,7 @@ _onlp_fani_info_get_fan_direction(void) for (i = PSU1_ID; i <= PSU2_ID; i++) { psu_type_t psu_type; psu_type = get_psu_type(i, NULL, 0); - + if (psu_type == PSU_TYPE_UNKNOWN) { continue; } @@ -156,48 +157,48 @@ _onlp_fani_info_get_fan_direction(void) return ONLP_FAN_STATUS_B2F; } } - + return 0; } - + static int _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; - + char fullpath[PATH_MAX] = {0}; + /* get fan fault status (turn on when any one fails) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (atoi(r_data) > 0) { info->status |= ONLP_FAN_STATUS_FAILED; return ONLP_STATUS_OK; } - /* get fan direction (both : the same) + /* get fan direction (both : the same) */ info->status |= _onlp_fani_info_get_fan_direction(); /* get fan speed (take the min from two speeds) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->rpm = atoi(r_data); - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].r_speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].r_speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); if (info->rpm > atoi(r_data)) { info->rpm = atoi(r_data); } /* get speed percentage from rpm */ - info->percentage = (info->rpm * 100)/MAX_FAN_SPEED; + info->percentage = (info->rpm * 100)/MAX_FAN_SPEED; - /* check present */ + /* check present */ if (info->rpm > 0) { - info->status |= ONLP_FAN_STATUS_PRESENT; + info->status |= ONLP_FAN_STATUS_PRESENT; } return ONLP_STATUS_OK; @@ -208,23 +209,23 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; - /* get fan direction + /* get fan direction */ info->status |= _onlp_fani_info_get_fan_direction(); - /* get fan fault status + /* get fan fault status */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].status); OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); info->status |= (atoi(r_data) > 0) ? ONLP_FAN_STATUS_FAILED : 0; - + /* get fan speed */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - info->rpm = atoi(r_data); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].speed); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + info->rpm = atoi(r_data); /* get speed percentage from rpm */ info->percentage = (info->rpm * 100) / MAX_PSU_FAN_SPEED; @@ -256,7 +257,7 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) { case FAN_1_ON_PSU1: case FAN_1_ON_PSU2: - rc = _onlp_fani_info_get_fan_on_psu(local_id, info); + rc = _onlp_fani_info_get_fan_on_psu(local_id, info); break; case FAN_1_ON_MAIN_BOARD: case FAN_2_ON_MAIN_BOARD: @@ -264,13 +265,13 @@ onlp_fani_info_get(onlp_oid_t id, onlp_fan_info_t* info) case FAN_4_ON_MAIN_BOARD: case FAN_5_ON_MAIN_BOARD: case FAN_6_ON_MAIN_BOARD: - rc =_onlp_fani_info_get_fan(local_id, info); + rc =_onlp_fani_info_get_fan(local_id, info); break; default: rc = ONLP_STATUS_E_INVALID; break; - } - + } + return rc; } @@ -301,23 +302,23 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); /* reject p=0 (p=0, stop fan) */ if (p == 0){ return ONLP_STATUS_E_INVALID; } - + /* get fullpath */ switch (local_id) { case FAN_1_ON_PSU1: case FAN_1_ON_PSU2: - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_PSU, fan_path[local_id].ctrl_speed); break; case FAN_1_ON_MAIN_BOARD: case FAN_2_ON_MAIN_BOARD: @@ -385,4 +386,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/ledi.c index 03f0a1e5..7ef2854a 100644 --- a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "platform_lib.h" @@ -53,7 +54,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -132,7 +133,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -140,14 +141,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -155,7 +156,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -173,15 +174,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -232,13 +233,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -255,4 +256,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/platform_lib.c index 526ff1bb..22633810 100644 --- a/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7512-32x/onlp/builds/x86_64_accton_as7512_32x/module/src/platform_lib.c @@ -137,7 +137,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/auto/x86_64_accton_as7712_32x.yml b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/auto/x86_64_accton_as7712_32x.yml index 7c68dfc2..57b5ed21 100644 --- a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/auto/x86_64_accton_as7712_32x.yml +++ b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/auto/x86_64_accton_as7712_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/inc/x86_64_accton_as7712_32x/x86_64_accton_as7712_32x_porting.h b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/inc/x86_64_accton_as7712_32x/x86_64_accton_as7712_32x_porting.h index 8bca8180..9eaef461 100644 --- a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/inc/x86_64_accton_as7712_32x/x86_64_accton_as7712_32x_porting.h +++ b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/inc/x86_64_accton_as7712_32x/x86_64_accton_as7712_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7712_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7712_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7712_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7712_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7712_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7712_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7712_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/fani.c b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/fani.c index da2ac83f..9af42be9 100644 --- a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/fani.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/bus/i2c/devices/2-0066/" @@ -171,7 +172,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* check if fan is present */ @@ -191,14 +192,14 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) return ONLP_STATUS_OK; } - /* get fan/fanr direction (both : the same) + /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*B2F*/ info->status |= ONLP_FAN_STATUS_B2F; - else + else info->status |= ONLP_FAN_STATUS_F2B; /* get fan speed (take the min from two speeds) @@ -224,7 +225,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan direction */ @@ -317,7 +318,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -401,4 +402,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/ledi.c index 62455118..3494228c 100644 --- a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "platform_lib.h" @@ -53,7 +54,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -132,7 +133,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -140,14 +141,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -155,7 +156,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -178,15 +179,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -237,13 +238,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (deviceNodeWriteInt(fullpath, onlp_to_driver_led_mode(local_id, mode), 0) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -260,4 +261,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/platform_lib.c index 0a2f5e68..7ace7a1a 100644 --- a/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7712-32x/onlp/builds/x86_64_accton_as7712_32x/module/src/platform_lib.c @@ -139,7 +139,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -158,7 +158,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -177,7 +177,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -200,7 +200,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "FSF019", 6) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); /* Copy full model name */ + aim_strlcpy(modelname, model_name, 11); /* Copy full model name */ } /* Read model */ @@ -211,7 +211,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) return PSU_TYPE_UNKNOWN; } - strncpy(fan_dir, string, len); + aim_strlcpy(fan_dir, string, len); aim_free(string); if (strncmp(fan_dir, "F2B", strlen("F2B")) == 0) { @@ -260,7 +260,7 @@ int psu_acbel_serial_number_get(int id, char *serial, int serial_len) return ONLP_STATUS_E_INTERNAL; } - strncpy(serial, serial_number, len); + aim_strlcpy(serial, serial_number, len); aim_free(serial_number); serial[len] = '\0'; diff --git a/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/auto/x86_64_accton_as7716_24sc.yml b/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/auto/x86_64_accton_as7716_24sc.yml index 4e18e888..281c73fa 100644 --- a/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/auto/x86_64_accton_as7716_24sc.yml +++ b/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/auto/x86_64_accton_as7716_24sc.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/inc/x86_64_accton_as7716_24sc/x86_64_accton_as7716_24sc_porting.h b/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/inc/x86_64_accton_as7716_24sc/x86_64_accton_as7716_24sc_porting.h index 85595738..e5e7286f 100644 --- a/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/inc/x86_64_accton_as7716_24sc/x86_64_accton_as7716_24sc_porting.h +++ b/packages/platforms/accton/x86-64/as7716-24sc/onlp/builds/x86_64_accton_as7716_24sc/module/inc/x86_64_accton_as7716_24sc/x86_64_accton_as7716_24sc_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7716_24SC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7716_24SC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7716_24SC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7716_24SC_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7716_24SC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7716_24SC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7716_24SC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/auto/x86_64_accton_as7716_24xc.yml b/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/auto/x86_64_accton_as7716_24xc.yml index 8278f1b1..16a5ecc4 100644 --- a/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/auto/x86_64_accton_as7716_24xc.yml +++ b/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/auto/x86_64_accton_as7716_24xc.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/inc/x86_64_accton_as7716_24xc/x86_64_accton_as7716_24xc_porting.h b/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/inc/x86_64_accton_as7716_24xc/x86_64_accton_as7716_24xc_porting.h index ce1da04a..d5737e01 100644 --- a/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/inc/x86_64_accton_as7716_24xc/x86_64_accton_as7716_24xc_porting.h +++ b/packages/platforms/accton/x86-64/as7716-24xc/onlp/builds/x86_64_accton_as7716_24xc/module/inc/x86_64_accton_as7716_24xc/x86_64_accton_as7716_24xc_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7716_24XC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7716_24XC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7716_24XC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7716_24XC_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7716_24XC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7716_24XC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7716_24XC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/auto/x86_64_accton_as7716_32x.yml b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/auto/x86_64_accton_as7716_32x.yml index 79257f39..96cb1edc 100644 --- a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/auto/x86_64_accton_as7716_32x.yml +++ b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/auto/x86_64_accton_as7716_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/inc/x86_64_accton_as7716_32x/x86_64_accton_as7716_32x_porting.h b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/inc/x86_64_accton_as7716_32x/x86_64_accton_as7716_32x_porting.h index c9035882..aac0393e 100644 --- a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/inc/x86_64_accton_as7716_32x/x86_64_accton_as7716_32x_porting.h +++ b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/inc/x86_64_accton_as7716_32x/x86_64_accton_as7716_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7716_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7716_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7716_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7716_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7716_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7716_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7716_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/fani.c b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/fani.c index 0e8bfcda..26b0a36b 100644 --- a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/fani.c +++ b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/fani.c @@ -26,6 +26,7 @@ #include #include #include +#include #include "platform_lib.h" #define PREFIX_PATH_ON_MAIN_BOARD "/sys/bus/i2c/devices/9-0066/" @@ -169,7 +170,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[65] = {0}; + char fullpath[PATH_MAX] = {0}; /* check if fan is present */ @@ -189,14 +190,14 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) return ONLP_STATUS_OK; } - /* get fan/fanr direction (both : the same) + /* get fan/fanr direction (both : the same) */ - sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); - OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); - + sprintf(fullpath, "%s%s", PREFIX_PATH_ON_MAIN_BOARD, fan_path[local_id].direction); + OPEN_READ_FILE(fd,fullpath,r_data,nbytes,len); + if (atoi(r_data) == 0) /*B2F*/ info->status |= ONLP_FAN_STATUS_B2F; - else + else info->status |= ONLP_FAN_STATUS_F2B; /* get fan speed (take the min from two speeds) @@ -222,7 +223,7 @@ _onlp_fani_info_get_fan_on_psu(int local_id, onlp_fan_info_t* info) { int fd, len, nbytes = 10; char r_data[10] = {0}; - char fullpath[80] = {0}; + char fullpath[PATH_MAX] = {0}; /* get fan direction */ @@ -315,7 +316,7 @@ onlp_fani_percentage_set(onlp_oid_t id, int p) { int fd, len, nbytes=10, local_id; char data[10] = {0}; - char fullpath[70] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -399,4 +400,3 @@ onlp_fani_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/ledi.c index 362bc9eb..a7fe5c4a 100644 --- a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "platform_lib.h" @@ -173,7 +174,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -232,7 +233,7 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); @@ -255,4 +256,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/platform_lib.c index ea139ae7..09ae913a 100644 --- a/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7716-32x/onlp/builds/x86_64_accton_as7716_32x/module/src/platform_lib.c @@ -139,7 +139,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -158,7 +158,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -177,7 +177,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/auto/x86_64_accton_as7726_32x.yml b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/auto/x86_64_accton_as7726_32x.yml index 125063cd..429c328b 100644 --- a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/auto/x86_64_accton_as7726_32x.yml +++ b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/auto/x86_64_accton_as7726_32x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h index cef419f3..e8d6d3fa 100644 --- a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h +++ b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/inc/x86_64_accton_as7726_32x/x86_64_accton_as7726_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7726_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7726_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7726_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7726_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7726_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7726_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7726_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/ledi.c b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/ledi.c index ad7437ed..ee9b632d 100755 --- a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/ledi.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "platform_lib.h" @@ -53,7 +54,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -131,7 +132,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -139,14 +140,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -154,7 +155,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -175,15 +176,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -234,13 +235,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -257,4 +258,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/platform_lib.c index fc7a5f2c..6af98496 100755 --- a/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7726-32x/onlp/builds/x86_64_accton_as7726_32x/module/src/platform_lib.c @@ -111,7 +111,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/auto/x86_64_accton_as7816_64x.yml b/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/auto/x86_64_accton_as7816_64x.yml index e3196b89..c4024b9e 100644 --- a/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/auto/x86_64_accton_as7816_64x.yml +++ b/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/auto/x86_64_accton_as7816_64x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/inc/x86_64_accton_as7816_64x/x86_64_accton_as7816_64x_porting.h b/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/inc/x86_64_accton_as7816_64x/x86_64_accton_as7816_64x_porting.h index 89f9c762..5a76c35b 100644 --- a/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/inc/x86_64_accton_as7816_64x/x86_64_accton_as7816_64x_porting.h +++ b/packages/platforms/accton/x86-64/as7816-64x/onlp/builds/x86_64_accton_as7816_64x/module/inc/x86_64_accton_as7816_64x/x86_64_accton_as7816_64x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7816_64X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7816_64X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7816_64X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7816_64X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7816_64X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7816_64X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7816_64X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/auto/x86_64_accton_as7926_80xk.yml b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/auto/x86_64_accton_as7926_80xk.yml index bff70bcd..a65d2d6b 100644 --- a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/auto/x86_64_accton_as7926_80xk.yml +++ b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/auto/x86_64_accton_as7926_80xk.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/inc/x86_64_accton_as7926_80xk/x86_64_accton_as7926_80xk_porting.h b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/inc/x86_64_accton_as7926_80xk/x86_64_accton_as7926_80xk_porting.h index 7dcf6c10..3b1d8233 100644 --- a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/inc/x86_64_accton_as7926_80xk/x86_64_accton_as7926_80xk_porting.h +++ b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/inc/x86_64_accton_as7926_80xk/x86_64_accton_as7926_80xk_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS7926_80XK_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS7926_80XK_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS7926_80XK_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS7926_80XK_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS7926_80XK_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS7926_80XK_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS7926_80XK_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/src/platform_lib.c index 3d35f023..134761ef 100644 --- a/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as7926-80xk/onlp/builds/x86_64_accton_as7926_80xk/module/src/platform_lib.c @@ -149,7 +149,7 @@ psu_type_t psu_type_get(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, PSU_MODEL_NAME_LEN - 1); + aim_strlcpy(modelname, model_name, PSU_MODEL_NAME_LEN - 1); } switch(id) diff --git a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/auto/x86_64_accton_as9716_32d.yml b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/auto/x86_64_accton_as9716_32d.yml index fedd53b0..c63ff3b4 100755 --- a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/auto/x86_64_accton_as9716_32d.yml +++ b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/auto/x86_64_accton_as9716_32d.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/inc/x86_64_accton_as9716_32d/x86_64_accton_as9716_32d_porting.h b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/inc/x86_64_accton_as9716_32d/x86_64_accton_as9716_32d_porting.h index a57299a2..707fe034 100755 --- a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/inc/x86_64_accton_as9716_32d/x86_64_accton_as9716_32d_porting.h +++ b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/inc/x86_64_accton_as9716_32d/x86_64_accton_as9716_32d_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_AS9716_32D_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_AS9716_32D_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_AS9716_32D_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_AS9716_32D_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_AS9716_32D_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_AS9716_32D_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_AS9716_32D_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/ledi.c b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/ledi.c index f70bab01..0d901d65 100755 --- a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/ledi.c @@ -29,7 +29,7 @@ #include #include #include - +#include #include "platform_lib.h" #define prefix_path "/sys/class/leds/accton_as9716_32d_led::" @@ -53,7 +53,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -144,7 +144,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -152,14 +152,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -167,7 +167,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -186,15 +186,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -245,13 +245,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -268,4 +268,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/platform_lib.c b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/platform_lib.c index 7c90462a..fea7f616 100755 --- a/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/as9716_32d/onlp/builds/x86_64_accton_as9716_32d/module/src/platform_lib.c @@ -110,7 +110,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (!strncmp(model_name, "FSH082", strlen("FSH082"))) { if (modelname) - strncpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1)); + aim_strlcpy(modelname, model_name, strlen("FSH082")<(modelname_len-1)?strlen("FSH082"):(modelname_len-1)); return PSU_TYPE_ACBEL; } @@ -118,14 +118,14 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (!strncmp(model_name, "YESM1300AM", strlen("YESM1300AM"))) { if (modelname) - strncpy(modelname, model_name, strlen("YESM1300AM")<(modelname_len-1)?strlen("YESM1300AM"):(modelname_len-1)); + aim_strlcpy(modelname, model_name, strlen("YESM1300AM")<(modelname_len-1)?strlen("YESM1300AM"):(modelname_len-1)); return PSU_TYPE_YESM1300; } if (!strncmp(model_name, "YM-2651Y", strlen("YM-2651Y"))) { if (modelname) - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); return PSU_TYPE_YM2651Y; } diff --git a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/auto/x86_64_accton_asgvolt64.yml b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/auto/x86_64_accton_asgvolt64.yml index e42c318b..879e0f15 100755 --- a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/auto/x86_64_accton_asgvolt64.yml +++ b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/auto/x86_64_accton_asgvolt64.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/inc/x86_64_accton_asgvolt64/x86_64_accton_asgvolt64_porting.h b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/inc/x86_64_accton_asgvolt64/x86_64_accton_asgvolt64_porting.h index ce43fc7c..e7702ea1 100755 --- a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/inc/x86_64_accton_asgvolt64/x86_64_accton_asgvolt64_porting.h +++ b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/inc/x86_64_accton_asgvolt64/x86_64_accton_asgvolt64_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_ASGVOLT64_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_ASGVOLT64_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_ASGVOLT64_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_ASGVOLT64_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_ASGVOLT64_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_ASGVOLT64_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_ASGVOLT64_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/ledi.c b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/ledi.c index 4bd557dd..2331866a 100755 --- a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/ledi.c @@ -25,6 +25,8 @@ ***********************************************************/ #include #include +#include + #include "platform_lib.h" #define VALIDATE(_id) \ @@ -147,7 +149,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -155,14 +157,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -170,7 +172,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -188,15 +190,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, leds[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -235,7 +237,7 @@ onlp_ledi_set(onlp_oid_t id, int on_or_off) } return ONLP_STATUS_E_UNSUPPORTED; - + } /* @@ -248,13 +250,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, leds[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, leds[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -271,4 +273,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/psui.c b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/psui.c index b5adbe66..b4f96945 100755 --- a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/psui.c +++ b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/psui.c @@ -137,14 +137,14 @@ onlp_psui_info_get(onlp_oid_t id, onlp_psu_info_t* info) char *string = NULL; int len = onlp_file_read_str(&string, "%s""psu%d_model", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->model, string, len); + aim_strlcpy(info->model, string, len); aim_free(string); } /* Read serial */ len = onlp_file_read_str(&string, "%s""psu%d_serial", PSU_SYSFS_PATH, pid); if (string && len) { - strncpy(info->serial, string, len); + aim_strlcpy(info->serial, string, len); aim_free(string); } diff --git a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/sysi.c b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/sysi.c index 6f521b9d..dd614159 100755 --- a/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/sysi.c +++ b/packages/platforms/accton/x86-64/asgvolt64/onlp/builds/x86_64_accton_asgvolt64/module/src/sysi.c @@ -49,29 +49,29 @@ onlp_sysi_init(void) int skfd = -1; char interface[64]; struct ifreq ifr; - + if ((skfd = socket(AF_INET, SOCK_DGRAM,0)) < 0) { perror("socket"); return ONLP_STATUS_OK; } memset(interface, 0x0, 64); - strncpy(interface, "eth0", strlen("eth0")); - strncpy(ifr.ifr_name, interface, IFNAMSIZ); + aim_strlcpy(interface, "eth0", strlen("eth0")); + aim_strlcpy(ifr.ifr_name, interface, IFNAMSIZ); if (ioctl(skfd, SIOCGMIIPHY, &ifr) < 0) { if (errno != ENODEV) fprintf(stderr, "SIOCGMIIPHY on '%s' failed: %s\n", interface, strerror(errno)); - close(skfd); + close(skfd); return ONLP_STATUS_E_INTERNAL; } /* fix mgt port led issue */ mdio_write(skfd, 0x16, 3, ifr); - mdio_write(skfd, 0x10, 0x7204, ifr); + mdio_write(skfd, 0x10, 0x7204, ifr); mdio_write(skfd, 0x11, 0x4455, ifr); mdio_write(skfd, 0x16, 0, ifr); close(skfd); - + return ONLP_STATUS_OK; } @@ -97,7 +97,7 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max) int i; onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); - + /* 7 Thermal sensors on the chassis */ for (i = 1; i <= CHASSIS_THERMAL_COUNT; i++) { *e++ = ONLP_THERMAL_ID_CREATE(i); @@ -152,9 +152,9 @@ onlp_sysi_platform_info_get(onlp_platform_info_t* pi) } } - pi->cpld_versions = aim_fstrdup("%s:%d, %s:%d, %s:%d, %s:%d", + pi->cpld_versions = aim_fstrdup("%s:%d, %s:%d, %s:%d, %s:%d", cplds[0].description, cplds[0].version, - cplds[1].description, cplds[1].version, + cplds[1].description, cplds[1].version, cplds[2].description, cplds[2].version); return ONLP_STATUS_OK; @@ -165,4 +165,3 @@ onlp_sysi_platform_info_free(onlp_platform_info_t* pi) { aim_free(pi->cpld_versions); } - diff --git a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/auto/x86_64_accton_asxvolt16.yml b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/auto/x86_64_accton_asxvolt16.yml index 3feac7ad..0314d71b 100755 --- a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/auto/x86_64_accton_asxvolt16.yml +++ b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/auto/x86_64_accton_asxvolt16.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/inc/x86_64_accton_asxvolt16/x86_64_accton_asxvolt16_porting.h b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/inc/x86_64_accton_asxvolt16/x86_64_accton_asxvolt16_porting.h index 1f117b71..304784ce 100755 --- a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/inc/x86_64_accton_asxvolt16/x86_64_accton_asxvolt16_porting.h +++ b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/inc/x86_64_accton_asxvolt16/x86_64_accton_asxvolt16_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_ASXVOLT16_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_ASXVOLT16_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_ASXVOLT16_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_ASXVOLT16_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_ASXVOLT16_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_ASXVOLT16_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_ASXVOLT16_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/src/platform_lib.c b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/src/platform_lib.c index e4784251..e0ef8ae7 100755 --- a/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/asxvolt16/onlp/builds/x86_64_accton_asxvolt16/module/src/platform_lib.c @@ -132,7 +132,7 @@ int get_psu_serial_number(int id, char *serial, int serial_len) sn[PSU_SERIAL_NUMBER_LEN] = 0; if (serial) { - strncpy(serial, sn, sizeof(sn)); + aim_strlcpy(serial, sn, sizeof(sn)); } return ONLP_STATUS_OK; @@ -156,7 +156,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, sizeof(model_name)-1); + aim_strlcpy(modelname, model_name, sizeof(model_name)-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/auto/x86_64_accton_csp9250.yml b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/auto/x86_64_accton_csp9250.yml index 179347cd..490988ea 100755 --- a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/auto/x86_64_accton_csp9250.yml +++ b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/auto/x86_64_accton_csp9250.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/inc/x86_64_accton_csp9250/x86_64_accton_csp9250_porting.h b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/inc/x86_64_accton_csp9250/x86_64_accton_csp9250_porting.h index 6b56b58b..8066498f 100755 --- a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/inc/x86_64_accton_csp9250/x86_64_accton_csp9250_porting.h +++ b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/inc/x86_64_accton_csp9250/x86_64_accton_csp9250_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_CSP9250_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_CSP9250_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_CSP9250_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_CSP9250_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_CSP9250_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_CSP9250_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_CSP9250_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/ledi.c b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/ledi.c index 17f4bb29..9d675f21 100755 --- a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/ledi.c +++ b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/ledi.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "platform_lib.h" @@ -53,7 +54,7 @@ enum onlp_led_id LED_PSU1, LED_PSU2 }; - + enum led_light_mode { LED_MODE_OFF = 0, LED_MODE_GREEN, @@ -132,7 +133,7 @@ static onlp_led_info_t linfo[] = static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driver_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for (i = 0; i < nsize; i++) { if (id == led_map[i].id && driver_led_mode == led_map[i].driver_led_mode) @@ -140,14 +141,14 @@ static int driver_to_onlp_led_mode(enum onlp_led_id id, enum led_light_mode driv return led_map[i].onlp_led_mode; } } - + return 0; } static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led_mode) { int i, nsize = sizeof(led_map)/sizeof(led_map[0]); - + for(i = 0; i < nsize; i++) { if (id == led_map[i].id && onlp_led_mode == led_map[i].onlp_led_mode) @@ -155,7 +156,7 @@ static int onlp_to_driver_led_mode(enum onlp_led_id id, onlp_led_mode_t onlp_led return led_map[i].driver_led_mode; } } - + return 0; } @@ -176,15 +177,15 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { int local_id; char data[2] = {0}; - char fullpath[50] = {0}; - + char fullpath[PATH_MAX] = {0}; + VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - + /* get fullpath */ sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; @@ -235,13 +236,13 @@ int onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { int local_id; - char fullpath[50] = {0}; + char fullpath[PATH_MAX] = {0}; VALIDATE(id); - + local_id = ONLP_OID_ID_GET(id); - sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); - + sprintf(fullpath, "%s%s/%s", prefix_path, last_path[local_id], filename); + if (onlp_file_write_integer(fullpath, onlp_to_driver_led_mode(local_id, mode)) != 0) { return ONLP_STATUS_E_INTERNAL; @@ -258,4 +259,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - diff --git a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/platform_lib.c b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/platform_lib.c index 8d46f100..47b1da0c 100755 --- a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/module/src/platform_lib.c @@ -110,7 +110,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) } if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); diff --git a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/x86_64_accton_csp9250.mk b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/x86_64_accton_csp9250.mk index 32086ca0..19441a92 100755 --- a/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/x86_64_accton_csp9250.mk +++ b/packages/platforms/accton/x86-64/csp9250/onlp/builds/x86_64_accton_csp9250/x86_64_accton_csp9250.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_accton_csp9250 module. # -# Autogenerated 2019-07-13 17:26:28.784151 +# Autogenerated 2019-07-30 18:48:00.994027 # ############################################################################### x86_64_accton_csp9250_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/auto/x86_64_accton_minipack.yml b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/auto/x86_64_accton_minipack.yml index 2dfd48fb..ed115a25 100644 --- a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/auto/x86_64_accton_minipack.yml +++ b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/auto/x86_64_accton_minipack.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/inc/x86_64_accton_minipack/x86_64_accton_minipack_porting.h b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/inc/x86_64_accton_minipack/x86_64_accton_minipack_porting.h index ebe9cb64..72ce671c 100644 --- a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/inc/x86_64_accton_minipack/x86_64_accton_minipack_porting.h +++ b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/inc/x86_64_accton_minipack/x86_64_accton_minipack_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_MINIPACK_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_MINIPACK_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_MINIPACK_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_MINIPACK_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_MINIPACK_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_MINIPACK_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_MINIPACK_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/platform_lib.c b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/platform_lib.c index 4a2ddf5f..190c6717 100755 --- a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/platform_lib.c +++ b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/platform_lib.c @@ -222,7 +222,7 @@ tty_transaction(const char *cmd, uint32_t udelay, char *resp, int max_size) AIM_LOG_ERROR("ERROR: Cannot read/write TTY device\n"); goto exit; } - strncpy(resp, buf, max_size); + aim_strlcpy(resp, buf, max_size); exit: free(buf); tty_close(&tty_fd); diff --git a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/psui.c b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/psui.c index a635dcb3..a8a172f2 100755 --- a/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/psui.c +++ b/packages/platforms/accton/x86-64/minipack/onlp/builds/x86_64_accton_minipack/module/src/psui.c @@ -198,15 +198,15 @@ onlp_psui_get_string(int pid, onlp_psu_info_t* info) SEM_UNLOCK; return ONLP_STATUS_E_INTERNAL; } - strncpy(ps->model, info->model, sizeof(ps->model)); - strncpy(ps->serial, info->serial, sizeof(ps->serial)); + aim_strlcpy(ps->model, info->model, sizeof(ps->model)); + aim_strlcpy(ps->serial, info->serial, sizeof(ps->serial)); ps->status = info->status; ps->caps = info->caps; ps->valid = true; ps->last_poll = time (NULL); } else { - strncpy(info->model, ps->model, sizeof(info->model)); - strncpy(info->serial, ps->serial, sizeof(info->serial)); + aim_strlcpy(info->model, ps->model, sizeof(info->model)); + aim_strlcpy(info->serial, ps->serial, sizeof(info->serial)); info->status = ps->status; info->caps = ps->caps; } diff --git a/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/auto/x86_64_accton_wedge100_32x.yml b/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/auto/x86_64_accton_wedge100_32x.yml index 21f43840..755ece2f 100644 --- a/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/auto/x86_64_accton_wedge100_32x.yml +++ b/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/auto/x86_64_accton_wedge100_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/inc/x86_64_accton_wedge100_32x/x86_64_accton_wedge100_32x_porting.h b/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/inc/x86_64_accton_wedge100_32x/x86_64_accton_wedge100_32x_porting.h index 4b6d6ad6..7c1c6034 100644 --- a/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/inc/x86_64_accton_wedge100_32x/x86_64_accton_wedge100_32x_porting.h +++ b/packages/platforms/accton/x86-64/wedge100-32x/onlp/builds/x86_64_accton_wedge100_32x/module/inc/x86_64_accton_wedge100_32x/x86_64_accton_wedge100_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_WEDGE100_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_WEDGE100_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_WEDGE100_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_WEDGE100_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_WEDGE100_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_WEDGE100_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_WEDGE100_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/auto/x86_64_accton_wedge100bf_32x.yml b/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/auto/x86_64_accton_wedge100bf_32x.yml index bc8b1570..d540be39 100644 --- a/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/auto/x86_64_accton_wedge100bf_32x.yml +++ b/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/auto/x86_64_accton_wedge100bf_32x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/inc/x86_64_accton_wedge100bf_32x/x86_64_accton_wedge100bf_32x_porting.h b/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/inc/x86_64_accton_wedge100bf_32x/x86_64_accton_wedge100bf_32x_porting.h index 20715bdc..16edce9e 100644 --- a/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/inc/x86_64_accton_wedge100bf_32x/x86_64_accton_wedge100bf_32x_porting.h +++ b/packages/platforms/accton/x86-64/wedge100bf-32x/onlp/builds/x86_64_accton_wedge100bf_32x/module/inc/x86_64_accton_wedge100bf_32x/x86_64_accton_wedge100bf_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_WEDGE100BF_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_WEDGE100BF_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_WEDGE100BF_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_WEDGE100BF_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_WEDGE100BF_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_WEDGE100BF_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_WEDGE100BF_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/auto/x86_64_accton_wedge100bf_65x.yml b/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/auto/x86_64_accton_wedge100bf_65x.yml index e62f68c5..a4544e1a 100644 --- a/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/auto/x86_64_accton_wedge100bf_65x.yml +++ b/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/auto/x86_64_accton_wedge100bf_65x.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/inc/x86_64_accton_wedge100bf_65x/x86_64_accton_wedge100bf_65x_porting.h b/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/inc/x86_64_accton_wedge100bf_65x/x86_64_accton_wedge100bf_65x_porting.h index f81170ae..21f9b572 100644 --- a/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/inc/x86_64_accton_wedge100bf_65x/x86_64_accton_wedge100bf_65x_porting.h +++ b/packages/platforms/accton/x86-64/wedge100bf-65x/onlp/builds/x86_64_accton_wedge100bf_65x/module/inc/x86_64_accton_wedge100bf_65x/x86_64_accton_wedge100bf_65x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_WEDGE100BF_65X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_WEDGE100BF_65X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_WEDGE100BF_65X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_WEDGE100BF_65X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_WEDGE100BF_65X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_WEDGE100BF_65X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_WEDGE100BF_65X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/auto/x86_64_accton_wedge100s_32x.yml b/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/auto/x86_64_accton_wedge100s_32x.yml index 608b348d..ed77f1e2 100644 --- a/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/auto/x86_64_accton_wedge100s_32x.yml +++ b/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/auto/x86_64_accton_wedge100s_32x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/inc/x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_porting.h b/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/inc/x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_porting.h index 6d6ce571..57a8ffae 100644 --- a/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/inc/x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_porting.h +++ b/packages/platforms/accton/x86-64/wedge100s-32x/onlp/builds/x86_64_accton_wedge100s_32x/module/inc/x86_64_accton_wedge100s_32x/x86_64_accton_wedge100s_32x_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ACCTON_WEDGE100S_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ACCTON_WEDGE100S_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ACCTON_WEDGE100S_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ACCTON_WEDGE100S_32X_STRNCPY strncpy - #else - #error The macro X86_64_ACCTON_WEDGE100S_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ACCTON_WEDGE100S_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/auto/x86_64_alphanetworks_snx60a0_486f.yml b/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/auto/x86_64_alphanetworks_snx60a0_486f.yml index 5a43e702..5bee1133 100644 --- a/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/auto/x86_64_alphanetworks_snx60a0_486f.yml +++ b/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/auto/x86_64_alphanetworks_snx60a0_486f.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/inc/x86_64_alphanetworks_snx60a0_486f/x86_64_alphanetworks_snx60a0_486f_porting.h b/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/inc/x86_64_alphanetworks_snx60a0_486f/x86_64_alphanetworks_snx60a0_486f_porting.h index b54775c1..4706c8a2 100644 --- a/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/inc/x86_64_alphanetworks_snx60a0_486f/x86_64_alphanetworks_snx60a0_486f_porting.h +++ b/packages/platforms/alphanetworks/x86-64/snx60a0-486f/onlp/builds/x86_64_alphanetworks_snx60a0_486f/module/inc/x86_64_alphanetworks_snx60a0_486f/x86_64_alphanetworks_snx60a0_486f_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_ALPHANETWORKS_SNX60A0_486F_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_ALPHANETWORKS_SNX60A0_486F_STRNCPY GLOBAL_STRNCPY - #elif X86_64_ALPHANETWORKS_SNX60A0_486F_CONFIG_PORTING_STDLIB == 1 - #define X86_64_ALPHANETWORKS_SNX60A0_486F_STRNCPY strncpy - #else - #error The macro X86_64_ALPHANETWORKS_SNX60A0_486F_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_ALPHANETWORKS_SNX60A0_486F_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_ALPHANETWORKS_SNX60A0_486F_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/auto/x86_64_cel_redstone_xp.yml b/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/auto/x86_64_cel_redstone_xp.yml index 22d6adf9..24157ac9 100644 --- a/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/auto/x86_64_cel_redstone_xp.yml +++ b/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/auto/x86_64_cel_redstone_xp.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/inc/x86_64_cel_redstone_xp/x86_64_cel_redstone_xp_porting.h b/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/inc/x86_64_cel_redstone_xp/x86_64_cel_redstone_xp_porting.h index cf9ed33d..5cf829c7 100644 --- a/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/inc/x86_64_cel_redstone_xp/x86_64_cel_redstone_xp_porting.h +++ b/packages/platforms/celestica/x86-64/redstone-xp/onlp/builds/x86_64_cel_redstone_xp/module/inc/x86_64_cel_redstone_xp/x86_64_cel_redstone_xp_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_CEL_REDSTONE_XP_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_CEL_REDSTONE_XP_STRNCPY GLOBAL_STRNCPY - #elif X86_64_CEL_REDSTONE_XP_CONFIG_PORTING_STDLIB == 1 - #define X86_64_CEL_REDSTONE_XP_STRNCPY strncpy - #else - #error The macro X86_64_CEL_REDSTONE_XP_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_CEL_REDSTONE_XP_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_CEL_REDSTONE_XP_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/arm_delta_ag6248c.mk b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/arm_delta_ag6248c.mk index e915bc51..c7c0c515 100644 --- a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/arm_delta_ag6248c.mk +++ b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/arm_delta_ag6248c.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the arm_delta_ag6248c module. # -# Autogenerated 2019-07-11 19:31:22.474361 +# Autogenerated 2019-07-30 18:47:57.006136 # ############################################################################### arm_delta_ag6248c_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/auto/arm_delta_ag6248c.yml b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/auto/arm_delta_ag6248c.yml index c807d0c5..1a34e2f4 100644 --- a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/auto/arm_delta_ag6248c.yml +++ b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/auto/arm_delta_ag6248c.yml @@ -55,7 +55,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/inc/arm_delta_ag6248c/arm_delta_ag6248c_porting.h b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/inc/arm_delta_ag6248c/arm_delta_ag6248c_porting.h index 15f715f3..1d3eebbf 100644 --- a/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/inc/arm_delta_ag6248c/arm_delta_ag6248c_porting.h +++ b/packages/platforms/delta/armel/ag6248c/src/arm_delta_ag6248c/module/inc/arm_delta_ag6248c/arm_delta_ag6248c_porting.h @@ -79,16 +79,6 @@ #endif #endif -#ifndef ARM_DELTA_AG6248C_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define ARM_DELTA_AG6248C_STRNCPY GLOBAL_STRNCPY - #elif ARM_DELTA_AG6248C_CONFIG_PORTING_STDLIB == 1 - #define ARM_DELTA_AG6248C_STRNCPY strncpy - #else - #error The macro ARM_DELTA_AG6248C_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef ARM_DELTA_AG6248C_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define ARM_DELTA_AG6248C_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/auto/x86_64_delta_ag5648.yml b/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/auto/x86_64_delta_ag5648.yml index 71c8479c..0d70d26c 100644 --- a/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/auto/x86_64_delta_ag5648.yml +++ b/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/auto/x86_64_delta_ag5648.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/inc/x86_64_delta_ag5648/x86_64_delta_ag5648_porting.h b/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/inc/x86_64_delta_ag5648/x86_64_delta_ag5648_porting.h index 477c4e1e..af979b07 100644 --- a/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/inc/x86_64_delta_ag5648/x86_64_delta_ag5648_porting.h +++ b/packages/platforms/delta/x86-64/ag5648/onlp/builds/x86_64_delta_ag5648/module/inc/x86_64_delta_ag5648/x86_64_delta_ag5648_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG5648_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG5648_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG5648_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG5648_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG5648_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG5648_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG5648_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/auto/x86_64_delta_ag7648.yml b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/auto/x86_64_delta_ag7648.yml index 747b8221..c4c7fd0e 100644 --- a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/auto/x86_64_delta_ag7648.yml +++ b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/auto/x86_64_delta_ag7648.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/inc/x86_64_delta_ag7648/x86_64_delta_ag7648_porting.h b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/inc/x86_64_delta_ag7648/x86_64_delta_ag7648_porting.h index 025c6102..a9d4241a 100644 --- a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/inc/x86_64_delta_ag7648/x86_64_delta_ag7648_porting.h +++ b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/inc/x86_64_delta_ag7648/x86_64_delta_ag7648_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG7648_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG7648_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG7648_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG7648_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG7648_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG7648_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG7648_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/platform_lib.c b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/platform_lib.c index 2f92e207..cea78f93 100755 --- a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/platform_lib.c +++ b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/platform_lib.c @@ -48,13 +48,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "CPR-4011-4M11", strlen("CPR-4011-4M11")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_F2B; } else if (strncmp(model_name, "CPR-4011-4M21", strlen("CPR-4011-4M21")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_AC_B2F; } @@ -67,13 +67,13 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (deviceNodeReadString(node, model_name, sizeof(model_name), 0) == 0) { if (strncmp(model_name, "um400d01G", strlen("um400d01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_B2F; } else if (strncmp(model_name, "um400d01-01G", strlen("um400d01-01G")) == 0) { if (modelname) { - strncpy(modelname, model_name, modelname_len-1); + aim_strlcpy(modelname, model_name, modelname_len-1); } return PSU_TYPE_DC_48V_F2B; } diff --git a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/sysi.c b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/sysi.c index 7c4ca2ee..51c9595d 100755 --- a/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/sysi.c +++ b/packages/platforms/delta/x86-64/ag7648/onlp/builds/x86_64_delta_ag7648/module/src/sysi.c @@ -43,18 +43,18 @@ platform_id_t platform_id = PLATFORM_ID_UNKNOWN; #define ONIE_PLATFORM_NAME "x86-64-delta-ag7648-r0" const char* onlp_sysi_platform_get(void) -{ +{ enum ag7648_product_id pid = get_product_id(); - + if (pid == PID_AG7648) return "x86-64-delta-ag7648"; - else + else return "unknow"; } int onlp_sysi_platform_set(const char* platform) -{ +{ if(strstr(platform,"x86-64-delta-ag7648-r0")) { platform_id = PLATFORM_ID_DELTA_AG7648_R0; return ONLP_STATUS_OK; @@ -65,11 +65,11 @@ onlp_sysi_platform_set(const char* platform) int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) -{ +{ int v; - + v = i2c_devname_read_byte("SYSCPLD", 0X0); - + pi->cpld_versions = aim_fstrdup("%d", v & 0xf); return 0; @@ -98,19 +98,19 @@ onlp_sysi_onie_data_get(uint8_t** data, int* size) AIM_LOG_ERROR("Unable to read the %d reg \r\n",i); break; } - + } - + *data = rdata; return ONLP_STATUS_OK; - + } void onlp_sysi_onie_data_free(uint8_t* data) -{ +{ aim_free(data); } @@ -118,7 +118,7 @@ onlp_sysi_onie_data_free(uint8_t* data) int onlp_sysi_oids_get(onlp_oid_t* table, int max) -{ +{ int i; onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); @@ -147,7 +147,7 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max) } int onlp_sysi_onie_info_get(onlp_onie_info_t* onie) -{ +{ if(onie){ onie->platform_name = aim_strdup(ONIE_PLATFORM_NAME); } @@ -158,48 +158,48 @@ onlp_sysi_onie_info_get(onlp_onie_info_t* onie) int onlp_sysi_platform_manage_fans(void) -{ +{ int rc; onlp_thermal_info_t ti2, ti3, ti4; int mtemp=0; int new_rpm=0; - + if (chassis_fan_count() == 0) { return ONLP_STATUS_E_UNSUPPORTED; } - + /* Get temperature */ /*rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(1), &ti1); - + if (rc != ONLP_STATUS_OK) { return rc; }*/ - + rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(2), &ti2); - + if (rc != ONLP_STATUS_OK) { return rc; } rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(3), &ti3); - + if (rc != ONLP_STATUS_OK) { return rc; } - + rc = onlp_thermali_info_get(ONLP_THERMAL_ID_CREATE(4), &ti4); - + if (rc != ONLP_STATUS_OK) { return rc; } - + mtemp=(ti2.mcelsius+ti3.mcelsius + ti4.mcelsius) / 3; DEBUG_PRINT("mtemp %d\n", mtemp); /* Bring fan speed according the temp */ - + if(mtemp<25000) new_rpm=FAN_IDLE_RPM; else if((mtemp>=30000)&&(mtemp<40000)) @@ -213,25 +213,25 @@ onlp_sysi_platform_manage_fans(void) else{ return ONLP_STATUS_OK; } - + onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(1),new_rpm); - onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(2),new_rpm); - onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(3),new_rpm); - onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(4),new_rpm); - onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(5),new_rpm); + onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(2),new_rpm); + onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(3),new_rpm); + onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(4),new_rpm); + onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(5),new_rpm); onlp_fani_rpm_set(ONLP_FAN_ID_CREATE(6),new_rpm); - - - + + + return ONLP_STATUS_OK; } int onlp_sysi_platform_manage_leds(void) -{ +{ int i,tray_i,rc; onlp_fan_info_t info; onlp_led_mode_t fan_new_mode; @@ -250,7 +250,7 @@ onlp_sysi_platform_manage_leds(void) goto tray_next; } else{ - if((info.status&0x2)==1){ + if((info.status&0x2)){ fan_tray_new_mode[tray_i]=ONLP_LED_MODE_YELLOW; goto tray_next; } @@ -262,21 +262,21 @@ tray_next: continue; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY0),fan_tray_new_mode[0]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY1),fan_tray_new_mode[1]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY2),fan_tray_new_mode[2]); - - if((fan_tray_new_mode[0]==ONLP_LED_MODE_GREEN)&&(fan_tray_new_mode[1]==ONLP_LED_MODE_GREEN)&& + + if((fan_tray_new_mode[0]==ONLP_LED_MODE_GREEN)&&(fan_tray_new_mode[1]==ONLP_LED_MODE_GREEN)&& (fan_tray_new_mode[2]==ONLP_LED_MODE_GREEN)) fan_new_mode=ONLP_LED_MODE_GREEN; - else if((fan_tray_new_mode[0]==ONLP_LED_MODE_OFF)||(fan_tray_new_mode[1]==ONLP_LED_MODE_OFF)|| + else if((fan_tray_new_mode[0]==ONLP_LED_MODE_OFF)||(fan_tray_new_mode[1]==ONLP_LED_MODE_OFF)|| (fan_tray_new_mode[2]==ONLP_LED_MODE_OFF)) fan_new_mode=ONLP_LED_MODE_YELLOW; else fan_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; - + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN),fan_new_mode); /*psu1 and psu2 led */ for(i=1;i<=CHASSIS_PSU_COUNT;i++){ rc=onlp_psui_info_get(ONLP_PSU_ID_CREATE(i),&psu); - + if (rc != ONLP_STATUS_OK) { continue; } @@ -286,19 +286,18 @@ tray_next: continue; } } psu_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; - -sys_led : + +sys_led : onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_POWER),psu_new_mode); //sys led ---------------- if((fan_new_mode!=ONLP_LED_MODE_GREEN)||(psu_new_mode!=ONLP_LED_MODE_GREEN)) sys_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; else sys_new_mode=ONLP_LED_MODE_GREEN; - + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_SYS),sys_new_mode); - + locator_new_mode=ONLP_LED_MODE_GREEN; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOCATOR),locator_new_mode); return ONLP_STATUS_OK; } - diff --git a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/auto/x86_64_delta_ag7648c.yml b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/auto/x86_64_delta_ag7648c.yml index b2beca64..a647c652 100755 --- a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/auto/x86_64_delta_ag7648c.yml +++ b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/auto/x86_64_delta_ag7648c.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/inc/x86_64_delta_ag7648c/x86_64_delta_ag7648c_porting.h b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/inc/x86_64_delta_ag7648c/x86_64_delta_ag7648c_porting.h index a03a6d4e..eb96cedd 100755 --- a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/inc/x86_64_delta_ag7648c/x86_64_delta_ag7648c_porting.h +++ b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/inc/x86_64_delta_ag7648c/x86_64_delta_ag7648c_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG7648C_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG7648C_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG7648C_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG7648C_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG7648C_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG7648C_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG7648C_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/eeprom_info.c b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/eeprom_info.c index ffec5ee6..3461d09f 100755 --- a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/eeprom_info.c +++ b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/eeprom_info.c @@ -91,23 +91,23 @@ int eeprom_info_get(uint8_t *eeprom, int len, char *type, char *v) index = eeprom_info_find(eep,len,psu_model_key,1); if(index <0) return -1; - strncpy(model,&eep[index],PSU_MODEL_LEN); + aim_strlcpy(model,&eep[index],PSU_MODEL_LEN); if((strcmp(type,"psu_model"))==0){ - strncpy(v,model,PSU_MODEL_LEN); + aim_strlcpy(v,model,PSU_MODEL_LEN); } else if ((strcmp(type,"psu_series"))==0){ if(strstr(model,"460")){ index = eeprom_info_find(eep,len,psu_460_series_key,0); if(index <0) return -1; - strncpy(v,&eep[index],PSU_SERIES_LEN); + aim_strlcpy(v,&eep[index],PSU_SERIES_LEN); } else if(strstr(model,"550")){ index = eeprom_info_find(eep,len,psu_550_series_key,0); if(index <0) return -1; - strncpy(v,&eep[index],PSU_SERIES_LEN); + aim_strlcpy(v,&eep[index],PSU_SERIES_LEN); } } else{ diff --git a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/sysi.c b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/sysi.c index 49af2088..a4020997 100755 --- a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/sysi.c +++ b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/module/src/sysi.c @@ -43,18 +43,18 @@ platform_id_t platform_id = PLATFORM_ID_UNKNOWN; #define ONIE_PLATFORM_NAME "x86-64-delta-ag7648c-r0" const char* onlp_sysi_platform_get(void) -{ +{ enum ag7648c_product_id pid = get_product_id(); - + if (pid == PID_AG7648C) return "x86-64-delta-ag7648c"; - else + else return "unknow"; } int onlp_sysi_platform_set(const char* platform) -{ +{ if(strstr(platform,"x86-64-delta-ag7648c-r0")) { platform_id = PLATFORM_ID_DELTA_AG7648C_R0; return ONLP_STATUS_OK; @@ -65,11 +65,11 @@ onlp_sysi_platform_set(const char* platform) int onlp_sysi_platform_info_get(onlp_platform_info_t* pi) -{ +{ int v; - + v = i2c_devname_read_byte("SYSCPLD", 0X0); - + pi->cpld_versions = aim_fstrdup("%d", v & 0xf); return 0; @@ -98,19 +98,19 @@ onlp_sysi_onie_data_get(uint8_t** data, int* size) AIM_LOG_ERROR("Unable to read the %d reg \r\n",i); break; } - + } - + *data = rdata; return ONLP_STATUS_OK; - + } void onlp_sysi_onie_data_free(uint8_t* data) -{ +{ aim_free(data); } @@ -118,7 +118,7 @@ onlp_sysi_onie_data_free(uint8_t* data) int onlp_sysi_oids_get(onlp_oid_t* table, int max) -{ +{ int i; onlp_oid_t* e = table; memset(table, 0, max*sizeof(onlp_oid_t)); @@ -147,7 +147,7 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max) } int onlp_sysi_onie_info_get(onlp_onie_info_t* onie) -{ +{ if(onie){ onie->platform_name = aim_strdup(ONIE_PLATFORM_NAME); } @@ -158,48 +158,48 @@ onlp_sysi_onie_info_get(onlp_onie_info_t* onie) int onlp_sysi_platform_manage_fans(void) -{ +{ int rc; onlp_thermal_info_t ti2, ti3, ti4; int mtemp=0; int new_rpm=0; - + if (chassis_fan_count() == 0) { return ONLP_STATUS_E_UNSUPPORTED; } - + /* Get temperature */ /*rc = onlp_thermal_info_get(ONLP_THERMAL_ID_CREATE(1), &ti1); - + if (rc != ONLP_STATUS_OK) { return rc; }*/ - + rc = onlp_thermal_info_get(ONLP_THERMAL_ID_CREATE(2), &ti2); - + if (rc != ONLP_STATUS_OK) { return rc; } rc = onlp_thermal_info_get(ONLP_THERMAL_ID_CREATE(3), &ti3); - + if (rc != ONLP_STATUS_OK) { return rc; } - + rc = onlp_thermal_info_get(ONLP_THERMAL_ID_CREATE(4), &ti4); - + if (rc != ONLP_STATUS_OK) { return rc; } - + mtemp=(ti2.mcelsius+ti3.mcelsius + ti4.mcelsius) / 3; DEBUG_PRINT("mtemp %d\n", mtemp); /* Bring fan speed according the temp */ - + if(mtemp<25000) new_rpm=FAN_IDLE_RPM; else if((mtemp>=30000)&&(mtemp<40000)) @@ -213,21 +213,21 @@ onlp_sysi_platform_manage_fans(void) else{ return ONLP_STATUS_OK; } - + onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(1),new_rpm); - onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(2),new_rpm); - onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(3),new_rpm); - onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(4),new_rpm); - onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(5),new_rpm); + onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(2),new_rpm); + onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(3),new_rpm); + onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(4),new_rpm); + onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(5),new_rpm); onlp_fan_rpm_set(ONLP_FAN_ID_CREATE(6),new_rpm); - + return ONLP_STATUS_OK; } int onlp_sysi_platform_manage_leds(void) -{ +{ int i,tray_i,rc; onlp_fan_info_t info; onlp_led_mode_t fan_new_mode; @@ -246,7 +246,7 @@ onlp_sysi_platform_manage_leds(void) goto tray_next; } else{ - if((info.status&0x2)==1){ + if((info.status&0x2)){ fan_tray_new_mode[tray_i]=ONLP_LED_MODE_YELLOW; goto tray_next; } @@ -258,21 +258,21 @@ tray_next: continue; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY0),fan_tray_new_mode[0]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY1),fan_tray_new_mode[1]); onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN_TRAY2),fan_tray_new_mode[2]); - - if((fan_tray_new_mode[0]==ONLP_LED_MODE_GREEN)&&(fan_tray_new_mode[1]==ONLP_LED_MODE_GREEN)&& + + if((fan_tray_new_mode[0]==ONLP_LED_MODE_GREEN)&&(fan_tray_new_mode[1]==ONLP_LED_MODE_GREEN)&& (fan_tray_new_mode[2]==ONLP_LED_MODE_GREEN)) fan_new_mode=ONLP_LED_MODE_GREEN; - else if((fan_tray_new_mode[0]==ONLP_LED_MODE_OFF)||(fan_tray_new_mode[1]==ONLP_LED_MODE_OFF)|| + else if((fan_tray_new_mode[0]==ONLP_LED_MODE_OFF)||(fan_tray_new_mode[1]==ONLP_LED_MODE_OFF)|| (fan_tray_new_mode[2]==ONLP_LED_MODE_OFF)) fan_new_mode=ONLP_LED_MODE_YELLOW; else fan_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; - + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_FAN),fan_new_mode); /*psu1 and psu2 led */ for(i=1;i<=CHASSIS_PSU_COUNT;i++){ rc=onlp_psui_info_get(ONLP_PSU_ID_CREATE(i),&psu); - + if (rc != ONLP_STATUS_OK) { continue; } @@ -282,19 +282,18 @@ tray_next: continue; } } psu_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; - -sys_led : + +sys_led : onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_POWER),psu_new_mode); //sys led ---------------- if((fan_new_mode!=ONLP_LED_MODE_GREEN)||(psu_new_mode!=ONLP_LED_MODE_GREEN)) sys_new_mode=ONLP_LED_MODE_YELLOW_BLINKING; else sys_new_mode=ONLP_LED_MODE_GREEN; - + onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_SYS),sys_new_mode); - + locator_new_mode=ONLP_LED_MODE_BLUE; onlp_ledi_mode_set(ONLP_LED_ID_CREATE(LED_LOCATOR),locator_new_mode); return ONLP_STATUS_OK; } - diff --git a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/x86_64_delta_ag7648c.mk b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/x86_64_delta_ag7648c.mk index 1ad4b1a2..e8fab4bc 100755 --- a/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/x86_64_delta_ag7648c.mk +++ b/packages/platforms/delta/x86-64/ag7648c/onlp/builds/x86_64_delta_ag7648c/x86_64_delta_ag7648c.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_delta_ag7648c module. # -# Autogenerated 2019-07-13 17:35:31.582275 +# Autogenerated 2019-07-30 18:47:54.130804 # ############################################################################### x86_64_delta_ag7648c_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/auto/x86_64_delta_ag8032.yml b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/auto/x86_64_delta_ag8032.yml index 1c6ea4f4..42f0f70f 100644 --- a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/auto/x86_64_delta_ag8032.yml +++ b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/auto/x86_64_delta_ag8032.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/inc/x86_64_delta_ag8032/x86_64_delta_ag8032_porting.h b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/inc/x86_64_delta_ag8032/x86_64_delta_ag8032_porting.h index 9088d81b..f8e427c7 100644 --- a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/inc/x86_64_delta_ag8032/x86_64_delta_ag8032_porting.h +++ b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/inc/x86_64_delta_ag8032/x86_64_delta_ag8032_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG8032_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG8032_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG8032_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG8032_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG8032_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG8032_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG8032_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/src/eeprom_info.c b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/src/eeprom_info.c index c780578f..a5b89980 100644 --- a/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/src/eeprom_info.c +++ b/packages/platforms/delta/x86-64/ag8032/onlp/builds/x86_64_delta_ag8032/module/src/eeprom_info.c @@ -91,23 +91,23 @@ int eeprom_info_get(uint8_t *eeprom, int len, char *type, char *v) index = eeprom_info_find(eep,len,psu_model_key,1); if(index <0) return -1; - strncpy(model,&eep[index],PSU_MODEL_LEN); + aim_strlcpy(model,&eep[index],PSU_MODEL_LEN); if((strcmp(type,"psu_model"))==0){ - strncpy(v,model,PSU_MODEL_LEN); + aim_strlcpy(v,model,PSU_MODEL_LEN); } else if ((strcmp(type,"psu_series"))==0){ if(strstr(model,"460")){ index = eeprom_info_find(eep,len,psu_460_series_key,0); if(index <0) return -1; - strncpy(v,&eep[index],PSU_SERIES_LEN); + aim_strlcpy(v,&eep[index],PSU_SERIES_LEN); } else if(strstr(model,"550")){ index = eeprom_info_find(eep,len,psu_550_series_key,0); if(index <0) return -1; - strncpy(v,&eep[index],PSU_SERIES_LEN); + aim_strlcpy(v,&eep[index],PSU_SERIES_LEN); } } else diff --git a/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/auto/x86_64_delta_ag9032v1.yml b/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/auto/x86_64_delta_ag9032v1.yml index 5b20bcaf..bae13e84 100644 --- a/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/auto/x86_64_delta_ag9032v1.yml +++ b/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/auto/x86_64_delta_ag9032v1.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/inc/x86_64_delta_ag9032v1/x86_64_delta_ag9032v1_porting.h b/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/inc/x86_64_delta_ag9032v1/x86_64_delta_ag9032v1_porting.h index bd149077..59f57438 100644 --- a/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/inc/x86_64_delta_ag9032v1/x86_64_delta_ag9032v1_porting.h +++ b/packages/platforms/delta/x86-64/ag9032v1/onlp/builds/x86_64_delta_ag9032v1/module/inc/x86_64_delta_ag9032v1/x86_64_delta_ag9032v1_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG9032V1_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG9032V1_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG9032V1_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG9032V1_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG9032V1_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG9032V1_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG9032V1_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/auto/x86_64_delta_ag9032v2.yml b/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/auto/x86_64_delta_ag9032v2.yml index a097592f..56da24ec 100644 --- a/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/auto/x86_64_delta_ag9032v2.yml +++ b/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/auto/x86_64_delta_ag9032v2.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/inc/x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_porting.h b/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/inc/x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_porting.h index e792e33b..80b9d2f3 100644 --- a/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/inc/x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_porting.h +++ b/packages/platforms/delta/x86-64/ag9032v2/onlp/builds/x86_64_delta_ag9032v2/module/inc/x86_64_delta_ag9032v2/x86_64_delta_ag9032v2_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG9032V2_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG9032V2_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG9032V2_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG9032V2_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG9032V2_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG9032V2_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG9032V2_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/auto/x86_64_delta_ag9032v2a.yml b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/auto/x86_64_delta_ag9032v2a.yml index 78134b91..5191212b 100755 --- a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/auto/x86_64_delta_ag9032v2a.yml +++ b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/auto/x86_64_delta_ag9032v2a.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/inc/x86_64_delta_ag9032v2a/x86_64_delta_ag9032v2a_porting.h b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/inc/x86_64_delta_ag9032v2a/x86_64_delta_ag9032v2a_porting.h index 5493d589..f0ea9bac 100755 --- a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/inc/x86_64_delta_ag9032v2a/x86_64_delta_ag9032v2a_porting.h +++ b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/inc/x86_64_delta_ag9032v2a/x86_64_delta_ag9032v2a_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG9032V2A_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG9032V2A_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG9032V2A_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG9032V2A_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG9032V2A_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG9032V2A_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG9032V2A_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/src/platform_lib.c b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/src/platform_lib.c index c02dabbe..b62cd7db 100755 --- a/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/src/platform_lib.c +++ b/packages/platforms/delta/x86-64/ag9032v2a/onlp/builds/x86_64_delta_ag9032v2a/module/src/platform_lib.c @@ -56,10 +56,10 @@ void lockinit() { static int sem_inited = 0; if(!sem_inited) - { + { onlp_shlock_create(DNILOCK_MAGIC, &dni_lock, "bus-lock"); sem_inited = 1; - } + } } int dni_bmc_sensor_read(char *device_name, UINT4 *num, UINT4 multiplier) @@ -176,7 +176,7 @@ int dni_psu_present(int *r_data) { FILE *fptr = NULL; int rv = ONLP_STATUS_OK; - char cmd[35] = {0}; + char cmd[256] = {0}; char str_data[50] = {0}; sprintf(cmd, "ipmitool raw 0x38 0x2 3 0x6a 0x03 1"); fptr = popen(cmd, "r"); @@ -199,10 +199,10 @@ dni_psui_eeprom_info_get(char * r_data,char *device_name,int number) int i = 0; int rv = ONLP_STATUS_OK; FILE *fptr = NULL; - char cmd[35] = {0}; + char cmd[256] = {0}; char str_data[50] = {0} ; char buf; - char* renewCh; + char* renewCh; sprintf(cmd, "ipmitool fru print %d | grep '%s' | awk -F':' '{print $2}'",number,device_name); fptr = popen(cmd, "r"); while((buf = fgetc(fptr)) != EOF) @@ -515,4 +515,3 @@ int dni_i2c_read_attribute_string(char *filename, char *buffer, int buf_size, in return ret; } - diff --git a/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/auto/x86_64_delta_ag9064.yml b/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/auto/x86_64_delta_ag9064.yml index 5d9ad4d7..bff45bd4 100755 --- a/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/auto/x86_64_delta_ag9064.yml +++ b/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/auto/x86_64_delta_ag9064.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/inc/x86_64_delta_ag9064/x86_64_delta_ag9064_porting.h b/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/inc/x86_64_delta_ag9064/x86_64_delta_ag9064_porting.h index fc56bd71..bbe44b42 100755 --- a/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/inc/x86_64_delta_ag9064/x86_64_delta_ag9064_porting.h +++ b/packages/platforms/delta/x86-64/ag9064/onlp/builds/x86_64_delta_ag9064/module/inc/x86_64_delta_ag9064/x86_64_delta_ag9064_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AG9064_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AG9064_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AG9064_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AG9064_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AG9064_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AG9064_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AG9064_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/auto/x86_64_delta_agc5648s.yml b/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/auto/x86_64_delta_agc5648s.yml index 1a141796..15f2f825 100755 --- a/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/auto/x86_64_delta_agc5648s.yml +++ b/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/auto/x86_64_delta_agc5648s.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/inc/x86_64_delta_agc5648s/x86_64_delta_agc5648s_porting.h b/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/inc/x86_64_delta_agc5648s/x86_64_delta_agc5648s_porting.h index a6a63870..1ea9d5fc 100755 --- a/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/inc/x86_64_delta_agc5648s/x86_64_delta_agc5648s_porting.h +++ b/packages/platforms/delta/x86-64/agc5648s/onlp/builds/x86_64_delta_agc5648s/module/inc/x86_64_delta_agc5648s/x86_64_delta_agc5648s_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AGC5648S_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AGC5648S_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AGC5648S_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AGC5648S_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AGC5648S_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AGC5648S_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AGC5648S_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/auto/x86_64_delta_agc7646slv1b.yml b/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/auto/x86_64_delta_agc7646slv1b.yml index 828949ba..50120587 100755 --- a/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/auto/x86_64_delta_agc7646slv1b.yml +++ b/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/auto/x86_64_delta_agc7646slv1b.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/inc/x86_64_delta_agc7646slv1b/x86_64_delta_agc7646slv1b_porting.h b/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/inc/x86_64_delta_agc7646slv1b/x86_64_delta_agc7646slv1b_porting.h index 5fffea5a..b0380ea1 100755 --- a/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/inc/x86_64_delta_agc7646slv1b/x86_64_delta_agc7646slv1b_porting.h +++ b/packages/platforms/delta/x86-64/agc7646slv1b/onlp/builds/x86_64_delta_agc7646slv1b/module/inc/x86_64_delta_agc7646slv1b/x86_64_delta_agc7646slv1b_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AGC7646SLV1B_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AGC7646SLV1B_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AGC7646SLV1B_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AGC7646SLV1B_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AGC7646SLV1B_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AGC7646SLV1B_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AGC7646SLV1B_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/auto/x86_64_delta_agc7648a.yml b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/auto/x86_64_delta_agc7648a.yml index 1202f34a..8fd29f2e 100644 --- a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/auto/x86_64_delta_agc7648a.yml +++ b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/auto/x86_64_delta_agc7648a.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/inc/x86_64_delta_agc7648a/x86_64_delta_agc7648a_porting.h b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/inc/x86_64_delta_agc7648a/x86_64_delta_agc7648a_porting.h index b0219e95..512103c2 100644 --- a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/inc/x86_64_delta_agc7648a/x86_64_delta_agc7648a_porting.h +++ b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/inc/x86_64_delta_agc7648a/x86_64_delta_agc7648a_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AGC7648A_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AGC7648A_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AGC7648A_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AGC7648A_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AGC7648A_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AGC7648A_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AGC7648A_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/src/ledi.c b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/src/ledi.c index d752236a..67766140 100644 --- a/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/src/ledi.c +++ b/packages/platforms/delta/x86-64/agc7648a/onlp/builds/x86_64_delta_agc7648a/module/src/ledi.c @@ -100,7 +100,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) VALIDATE(id); /* Set the onlp_oid_hdr_t and capabilities */ *info = linfo[ONLP_OID_ID_GET(id)]; - + mux_info_t mux_info; mux_info.bus = I2C_BUS_5; mux_info.addr = SWPLD; @@ -121,10 +121,10 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) { case LED_FRONT_FAN: if((r_data & 0x02) == 0x02) - info->mode = ONLP_LED_MODE_GREEN; - else if((r_data & 0x01) == 0x01) - info->mode = ONLP_LED_MODE_ORANGE; - else if((r_data & 0x01) == 0x03) + info->mode = ONLP_LED_MODE_GREEN; + else if((r_data & 0x01) == 0x01) + info->mode = ONLP_LED_MODE_ORANGE; + else if((r_data & 0x03) == 0x03) info->mode = ONLP_LED_MODE_ORANGE_BLINKING; else if((r_data & 0x01) == 0x00) info->mode = ONLP_LED_MODE_OFF; @@ -133,9 +133,9 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) break; case LED_FRONT_SYS: if((r_data & 0xF0) == 0x10) - info->mode = ONLP_LED_MODE_GREEN; + info->mode = ONLP_LED_MODE_GREEN; else if((r_data & 0xF0) == 0x20) - info->mode = ONLP_LED_MODE_ORANGE; + info->mode = ONLP_LED_MODE_ORANGE; else if((r_data & 0xF0) == 0xa0) info->mode = ONLP_LED_MODE_ORANGE_BLINKING; else if((r_data & 0xF0) == 0x90) @@ -221,7 +221,7 @@ onlp_ledi_info_get(onlp_oid_t id, onlp_led_info_t* info) else info->status = ONLP_LED_STATUS_FAILED; break; - + default: break; } @@ -250,7 +250,7 @@ int onlp_ledi_set(onlp_oid_t id, int on_or_off) { VALIDATE(id); - + if(on_or_off == 0) onlp_ledi_mode_set(id, ONLP_LED_MODE_OFF); else @@ -345,7 +345,7 @@ onlp_ledi_mode_set(onlp_oid_t id, onlp_led_mode_t mode) { dni_lock_cpld_write_attribute(SWPLD_PATH,LED_REG,front_panel_led_value); } - else + else return ONLP_STATUS_E_UNSUPPORTED; break; case LED_REAR_FAN_TRAY_1: @@ -421,6 +421,3 @@ onlp_ledi_ioctl(onlp_oid_t id, va_list vargs) { return ONLP_STATUS_E_UNSUPPORTED; } - - - diff --git a/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/auto/x86_64_delta_agc7648sv1.yml b/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/auto/x86_64_delta_agc7648sv1.yml index 99d94f52..5284f734 100755 --- a/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/auto/x86_64_delta_agc7648sv1.yml +++ b/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/auto/x86_64_delta_agc7648sv1.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/inc/x86_64_delta_agc7648sv1/x86_64_delta_agc7648sv1_porting.h b/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/inc/x86_64_delta_agc7648sv1/x86_64_delta_agc7648sv1_porting.h index a21610ef..23c659ab 100755 --- a/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/inc/x86_64_delta_agc7648sv1/x86_64_delta_agc7648sv1_porting.h +++ b/packages/platforms/delta/x86-64/agc7648sv1/onlp/builds/x86_64_delta_agc7648sv1/module/inc/x86_64_delta_agc7648sv1/x86_64_delta_agc7648sv1_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AGC7648SV1_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AGC7648SV1_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AGC7648SV1_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AGC7648SV1_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AGC7648SV1_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AGC7648SV1_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AGC7648SV1_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/auto/x86_64_delta_ak7448.yml b/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/auto/x86_64_delta_ak7448.yml index bd11539c..cc0b3910 100644 --- a/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/auto/x86_64_delta_ak7448.yml +++ b/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/auto/x86_64_delta_ak7448.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/inc/x86_64_delta_ak7448/x86_64_delta_ak7448_porting.h b/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/inc/x86_64_delta_ak7448/x86_64_delta_ak7448_porting.h index fef6b169..1682d9ac 100644 --- a/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/inc/x86_64_delta_ak7448/x86_64_delta_ak7448_porting.h +++ b/packages/platforms/delta/x86-64/ak7448/onlp/builds/x86_64_delta_ak7448/module/inc/x86_64_delta_ak7448/x86_64_delta_ak7448_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_AK7448_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_AK7448_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_AK7448_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_AK7448_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_AK7448_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_AK7448_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_AK7448_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/auto/x86_64_delta_wb2448.yml b/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/auto/x86_64_delta_wb2448.yml index 12c0e79e..bf4997e3 100755 --- a/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/auto/x86_64_delta_wb2448.yml +++ b/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/auto/x86_64_delta_wb2448.yml @@ -49,7 +49,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/inc/x86_64_delta_wb2448/x86_64_delta_wb2448_porting.h b/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/inc/x86_64_delta_wb2448/x86_64_delta_wb2448_porting.h index b03cc15c..acee9c89 100755 --- a/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/inc/x86_64_delta_wb2448/x86_64_delta_wb2448_porting.h +++ b/packages/platforms/delta/x86-64/wb2448/onlp/builds/x86_64_delta_wb2448/module/inc/x86_64_delta_wb2448/x86_64_delta_wb2448_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_DELTA_WB2448_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_DELTA_WB2448_STRNCPY GLOBAL_STRNCPY - #elif X86_64_DELTA_WB2448_CONFIG_PORTING_STDLIB == 1 - #define X86_64_DELTA_WB2448_STRNCPY strncpy - #else - #error The macro X86_64_DELTA_WB2448_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_DELTA_WB2448_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_DELTA_WB2448_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/auto/x86_64_ingrasys_s9100.yml b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/auto/x86_64_ingrasys_s9100.yml index 03724760..27be346b 100755 --- a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/auto/x86_64_ingrasys_s9100.yml +++ b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/auto/x86_64_ingrasys_s9100.yml @@ -4,7 +4,7 @@ # ############################################################################### -cdefs: &cdefs +cdefs: &cdefs - X86_64_INGRASYS_S9100_CONFIG_INCLUDE_LOGGING: doc: "Include or exclude logging." default: 1 @@ -41,7 +41,6 @@ definitions: - free - memset - memcpy - - strncpy - vsnprintf - snprintf - strlen diff --git a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/inc/x86_64_ingrasys_s9100/x86_64_ingrasys_s9100_porting.h b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/inc/x86_64_ingrasys_s9100/x86_64_ingrasys_s9100_porting.h index 7f956f35..5b16c5bc 100755 --- a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/inc/x86_64_ingrasys_s9100/x86_64_ingrasys_s9100_porting.h +++ b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/inc/x86_64_ingrasys_s9100/x86_64_ingrasys_s9100_porting.h @@ -59,16 +59,6 @@ #endif #endif -#ifndef X86_64_INGRASYS_S9100_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INGRASYS_S9100_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INGRASYS_S9100_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INGRASYS_S9100_STRNCPY strncpy - #else - #error The macro X86_64_INGRASYS_S9100_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INGRASYS_S9100_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INGRASYS_S9100_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/sfpi.c b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/sfpi.c index 7a17a533..eb2b6737 100755 --- a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/sfpi.c +++ b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/sfpi.c @@ -91,7 +91,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256]) char eeprom_path[512], eeprom_addr[32]; memset(eeprom_path, 0, sizeof(eeprom_path)); memset(eeprom_addr, 0, sizeof(eeprom_addr)); - strncpy(eeprom_addr, "0050", sizeof(eeprom_addr)); + aim_strlcpy(eeprom_addr, "0050", sizeof(eeprom_addr)); memset(data, 0, 256); diff --git a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/x86_64_ingrasys_s9100_ucli.c b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/x86_64_ingrasys_s9100_ucli.c index b359a04c..54d8b9a7 100755 --- a/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/x86_64_ingrasys_s9100_ucli.c +++ b/packages/platforms/ingrasys/x86-64/s9100/onlp/builds/x86_64_ingrasys_s9100/module/src/x86_64_ingrasys_s9100_ucli.c @@ -25,7 +25,7 @@ #include -#if ONLPSIM_CONFIG_INCLUDE_UCLI == 1 +#if X86_64_INGRASYS_9100_CONFIG_INCLUDE_UCLI == 1 #include #include diff --git a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/auto/x86_64_ingrasys_s9180_32x.yml b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/auto/x86_64_ingrasys_s9180_32x.yml index 1c6422b4..b0fa3bea 100755 --- a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/auto/x86_64_ingrasys_s9180_32x.yml +++ b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/auto/x86_64_ingrasys_s9180_32x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/inc/x86_64_ingrasys_s9180_32x/x86_64_ingrasys_s9180_32x_porting.h b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/inc/x86_64_ingrasys_s9180_32x/x86_64_ingrasys_s9180_32x_porting.h index 465813cd..40147474 100755 --- a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/inc/x86_64_ingrasys_s9180_32x/x86_64_ingrasys_s9180_32x_porting.h +++ b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/inc/x86_64_ingrasys_s9180_32x/x86_64_ingrasys_s9180_32x_porting.h @@ -59,16 +59,6 @@ #endif #endif -#ifndef X86_64_INGRASYS_S9180_32X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INGRASYS_S9180_32X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INGRASYS_S9180_32X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INGRASYS_S9180_32X_STRNCPY strncpy - #else - #error The macro X86_64_INGRASYS_S9180_32X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INGRASYS_S9180_32X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INGRASYS_S9180_32X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/src/sfpi.c b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/src/sfpi.c index 05228c8c..9f10b887 100755 --- a/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/src/sfpi.c +++ b/packages/platforms/ingrasys/x86-64/s9180-32x/onlp/builds/x86_64_ingrasys_s9180_32x/module/src/sfpi.c @@ -86,7 +86,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256]) char eeprom_path[512], eeprom_addr[32]; memset(eeprom_path, 0, sizeof(eeprom_path)); memset(eeprom_addr, 0, sizeof(eeprom_addr)); - strncpy(eeprom_addr, "0050", sizeof(eeprom_addr)); + aim_strlcpy(eeprom_addr, "0050", sizeof(eeprom_addr)); memset(data, 0, 256); diff --git a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/auto/x86_64_ingrasys_s9230_64x.yml b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/auto/x86_64_ingrasys_s9230_64x.yml index eca6af03..eeb909c6 100755 --- a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/auto/x86_64_ingrasys_s9230_64x.yml +++ b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/auto/x86_64_ingrasys_s9230_64x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/inc/x86_64_ingrasys_s9230_64x/x86_64_ingrasys_s9230_64x_porting.h b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/inc/x86_64_ingrasys_s9230_64x/x86_64_ingrasys_s9230_64x_porting.h index 52e8d530..240f63e3 100755 --- a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/inc/x86_64_ingrasys_s9230_64x/x86_64_ingrasys_s9230_64x_porting.h +++ b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/inc/x86_64_ingrasys_s9230_64x/x86_64_ingrasys_s9230_64x_porting.h @@ -59,16 +59,6 @@ #endif #endif -#ifndef X86_64_INGRASYS_S9230_64X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INGRASYS_S9230_64X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INGRASYS_S9230_64X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INGRASYS_S9230_64X_STRNCPY strncpy - #else - #error The macro X86_64_INGRASYS_S9230_64X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INGRASYS_S9230_64X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INGRASYS_S9230_64X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/src/sfpi.c b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/src/sfpi.c index 2b65896d..c8e08fa8 100755 --- a/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/src/sfpi.c +++ b/packages/platforms/ingrasys/x86-64/s9230-64x/onlp/builds/x86_64_ingrasys_s9230_64x/module/src/sfpi.c @@ -144,7 +144,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256]) char eeprom_path[512], eeprom_addr[32]; memset(eeprom_path, 0, sizeof(eeprom_path)); memset(eeprom_addr, 0, sizeof(eeprom_addr)); - strncpy(eeprom_addr, "0050", sizeof(eeprom_addr)); + aim_strlcpy(eeprom_addr, "0050", sizeof(eeprom_addr)); memset(data, 0, 256); diff --git a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/auto/x86_64_ingrasys_s9280_64x.yml b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/auto/x86_64_ingrasys_s9280_64x.yml index 2436efb8..d48ff257 100755 --- a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/auto/x86_64_ingrasys_s9280_64x.yml +++ b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/auto/x86_64_ingrasys_s9280_64x.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/inc/x86_64_ingrasys_s9280_64x/x86_64_ingrasys_s9280_64x_porting.h b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/inc/x86_64_ingrasys_s9280_64x/x86_64_ingrasys_s9280_64x_porting.h index e8061d2d..c33ef333 100755 --- a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/inc/x86_64_ingrasys_s9280_64x/x86_64_ingrasys_s9280_64x_porting.h +++ b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/inc/x86_64_ingrasys_s9280_64x/x86_64_ingrasys_s9280_64x_porting.h @@ -59,16 +59,6 @@ #endif #endif -#ifndef X86_64_INGRASYS_S9280_64X_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INGRASYS_S9280_64X_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INGRASYS_S9280_64X_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INGRASYS_S9280_64X_STRNCPY strncpy - #else - #error The macro X86_64_INGRASYS_S9280_64X_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INGRASYS_S9280_64X_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INGRASYS_S9280_64X_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/src/sfpi.c b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/src/sfpi.c index 59a42fa1..19cf396f 100755 --- a/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/src/sfpi.c +++ b/packages/platforms/ingrasys/x86-64/s9280-64x/onlp/builds/x86_64_ingrasys_s9280_64x/module/src/sfpi.c @@ -152,7 +152,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256]) char eeprom_path[512], eeprom_addr[32]; memset(eeprom_path, 0, sizeof(eeprom_path)); memset(eeprom_addr, 0, sizeof(eeprom_addr)); - strncpy(eeprom_addr, "0050", sizeof(eeprom_addr)); + aim_strlcpy(eeprom_addr, "0050", sizeof(eeprom_addr)); memset(data, 0, 256); diff --git a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/auto/x86_64_inventec_d10056.yml b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/auto/x86_64_inventec_d10056.yml index 137e3057..0df09f66 100644 --- a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/auto/x86_64_inventec_d10056.yml +++ b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/auto/x86_64_inventec_d10056.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/inc/x86_64_inventec_d10056/x86_64_inventec_d10056_porting.h b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/inc/x86_64_inventec_d10056/x86_64_inventec_d10056_porting.h index b690418b..6ba0b844 100644 --- a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/inc/x86_64_inventec_d10056/x86_64_inventec_d10056_porting.h +++ b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/inc/x86_64_inventec_d10056/x86_64_inventec_d10056_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D10056_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D10056_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D10056_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D10056_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D10056_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D10056_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D10056_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/make.mk b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/make.mk index 343b52dd..17331a8a 100644 --- a/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/make.mk +++ b/packages/platforms/inventec/x86-64/d10056/onlp/builds/x86_64_inventec_d10056/module/make.mk @@ -1,6 +1,6 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) @@ -8,3 +8,4 @@ x86_64_inventec_d10056_INCLUDES := -I $(THIS_DIR)inc x86_64_inventec_d10056_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_inventec_d10056_DEPENDMODULE_ENTRIES := init:x86_64_inventec_d10056 ucli:x86_64_inventec_d10056 +x86_64_inventec_d10056_CFLAGS := -Wno-restrict -Wno-format-truncation diff --git a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/auto/x86_64_inventec_d10064.yml b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/auto/x86_64_inventec_d10064.yml index 86fd7ab4..fee9c939 100644 --- a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/auto/x86_64_inventec_d10064.yml +++ b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/auto/x86_64_inventec_d10064.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h index 35745548..19fdb009 100644 --- a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h +++ b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/inc/x86_64_inventec_d10064/x86_64_inventec_d10064_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D10064_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D10064_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D10064_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D10064_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D10064_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D10064_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D10064_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/make.mk b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/make.mk index 3792147e..aab78afa 100644 --- a/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/make.mk +++ b/packages/platforms/inventec/x86-64/d10064/onlp/builds/x86_64_inventec_d10064/module/make.mk @@ -1,10 +1,10 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) x86_64_inventec_d10064_INCLUDES := -I $(THIS_DIR)inc x86_64_inventec_d10064_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_inventec_d10064_DEPENDMODULE_ENTRIES := init:x86_64_inventec_d10064 ucli:x86_64_inventec_d10064 - +x86_64_inventec_d10064_CFLAGS := -Wno-restrict -Wno-format-truncation diff --git a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/auto/x86_64_inventec_d5052.yml b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/auto/x86_64_inventec_d5052.yml index c92937cc..e553c712 100644 --- a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/auto/x86_64_inventec_d5052.yml +++ b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/auto/x86_64_inventec_d5052.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/inc/x86_64_inventec_d5052/x86_64_inventec_d5052_porting.h b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/inc/x86_64_inventec_d5052/x86_64_inventec_d5052_porting.h index b401f316..7468a10f 100644 --- a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/inc/x86_64_inventec_d5052/x86_64_inventec_d5052_porting.h +++ b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/inc/x86_64_inventec_d5052/x86_64_inventec_d5052_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D5052_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D5052_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D5052_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D5052_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D5052_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D5052_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D5052_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/platform_lib.c index ab7a4c8f..3cfb2359 100644 --- a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/platform_lib.c @@ -66,7 +66,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -85,7 +85,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -104,7 +104,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -127,7 +127,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "DPS-150AB-10", 12) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_12V_F2B; diff --git a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/psui.c b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/psui.c index e50c95f8..6294d86d 100644 --- a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -89,7 +89,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); @@ -102,7 +102,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } } diff --git a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/thermali.c b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/thermali.c index cc270d5d..0ff463ef 100644 --- a/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d5052/onlp/builds/x86_64_inventec_d5052/module/src/thermali.c @@ -122,7 +122,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/auto/x86_64_inventec_d5254.yml b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/auto/x86_64_inventec_d5254.yml index 0db0e723..2c59d399 100644 --- a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/auto/x86_64_inventec_d5254.yml +++ b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/auto/x86_64_inventec_d5254.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/inc/x86_64_inventec_d5254/x86_64_inventec_d5254_porting.h b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/inc/x86_64_inventec_d5254/x86_64_inventec_d5254_porting.h index d549880c..57e847a0 100644 --- a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/inc/x86_64_inventec_d5254/x86_64_inventec_d5254_porting.h +++ b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/inc/x86_64_inventec_d5254/x86_64_inventec_d5254_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D5254_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D5254_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D5254_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D5254_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D5254_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D5254_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D5254_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/make.mk b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/make.mk index dd211f97..dc6e8146 100644 --- a/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/make.mk +++ b/packages/platforms/inventec/x86-64/d5254/onlp/builds/x86_64_inventec_d5254/module/make.mk @@ -1,6 +1,6 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) @@ -8,3 +8,4 @@ x86_64_inventec_d5254_INCLUDES := -I $(THIS_DIR)inc x86_64_inventec_d5254_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_inventec_d5254_DEPENDMODULE_ENTRIES := init:x86_64_inventec_d5254 ucli:x86_64_inventec_d5254 +x86_64_inventec_d5254_CFLAGS := -Wno-restrict -Wno-format-truncation diff --git a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/auto/x86_64_inventec_d5264q28b.yml b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/auto/x86_64_inventec_d5264q28b.yml index 0178e586..44ce7a97 100644 --- a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/auto/x86_64_inventec_d5264q28b.yml +++ b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/auto/x86_64_inventec_d5264q28b.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/inc/x86_64_inventec_d5264q28b/x86_64_inventec_d5264q28b_porting.h b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/inc/x86_64_inventec_d5264q28b/x86_64_inventec_d5264q28b_porting.h index 1a9d34f3..3d250233 100644 --- a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/inc/x86_64_inventec_d5264q28b/x86_64_inventec_d5264q28b_porting.h +++ b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/inc/x86_64_inventec_d5264q28b/x86_64_inventec_d5264q28b_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D5264Q28B_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D5264Q28B_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D5264Q28B_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D5264Q28B_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D5264Q28B_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D5264Q28B_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D5264Q28B_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/make.mk b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/make.mk index c828753b..0e61aab4 100644 --- a/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/make.mk +++ b/packages/platforms/inventec/x86-64/d5264q28b/onlp/builds/x86_64_inventec_d5264q28b/module/make.mk @@ -1,10 +1,10 @@ ############################################################################### # -# +# # ############################################################################### THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) x86_64_inventec_d5264q28b_INCLUDES := -I $(THIS_DIR)inc x86_64_inventec_d5264q28b_INTERNAL_INCLUDES := -I $(THIS_DIR)src x86_64_inventec_d5264q28b_DEPENDMODULE_ENTRIES := init:x86_64_inventec_d5264q28b ucli:x86_64_inventec_d5264q28b - +x86_64_inventec_d5264q28b_CFLAGS := -Wno-restrict -Wno-format-truncation diff --git a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/auto/x86_64_inventec_d6254qs.yml b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/auto/x86_64_inventec_d6254qs.yml index aa2e3e09..130f4c8a 100644 --- a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/auto/x86_64_inventec_d6254qs.yml +++ b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/auto/x86_64_inventec_d6254qs.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/inc/x86_64_inventec_d6254qs/x86_64_inventec_d6254qs_porting.h b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/inc/x86_64_inventec_d6254qs/x86_64_inventec_d6254qs_porting.h index 8f4b9007..d86747b5 100644 --- a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/inc/x86_64_inventec_d6254qs/x86_64_inventec_d6254qs_porting.h +++ b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/inc/x86_64_inventec_d6254qs/x86_64_inventec_d6254qs_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D6254QS_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D6254QS_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D6254QS_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D6254QS_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D6254QS_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D6254QS_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D6254QS_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/platform_lib.c index ab185ab6..afaf1993 100644 --- a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/platform_lib.c @@ -67,7 +67,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -86,7 +86,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -105,7 +105,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -128,7 +128,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "DPS-150AB-10", 12) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_12V_F2B; diff --git a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/psui.c b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/psui.c index 1165cba3..a0008880 100644 --- a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -76,8 +76,8 @@ static void psu_module_name_get(int id, onlp_psu_info_t* info) { #if 1 - strncpy(info->model, "N/A", 3); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); #else char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; uint8_t temp[ONLP_CONFIG_INFO_STR_MAX] = {0}; @@ -93,7 +93,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); @@ -106,7 +106,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } #endif } diff --git a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/thermali.c b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/thermali.c index e0965175..64e4094c 100644 --- a/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d6254qs/onlp/builds/x86_64_inventec_d6254qs/module/src/thermali.c @@ -122,7 +122,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/auto/x86_64_inventec_d6556.yml b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/auto/x86_64_inventec_d6556.yml index 850847d9..6f5af33b 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/auto/x86_64_inventec_d6556.yml +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/auto/x86_64_inventec_d6556.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/inc/x86_64_inventec_d6556/x86_64_inventec_d6556_porting.h b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/inc/x86_64_inventec_d6556/x86_64_inventec_d6556_porting.h index 7cd9583e..152e598d 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/inc/x86_64_inventec_d6556/x86_64_inventec_d6556_porting.h +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/inc/x86_64_inventec_d6556/x86_64_inventec_d6556_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D6556_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D6556_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D6556_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D6556_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D6556_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D6556_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D6556_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/platform_lib.c index ab185ab6..afaf1993 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/platform_lib.c @@ -67,7 +67,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -86,7 +86,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -105,7 +105,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -128,7 +128,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "DPS-150AB-10", 12) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_12V_F2B; diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/psui.c b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/psui.c index 09ae28d1..cda53ce5 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -80,7 +80,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) int ret, len; #if 1 - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); #else memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); sprintf(node_path, module_devfiles__[id], "model"); @@ -92,7 +92,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } #endif @@ -106,7 +106,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } } diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/thermali.c b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/thermali.c index e5d573a2..178eb6a7 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/module/src/thermali.c @@ -137,7 +137,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/x86_64_inventec_d6556.mk b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/x86_64_inventec_d6556.mk index 03d43e8e..ccd38785 100644 --- a/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/x86_64_inventec_d6556.mk +++ b/packages/platforms/inventec/x86-64/d6556/onlp/builds/x86_64_inventec_d6556/x86_64_inventec_d6556.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_inventec_d6556 module. # -# Autogenerated 2019-07-13 17:22:08.280267 +# Autogenerated 2019-07-30 18:54:08.500975 # ############################################################################### x86_64_inventec_d6556_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/auto/x86_64_inventec_d7032q28b.yml b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/auto/x86_64_inventec_d7032q28b.yml index b624ecde..56752d70 100644 --- a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/auto/x86_64_inventec_d7032q28b.yml +++ b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/auto/x86_64_inventec_d7032q28b.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/inc/x86_64_inventec_d7032q28b/x86_64_inventec_d7032q28b_porting.h b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/inc/x86_64_inventec_d7032q28b/x86_64_inventec_d7032q28b_porting.h index 9e94ec3f..2b5825e7 100644 --- a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/inc/x86_64_inventec_d7032q28b/x86_64_inventec_d7032q28b_porting.h +++ b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/inc/x86_64_inventec_d7032q28b/x86_64_inventec_d7032q28b_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D7032Q28B_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D7032Q28B_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D7032Q28B_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D7032Q28B_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D7032Q28B_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D7032Q28B_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D7032Q28B_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/platform_lib.c index 43225d68..6f877dd5 100644 --- a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/platform_lib.c @@ -67,7 +67,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -86,7 +86,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -105,7 +105,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); diff --git a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/psui.c b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/psui.c index a9cb8714..4881c2a5 100644 --- a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -96,7 +96,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); @@ -109,7 +109,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } } diff --git a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/thermali.c b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/thermali.c index fb7e2d03..7d86d591 100644 --- a/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d7032q28b/onlp/builds/x86_64_inventec_d7032q28b/module/src/thermali.c @@ -122,7 +122,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/auto/x86_64_inventec_d7054q28b.yml b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/auto/x86_64_inventec_d7054q28b.yml index b01d4f81..f0cb1603 100644 --- a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/auto/x86_64_inventec_d7054q28b.yml +++ b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/auto/x86_64_inventec_d7054q28b.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/inc/x86_64_inventec_d7054q28b/x86_64_inventec_d7054q28b_porting.h b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/inc/x86_64_inventec_d7054q28b/x86_64_inventec_d7054q28b_porting.h index 5490203b..590ea21e 100644 --- a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/inc/x86_64_inventec_d7054q28b/x86_64_inventec_d7054q28b_porting.h +++ b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/inc/x86_64_inventec_d7054q28b/x86_64_inventec_d7054q28b_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D7054Q28B_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D7054Q28B_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D7054Q28B_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D7054Q28B_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D7054Q28B_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D7054Q28B_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D7054Q28B_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/platform_lib.c index ab185ab6..afaf1993 100644 --- a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/platform_lib.c @@ -67,7 +67,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -86,7 +86,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -105,7 +105,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -128,7 +128,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "DPS-150AB-10", 12) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_12V_F2B; diff --git a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/psui.c b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/psui.c index f076d4e7..7ebc335a 100644 --- a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -80,7 +80,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) int ret, len; #if 1 - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); #else memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); sprintf(node_path, module_devfiles__[id], "model"); @@ -92,7 +92,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } #endif @@ -106,7 +106,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } } diff --git a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/thermali.c b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/thermali.c index e5d573a2..178eb6a7 100644 --- a/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d7054q28b/onlp/builds/x86_64_inventec_d7054q28b/module/src/thermali.c @@ -137,7 +137,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/auto/x86_64_inventec_d7264q28b.yml b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/auto/x86_64_inventec_d7264q28b.yml index 4291fb80..1a872449 100644 --- a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/auto/x86_64_inventec_d7264q28b.yml +++ b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/auto/x86_64_inventec_d7264q28b.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/inc/x86_64_inventec_d7264q28b/x86_64_inventec_d7264q28b_porting.h b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/inc/x86_64_inventec_d7264q28b/x86_64_inventec_d7264q28b_porting.h index 0929c09f..19ad6091 100644 --- a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/inc/x86_64_inventec_d7264q28b/x86_64_inventec_d7264q28b_porting.h +++ b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/inc/x86_64_inventec_d7264q28b/x86_64_inventec_d7264q28b_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_INVENTEC_D7264Q28B_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_INVENTEC_D7264Q28B_STRNCPY GLOBAL_STRNCPY - #elif X86_64_INVENTEC_D7264Q28B_CONFIG_PORTING_STDLIB == 1 - #define X86_64_INVENTEC_D7264Q28B_STRNCPY strncpy - #else - #error The macro X86_64_INVENTEC_D7264Q28B_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_INVENTEC_D7264Q28B_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_INVENTEC_D7264Q28B_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/platform_lib.c b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/platform_lib.c index ab185ab6..afaf1993 100644 --- a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/platform_lib.c +++ b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/platform_lib.c @@ -67,7 +67,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -86,7 +86,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -105,7 +105,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); @@ -128,7 +128,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "DPS-150AB-10", 12) == 0) { if (modelname) { - strncpy(modelname, model_name, 12); + aim_strlcpy(modelname, model_name, 12); } return PSU_TYPE_DC_12V_F2B; diff --git a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/psui.c b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/psui.c index 3d354ef4..16a634b9 100644 --- a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/psui.c +++ b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/psui.c @@ -41,12 +41,12 @@ static char* module_devfiles__[PSU_MAX] = /* must map with onlp_psu_id */ INV_PSOC_PREFIX"/psoc_psu2_%s", }; -static int +static int psu_status_info_get(int id, char *node, int *value) { int ret = 0; char node_path[ONLP_NODE_MAX_PATH_LEN] = {0}; - + *value = 0; if (PSU1_ID == id) { sprintf(node_path, status_devfiles__[id]); @@ -54,7 +54,7 @@ psu_status_info_get(int id, char *node, int *value) else if (PSU2_ID == id) { sprintf(node_path, status_devfiles__[id]); } - + ret = onlp_file_read_int(value, node_path); if (ret < 0) { @@ -80,7 +80,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) int ret, len; #if 1 - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); #else memset(node_path, 0, ONLP_NODE_MAX_PATH_LEN); sprintf(node_path, module_devfiles__[id], "model"); @@ -92,7 +92,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->model, "N/A", 3); + aim_strlcpy(info->model, "N/A", 3); } #endif @@ -106,7 +106,7 @@ psu_module_name_get(int id, onlp_psu_info_t* info) } else { AIM_LOG_ERROR("Unable to read model name from file(%s)\r\n", node_path); - strncpy(info->serial, "N/A", 3); + aim_strlcpy(info->serial, "N/A", 3); } } diff --git a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/thermali.c b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/thermali.c index e5d573a2..178eb6a7 100644 --- a/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/thermali.c +++ b/packages/platforms/inventec/x86-64/d7264q28b/onlp/builds/x86_64_inventec_d7264q28b/module/src/thermali.c @@ -137,7 +137,7 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info) int rv = onlp_file_read_str(&dp, devfiles__[local_id], "label"); if (rv > 0) { memset (info->hdr.description, 0, ONLP_OID_DESC_SIZE); - strncpy(info->hdr.description, dp, rv); + aim_strlcpy(info->hdr.description, dp, rv); } /* Set the onlp_oid_hdr_t and capabilities */ diff --git a/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/auto/x86_64_kvm_x86_64.yml b/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/auto/x86_64_kvm_x86_64.yml index 9980e702..1b13c31e 100644 --- a/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/auto/x86_64_kvm_x86_64.yml +++ b/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/auto/x86_64_kvm_x86_64.yml @@ -62,7 +62,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/inc/x86_64_kvm_x86_64/x86_64_kvm_x86_64_porting.h b/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/inc/x86_64_kvm_x86_64/x86_64_kvm_x86_64_porting.h index 4d759b9f..7354e258 100644 --- a/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/inc/x86_64_kvm_x86_64/x86_64_kvm_x86_64_porting.h +++ b/packages/platforms/kvm/x86-64/x86-64-kvm-x86-64/onlp/builds/x86_64_kvm_x86_64/module/inc/x86_64_kvm_x86_64/x86_64_kvm_x86_64_porting.h @@ -85,16 +85,6 @@ #endif #endif -#ifndef ONLPSIM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define ONLPSIM_STRNCPY GLOBAL_STRNCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRNCPY strncpy - #else - #error The macro ONLPSIM_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef ONLPSIM_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define ONLPSIM_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/auto/x86_64_lenovo_ne10032.yml b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/auto/x86_64_lenovo_ne10032.yml index 996dbc9f..f7bf5b03 100644 --- a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/auto/x86_64_lenovo_ne10032.yml +++ b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/auto/x86_64_lenovo_ne10032.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/inc/x86_64_lenovo_ne10032/x86_64_lenovo_ne10032_porting.h b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/inc/x86_64_lenovo_ne10032/x86_64_lenovo_ne10032_porting.h index 5f1abbdb..e48d1db5 100644 --- a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/inc/x86_64_lenovo_ne10032/x86_64_lenovo_ne10032_porting.h +++ b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/inc/x86_64_lenovo_ne10032/x86_64_lenovo_ne10032_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_LENOVO_NE10032_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_LENOVO_NE10032_STRNCPY GLOBAL_STRNCPY - #elif X86_64_LENOVO_NE10032_CONFIG_PORTING_STDLIB == 1 - #define X86_64_LENOVO_NE10032_STRNCPY strncpy - #else - #error The macro X86_64_LENOVO_NE10032_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_LENOVO_NE10032_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_LENOVO_NE10032_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/src/platform_lib.c b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/src/platform_lib.c index 2383fd47..5ba45f0b 100644 --- a/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/src/platform_lib.c +++ b/packages/platforms/lenovo/x86-64/ne10032/onlp/builds/x86_64_lenovo_ne10032/module/src/platform_lib.c @@ -24,12 +24,14 @@ * ***********************************************************/ #include +#include #include #include #include #include #include #include +#include #include #include "platform_lib.h" @@ -42,20 +44,20 @@ int deviceNodeWrite(char *filename, char *buffer, int buf_size, int data_len) if ((buffer == NULL) || (buf_size < 0)) { return -1; - } - - if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { - return -1; } - if ((len = write(fd, buffer, buf_size)) < 0) { - close(fd); + if ((fd = open(filename, O_WRONLY, S_IWUSR)) == -1) { + return -1; + } + + if ((len = write(fd, buffer, buf_size)) < 0) { + close(fd); return -1; } if ((close(fd) == -1)) { return -1; - } + } if ((len > buf_size) || (data_len != 0 && len != data_len)) { return -1; @@ -73,25 +75,25 @@ int deviceNodeWriteInt(char *filename, int value, int data_len) } int deviceNodeReadBinary(char *filename, char *buffer, int buf_size, int data_len) - { + { int fd; int len; if ((buffer == NULL) || (buf_size < 0)) { return -1; - } + } if ((fd = open(filename, O_RDONLY)) == -1) { - return -1; + return -1; } if ((len = read(fd, buffer, buf_size)) < 0) { - close(fd); + close(fd); + return -1; + } + + if ((close(fd) == -1)) { return -1; - } - - if ((close(fd) == -1)) { - return -1; } if ((len > buf_size) || (data_len != 0 && len != data_len)) { @@ -108,7 +110,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le if (data_len >= buf_size || data_len < 0) { return -1; } - + ret = deviceNodeReadBinary(filename, buffer, buf_size-1, data_len); if (ret == 0) { @@ -119,7 +121,7 @@ int deviceNodeReadString(char *filename, char *buffer, int buf_size, int data_le buffer[buf_size-1] = '\0'; } } - + return ret; } @@ -134,12 +136,12 @@ int psu_two_complement_to_int(uint16_t data, uint8_t valid_bit, int mask) /* -i2c APIs: access i2c device by ioctl -static int i2c_read(int i2cbus, int addr, int offset, int length, char* data) -static int i2c_read_byte(int i2cbus, int addr, int offset, char* data) +i2c APIs: access i2c device by ioctl +static int i2c_read(int i2cbus, int addr, int offset, int length, char* data) +static int i2c_read_byte(int i2cbus, int addr, int offset, char* data) static int i2c_read_word(int i2cbus, int addr, int command) -static int i2c_write_byte(int i2cbus, int addr, int offset, char val) -static int i2c_write_bit(int i2cbus, int addr, int offset, int bit, char val) +static int i2c_write_byte(int i2cbus, int addr, int offset, char val) +static int i2c_write_bit(int i2cbus, int addr, int offset, int bit, char val) */ int i2c_read(int i2cbus, int addr, int offset, int length, char* data) { @@ -172,9 +174,9 @@ int i2c_read(int i2cbus, int addr, int offset, int length, char* data) #endif /*set slave address set_slave_addr(file, address, force))*/ - + if (ioctl(file, I2C_SLAVE_FORCE, addr) < 0) - //if (ioctl(file, I2C_SLAVE, addr) < 0) + //if (ioctl(file, I2C_SLAVE, addr) < 0) { AIM_LOG_INFO("Error: Could not set address to 0x%02x, %s \r\n", addr, strerror(errno)); close(file); @@ -247,14 +249,14 @@ int i2c_sequential_read(int i2cbus, int addr, int offset, int length, char* data } /*set slave address set_slave_addr(file, address, force))*/ - + if (ioctl(file, I2C_SLAVE_FORCE, addr) < 0) { AIM_LOG_INFO("Error: Could not set address to 0x%02x, %s \r\n", addr, strerror(errno)); close(file); return -errno; } - /* + /* Sequential Read for at24c128 use i2c_smbus_write_byte_data to write 24c128 address counter(two 8-bit data word addresses) 24c128: @@ -266,8 +268,8 @@ int i2c_sequential_read(int i2cbus, int addr, int offset, int length, char* data +----------------------------------------------------+ | S | Device | Wr | A | Command | A | Data | A |... | | Address | | | | | | | - +----------------------------------------------------+ - + +----------------------------------------------------+ + */ res = i2c_smbus_write_byte_data(file, (uint8_t)offset>>8,(uint8_t)offset); @@ -279,7 +281,7 @@ int i2c_sequential_read(int i2cbus, int addr, int offset, int length, char* data for (i = 0; i +#include #include #include #include @@ -32,6 +33,7 @@ #include #include #include "platform_lib.h" +#include #define DEBUG_FLAG 0 @@ -148,12 +150,12 @@ int psu_two_complement_to_int(uint16_t data, uint8_t valid_bit, int mask) /* -i2c APIs: access i2c device by ioctl -static int i2c_read(int i2cbus, int addr, int offset, int length, char* data) -static int i2c_read_byte(int i2cbus, int addr, int offset, char* data) +i2c APIs: access i2c device by ioctl +static int i2c_read(int i2cbus, int addr, int offset, int length, char* data) +static int i2c_read_byte(int i2cbus, int addr, int offset, char* data) static int i2c_read_word(int i2cbus, int addr, int command) -static int i2c_write_byte(int i2cbus, int addr, int offset, char val) -static int i2c_write_bit(int i2cbus, int addr, int offset, int bit, char val) +static int i2c_write_byte(int i2cbus, int addr, int offset, char val) +static int i2c_write_bit(int i2cbus, int addr, int offset, int bit, char val) */ int i2c_read(int i2cbus, int addr, int offset, int length, char *data) { @@ -271,7 +273,7 @@ int i2c_sequential_read(int i2cbus, int addr, int offset, int length, char *data close(file); return -errno; } - /* + /* Sequential Read for at24c128 use i2c_smbus_write_byte_data to write 24c128 address counter(two 8-bit data word addresses) 24c128: @@ -283,8 +285,8 @@ int i2c_sequential_read(int i2cbus, int addr, int offset, int length, char *data +----------------------------------------------------+ | S | Device | Wr | A | Command | A | Data | A |... | | Address | | | | | | | - +----------------------------------------------------+ - + +----------------------------------------------------+ + */ res = i2c_smbus_write_byte_data(file, (uint8_t)offset >> 8, (uint8_t)offset); @@ -826,7 +828,7 @@ char diag_debug_pause_platform_manage_check(void) fclose(file); return (flag == '1') ? 1 : 0; -} +} #define ONIE_EEPROM_HEADER_LENGTH 11 int eeprom_tlv_read(uint8_t *rdata, char type, char *data) @@ -855,4 +857,3 @@ int eeprom_tlv_read(uint8_t *rdata, char type, char *data) } return 0; } - \ No newline at end of file diff --git a/packages/platforms/lenovo/x86-64/ne2572/onlp/builds/x86_64_lenovo_ne2572/module/src/sfpi.c b/packages/platforms/lenovo/x86-64/ne2572/onlp/builds/x86_64_lenovo_ne2572/module/src/sfpi.c index 341775a1..d53090cd 100644 --- a/packages/platforms/lenovo/x86-64/ne2572/onlp/builds/x86_64_lenovo_ne2572/module/src/sfpi.c +++ b/packages/platforms/lenovo/x86-64/ne2572/onlp/builds/x86_64_lenovo_ne2572/module/src/sfpi.c @@ -361,25 +361,25 @@ onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value) return ret; } -/* +/* Reset and LP mode can control by CPLD so the setting will be keep in CPLD. For other options, control is get/set to QSFP28. Control options set to QSFP28 will be lost when the QSFP28 is removed. - Upper layer software system should keep the configuration and set it again when detect a new sfp module insert. + Upper layer software system should keep the configuration and set it again when detect a new sfp module insert. [QSFP] function R/W CPLD EEPROM ------------------------------------ --- ------------- ----------------- ONLP_SFP_CONTROL_RESET W 0x7 - ONLP_SFP_CONTROL_RESET_STATE R/W 0x7 + ONLP_SFP_CONTROL_RESET_STATE R/W 0x7 ONLP_SFP_CONTROL_RX_LOS R none byte 4 ONLP_SFP_CONTROL_TX_FAULT R none byte 3 ONLP_SFP_CONTROL_TX_DISABLE R/W none byte 86 ONLP_SFP_CONTROL_TX_DISABLE_CHANNEL R/W none byte 86 - ONLP_SFP_CONTROL_LP_MODE R/W 0x9 + ONLP_SFP_CONTROL_LP_MODE R/W 0x9 ONLP_SFP_CONTROL_POWER_OVERRIDE R/W none byte 93 [SFP] - function R/W CPLD - ------------------------------------ --- --------------- + function R/W CPLD + ------------------------------------ --- --------------- ONLP_SFP_CONTROL_RESET Not Support(There is no RESET pin in SFP module) ONLP_SFP_CONTROL_RESET_STATE Not Support(There is no RESET pin in SFP module) ONLP_SFP_CONTROL_RX_LOS R 0x13/0x14/0x15 @@ -465,7 +465,7 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) } else { - optval &= !(1 << port_bit); + optval &= ~(1 << port_bit); } rv = onlp_i2c_writeb(cpld_bus, addr, offset, optval, ONLP_I2C_F_FORCE); if (rv < 0) @@ -511,9 +511,9 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) } else { - optval &= !(1 << port_bit); + optval &= ~(1 << port_bit); } - + rv = onlp_i2c_writeb(cpld_bus, addr, offset, optval, ONLP_I2C_F_FORCE); if (rv < 0) { @@ -537,7 +537,7 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) } else { - optval &= !(0x0f); + optval &= ~(0x0f); } rv = onlp_i2c_writeb(bus, addr, offset, optval, ONLP_I2C_F_FORCE); if (rv < 0) @@ -581,7 +581,7 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) } else { - optval &= !(0x01); + optval &= ~(0x01); } rv = onlp_i2c_writeb(bus, addr, offset, optval, ONLP_I2C_F_FORCE); if (rv < 0) @@ -600,7 +600,7 @@ onlp_sfpi_control_set(int port, onlp_sfp_control_t control, int value) } else { - optval &= !(1 << port_bit); + optval &= ~(1 << port_bit); } rv = onlp_i2c_writeb(cpld_bus, addr, offset, optval, ONLP_I2C_F_FORCE); if (rv < 0) @@ -824,4 +824,3 @@ onlp_sfpi_denit(void) DIAG_PRINT("%s", __FUNCTION__); return ONLP_STATUS_OK; } - diff --git a/packages/platforms/mellanox/any/src/mlnx_common/mlnx_common.mk b/packages/platforms/mellanox/any/src/mlnx_common/mlnx_common.mk index 03a7d48c..07b2019e 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/mlnx_common.mk +++ b/packages/platforms/mellanox/any/src/mlnx_common/mlnx_common.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the mlnx_common module. # -# Autogenerated 2019-07-11 19:31:23.901745 +# Autogenerated 2019-07-30 18:47:59.273428 # ############################################################################### mlnx_common_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/auto/mlnx_common.yml b/packages/platforms/mellanox/any/src/mlnx_common/module/auto/mlnx_common.yml index d79c0cb7..7ab2ae41 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/auto/mlnx_common.yml +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/auto/mlnx_common.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/inc/mlnx_common/mlnx_common_porting.h b/packages/platforms/mellanox/any/src/mlnx_common/module/inc/mlnx_common/mlnx_common_porting.h index 7ee1207a..b0e8f46d 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/inc/mlnx_common/mlnx_common_porting.h +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/inc/mlnx_common/mlnx_common_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef MLNX_COMMON_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define MLNX_COMMON_STRNCPY GLOBAL_STRNCPY - #elif MLNX_COMMON_CONFIG_PORTING_STDLIB == 1 - #define MLNX_COMMON_STRNCPY strncpy - #else - #error The macro MLNX_COMMON_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef MLNX_COMMON_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define MLNX_COMMON_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/make.mk b/packages/platforms/mellanox/any/src/mlnx_common/module/make.mk index c6e5d32e..4ecac1ac 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/make.mk +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/make.mk @@ -7,3 +7,10 @@ THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) mlnx_common_INCLUDES := -I $(THIS_DIR)inc mlnx_common_INTERNAL_INCLUDES := -I $(THIS_DIR)src mlnx_common_DEPENDMODULE_ENTRIES := init:mlnx_common ucli:mlnx_common + +# +# This is a real bug: +# +# mlnx_common_fani.c:310:61: error: division 'sizeof (int *) / sizeof (int)' does not compute the number of array elements [-Werror=sizeof-pointer-div] +# +mlnx_common_CFLAGS := -Wno-sizeof-pointer-div diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_fani.c b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_fani.c index 463d1771..4f82698d 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_fani.c +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_fani.c @@ -91,11 +91,11 @@ _onlp_fani_read_fan_eeprom(int local_id, onlp_fan_info_t* info) /* Reading serial number */ offset = data[block1_start] * multiplier + serial_offset; - strncpy(info->serial, (char *)&data[offset], serial_len); + aim_strlcpy(info->serial, (char *)&data[offset], serial_len); /* Reading part number */ offset += serial_len; - strncpy(info->model, (char *)&data[offset], part_len); + aim_strlcpy(info->model, (char *)&data[offset], part_len); /* Reading fan direction */ if (data[block2_start + 1] != block2_type) { @@ -127,7 +127,7 @@ _onlp_fani_info_get_fan(int local_id, onlp_fan_info_t* info) const char fan_model[]=FAN_MODEL; mlnx_platform_info_t* mlnx_platform_info = get_platform_info(); if(mlnx_platform_info->fan_type == FAN_TYPE_NO_EEPROM) - strncpy(info->model, fan_model, sizeof(info->model)); + aim_strlcpy(info->model, fan_model, sizeof(info->model)); if(!mlnx_platform_info->fan_fixed) { /* not fixed FAN's can have more than 1 FAN per FRU. diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_psui.c b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_psui.c index cf352a25..ae07732c 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_psui.c +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_psui.c @@ -102,7 +102,7 @@ _psu_info_get_type1(onlp_psu_info_t* info) int index = ONLP_OID_ID_GET(info->hdr.id); const char psu_model[]=PSU_MODEL; - strncpy(info->model, psu_model, sizeof(info->model)); + aim_strlcpy(info->model, psu_model, sizeof(info->model)); /* Set capability */ info->caps = ONLP_PSU_CAPS_AC; diff --git a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_utils.c b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_utils.c index 6a45a7a6..4d64b6f0 100644 --- a/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_utils.c +++ b/packages/platforms/mellanox/any/src/mlnx_common/module/src/mlnx_common_utils.c @@ -67,17 +67,17 @@ psu_read_eeprom(int psu_index, onlp_psu_info_t* psu_info, onlp_fan_info_t* fan_i /* Serial number */ index += strlen(sanity_check); if (psu_info) { - strncpy(psu_info->serial, &data[index], sizeof(psu_info->serial)); + aim_strlcpy(psu_info->serial, &data[index], sizeof(psu_info->serial)); } else if (fan_info) { - strncpy(fan_info->serial, &data[index], sizeof(fan_info->serial)); + aim_strlcpy(fan_info->serial, &data[index], sizeof(fan_info->serial)); } /* Part number */ index += serial_len; if (psu_info) { - strncpy(psu_info->model, &data[index], sizeof(psu_info->model)); + aim_strlcpy(psu_info->model, &data[index], sizeof(psu_info->model)); } else if (fan_info) { - strncpy(fan_info->model, &data[index], sizeof(fan_info->model)); + aim_strlcpy(fan_info->model, &data[index], sizeof(fan_info->model)); } return ONLP_STATUS_OK; diff --git a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/auto/x86_64_mlnx_mqm8700.yml b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/auto/x86_64_mlnx_mqm8700.yml index c0bf4ddd..422ec758 100644 --- a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/auto/x86_64_mlnx_mqm8700.yml +++ b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/auto/x86_64_mlnx_mqm8700.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/inc/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700_porting.h b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/inc/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700_porting.h index d7e87576..2ccb4a75 100644 --- a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/inc/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700_porting.h +++ b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/inc/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MQM8700_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MQM8700_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MQM8700_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MQM8700_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MQM8700_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MQM8700_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MQM8700_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/src/sysi.c b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/src/sysi.c index 677f64b0..7a667612 100644 --- a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/module/src/sysi.c @@ -41,7 +41,7 @@ int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { - strncpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; mlnx_platform->psu_num = CHASSIS_PSU_COUNT; diff --git a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700.mk b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700.mk index 7f117282..19016198 100644 --- a/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700.mk +++ b/packages/platforms/mellanox/x86-64/mqm8700/onlp/builds/x86_64_mlnx_mqm8700/x86_64_mlnx_mqm8700.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_mlnx_mqm8700 module. # -# Autogenerated 2019-07-13 17:21:16.759666 +# Autogenerated 2019-07-30 18:51:58.984764 # ############################################################################### x86_64_mlnx_mqm8700_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/auto/x86_64_mlnx_msn2010.yml b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/auto/x86_64_mlnx_msn2010.yml index f3a99008..187c9dac 100644 --- a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/auto/x86_64_mlnx_msn2010.yml +++ b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/auto/x86_64_mlnx_msn2010.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/inc/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_porting.h b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/inc/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_porting.h index 54d120e7..809ce405 100644 --- a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/inc/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_porting.h +++ b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/inc/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN2010_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN2010_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN2010_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN2010_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN2010_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN2010_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN2010_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/src/sysi.c index 006f1d46..453cb3b2 100644 --- a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/module/src/sysi.c @@ -43,7 +43,7 @@ int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { - strncpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; mlnx_platform->psu_num = CHASSIS_PSU_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010.mk b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010.mk index c221d565..4b9983a5 100644 --- a/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010.mk +++ b/packages/platforms/mellanox/x86-64/msn2010/onlp/builds/x86_64_mlnx_msn2010/x86_64_mlnx_msn2010.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_mlnx_msn2010 module. # -# Autogenerated 2019-07-13 17:21:14.110508 +# Autogenerated 2019-07-30 18:51:55.742142 # ############################################################################### x86_64_mlnx_msn2010_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/auto/x86_64_mlnx_msn2100.yml b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/auto/x86_64_mlnx_msn2100.yml index 2f25156f..4bee6422 100644 --- a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/auto/x86_64_mlnx_msn2100.yml +++ b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/auto/x86_64_mlnx_msn2100.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/inc/x86_64_mlnx_msn2100/x86_64_mlnx_msn2100_porting.h b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/inc/x86_64_mlnx_msn2100/x86_64_mlnx_msn2100_porting.h index 5e705ce6..2811d478 100644 --- a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/inc/x86_64_mlnx_msn2100/x86_64_mlnx_msn2100_porting.h +++ b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/inc/x86_64_mlnx_msn2100/x86_64_mlnx_msn2100_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN2100_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN2100_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN2100_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN2100_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN2100_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN2100_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN2100_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/src/sysi.c index 20703dd9..52e0b0b3 100644 --- a/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn2100/onlp/builds/x86_64_mlnx_msn2100/module/src/sysi.c @@ -46,10 +46,10 @@ static const char* __ONL_PLATFORM_NAME = NULL; int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { if (!__ONL_PLATFORM_NAME) { - strncpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2100-all", PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2100-all", PLATFORM_NAME_MAX_LEN); } else { - strncpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); } mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/auto/x86_64_mlnx_msn2410.yml b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/auto/x86_64_mlnx_msn2410.yml index a897908e..3041527f 100644 --- a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/auto/x86_64_mlnx_msn2410.yml +++ b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/auto/x86_64_mlnx_msn2410.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/inc/x86_64_mlnx_msn2410/x86_64_mlnx_msn2410_porting.h b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/inc/x86_64_mlnx_msn2410/x86_64_mlnx_msn2410_porting.h index ac4414ad..417ee06b 100644 --- a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/inc/x86_64_mlnx_msn2410/x86_64_mlnx_msn2410_porting.h +++ b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/inc/x86_64_mlnx_msn2410/x86_64_mlnx_msn2410_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN2410_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN2410_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN2410_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN2410_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN2410_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN2410_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN2410_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/src/sysi.c index 31262f17..2e0a5db0 100644 --- a/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn2410/onlp/builds/x86_64_mlnx_msn2410/module/src/sysi.c @@ -44,10 +44,10 @@ static const char* __ONL_PLATFORM_NAME = NULL; int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { if (!__ONL_PLATFORM_NAME) { - strncpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2410-all", PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2410-all", PLATFORM_NAME_MAX_LEN); } else { - strncpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); } mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/auto/x86_64_mlnx_msn2700.yml b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/auto/x86_64_mlnx_msn2700.yml index 6c492053..899af0f4 100644 --- a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/auto/x86_64_mlnx_msn2700.yml +++ b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/auto/x86_64_mlnx_msn2700.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/inc/x86_64_mlnx_msn2700/x86_64_mlnx_msn2700_porting.h b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/inc/x86_64_mlnx_msn2700/x86_64_mlnx_msn2700_porting.h index a1235146..b833bc51 100644 --- a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/inc/x86_64_mlnx_msn2700/x86_64_mlnx_msn2700_porting.h +++ b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/inc/x86_64_mlnx_msn2700/x86_64_mlnx_msn2700_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN2700_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN2700_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN2700_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN2700_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN2700_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN2700_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN2700_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/src/sysi.c index a88312c0..8878dc7b 100644 --- a/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn2700/onlp/builds/x86_64_mlnx_msn2700/module/src/sysi.c @@ -44,10 +44,10 @@ static const char* __ONL_PLATFORM_NAME = NULL; int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { if (!__ONL_PLATFORM_NAME) { - strncpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2700-all", PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2700-all", PLATFORM_NAME_MAX_LEN); } else { - strncpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); } mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/auto/x86_64_mlnx_msn2740.yml b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/auto/x86_64_mlnx_msn2740.yml index 351b604f..6c26de79 100644 --- a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/auto/x86_64_mlnx_msn2740.yml +++ b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/auto/x86_64_mlnx_msn2740.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/inc/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740_porting.h b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/inc/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740_porting.h index 877af460..56509563 100644 --- a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/inc/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740_porting.h +++ b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/inc/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN2740_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN2740_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN2740_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN2740_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN2740_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN2740_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN2740_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/src/sysi.c index 3cc0106e..cc95933b 100755 --- a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/module/src/sysi.c @@ -44,10 +44,10 @@ static const char* __ONL_PLATFORM_NAME = NULL; int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { if (!__ONL_PLATFORM_NAME) { - strncpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2740-all", PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn2740-all", PLATFORM_NAME_MAX_LEN); } else { - strncpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); } mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740.mk b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740.mk index 816eb4e9..b2a15e07 100644 --- a/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740.mk +++ b/packages/platforms/mellanox/x86-64/msn2740/onlp/builds/x86_64_mlnx_msn2740/x86_64_mlnx_msn2740.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_mlnx_msn2740 module. # -# Autogenerated 2019-07-13 17:21:06.142770 +# Autogenerated 2019-07-30 18:51:46.162583 # ############################################################################### x86_64_mlnx_msn2740_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/auto/x86_64_mlnx_msn3700.yml b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/auto/x86_64_mlnx_msn3700.yml index d5495a63..acacf76a 100644 --- a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/auto/x86_64_mlnx_msn3700.yml +++ b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/auto/x86_64_mlnx_msn3700.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/inc/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700_porting.h b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/inc/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700_porting.h index 08da0521..4fd78072 100644 --- a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/inc/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700_porting.h +++ b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/inc/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN3700_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN3700_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN3700_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN3700_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN3700_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN3700_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN3700_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/src/sysi.c index 7b069527..761a433d 100644 --- a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/module/src/sysi.c @@ -42,10 +42,10 @@ static const char* __ONL_PLATFORM_NAME = NULL; int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { if (!__ONL_PLATFORM_NAME) { - strncpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn3700-all", PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, "x86-64-mlnx-msn3700-all", PLATFORM_NAME_MAX_LEN); } else { - strncpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, __ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); } if (!strcmp(mlnx_platform->onl_platform_name, "x86-64-mlnx_msn3700c-r0")) { diff --git a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700.mk b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700.mk index 9e6e2978..8d4934c0 100644 --- a/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700.mk +++ b/packages/platforms/mellanox/x86-64/msn3700/onlp/builds/x86_64_mlnx_msn3700/x86_64_mlnx_msn3700.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_mlnx_msn3700 module. # -# Autogenerated 2019-07-13 17:20:55.933813 +# Autogenerated 2019-07-30 18:51:23.685946 # ############################################################################### x86_64_mlnx_msn3700_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/auto/x86_64_mlnx_msn3800.yml b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/auto/x86_64_mlnx_msn3800.yml index 7635801b..5c1635d0 100644 --- a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/auto/x86_64_mlnx_msn3800.yml +++ b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/auto/x86_64_mlnx_msn3800.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/inc/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800_porting.h b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/inc/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800_porting.h index 9a34dafd..dcd1757a 100644 --- a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/inc/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800_porting.h +++ b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/inc/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MLNX_MSN3800_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MLNX_MSN3800_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MLNX_MSN3800_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MLNX_MSN3800_STRNCPY strncpy - #else - #error The macro X86_64_MLNX_MSN3800_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MLNX_MSN3800_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MLNX_MSN3800_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/src/sysi.c b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/src/sysi.c index 3a62cc65..ac060af3 100644 --- a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/src/sysi.c +++ b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/module/src/sysi.c @@ -41,7 +41,7 @@ int mc_get_platform_info(mlnx_platform_info_t* mlnx_platform) { - strncpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); + aim_strlcpy(mlnx_platform->onl_platform_name, ONL_PLATFORM_NAME, PLATFORM_NAME_MAX_LEN); mlnx_platform->sfp_num = SFP_PORT_COUNT; mlnx_platform->led_num = CHASSIS_LED_COUNT; mlnx_platform->psu_num = CHASSIS_PSU_COUNT; diff --git a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800.mk b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800.mk index 73d26d27..48415b74 100644 --- a/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800.mk +++ b/packages/platforms/mellanox/x86-64/msn3800/onlp/builds/x86_64_mlnx_msn3800/x86_64_mlnx_msn3800.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the x86_64_mlnx_msn3800 module. # -# Autogenerated 2019-07-13 17:21:03.521391 +# Autogenerated 2019-07-30 18:51:42.310000 # ############################################################################### x86_64_mlnx_msn3800_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/auto/x86_64_mitac_ly1200_b32h0_c3.yml b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/auto/x86_64_mitac_ly1200_b32h0_c3.yml index bbf8f10d..01a4231f 100644 --- a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/auto/x86_64_mitac_ly1200_b32h0_c3.yml +++ b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/auto/x86_64_mitac_ly1200_b32h0_c3.yml @@ -44,7 +44,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/inc/x86_64_mitac_ly1200_b32h0_c3/x86_64_mitac_ly1200_b32h0_c3_porting.h b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/inc/x86_64_mitac_ly1200_b32h0_c3/x86_64_mitac_ly1200_b32h0_c3_porting.h index 5591c58b..5d92a2df 100644 --- a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/inc/x86_64_mitac_ly1200_b32h0_c3/x86_64_mitac_ly1200_b32h0_c3_porting.h +++ b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/inc/x86_64_mitac_ly1200_b32h0_c3/x86_64_mitac_ly1200_b32h0_c3_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef X86_64_MITAC_LY1200_B32H0_C3_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_MITAC_LY1200_B32H0_C3_STRNCPY GLOBAL_STRNCPY - #elif X86_64_MITAC_LY1200_B32H0_C3_CONFIG_PORTING_STDLIB == 1 - #define X86_64_MITAC_LY1200_B32H0_C3_STRNCPY strncpy - #else - #error The macro X86_64_MITAC_LY1200_B32H0_C3_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_MITAC_LY1200_B32H0_C3_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_MITAC_LY1200_B32H0_C3_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/platform_lib.c b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/platform_lib.c index cb61ec08..e1ace5dd 100644 --- a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/platform_lib.c +++ b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/platform_lib.c @@ -137,7 +137,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651Y", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -156,7 +156,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "YM-2651V", 8) == 0) { if (modelname) { - strncpy(modelname, model_name, 8); + aim_strlcpy(modelname, model_name, 8); } node = (id == PSU1_ID) ? PSU1_AC_PMBUS_NODE(psu_fan_dir) : PSU2_AC_PMBUS_NODE(psu_fan_dir); @@ -175,7 +175,7 @@ psu_type_t get_psu_type(int id, char* modelname, int modelname_len) if (strncmp(model_name, "PSU-12V-750", 11) == 0) { if (modelname) { - strncpy(modelname, model_name, 11); + aim_strlcpy(modelname, model_name, 11); } node = (id == PSU1_ID) ? PSU1_AC_HWMON_NODE(psu_fan_dir) : PSU2_AC_HWMON_NODE(psu_fan_dir); diff --git a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/sfpi.c b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/sfpi.c index 4371e8e6..bcae4f9d 100644 --- a/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/sfpi.c +++ b/packages/platforms/mitac/x86-64/ly1200-b32h0-c3/onlp/builds/x86_64_mitac_ly1200_b32h0_c3/module/src/sfpi.c @@ -33,7 +33,7 @@ #include #include #include - +#include #include "platform_lib.h" #define MAX_SFP_PATH 64 diff --git a/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/auto/x86_64_netberg_aurora_420_rangeley.yml b/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/auto/x86_64_netberg_aurora_420_rangeley.yml index 2a500dc9..32eea9e3 100644 --- a/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/auto/x86_64_netberg_aurora_420_rangeley.yml +++ b/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/auto/x86_64_netberg_aurora_420_rangeley.yml @@ -121,7 +121,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/inc/x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_porting.h b/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/inc/x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_porting.h index 79f2983a..3c37783d 100755 --- a/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/inc/x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_porting.h +++ b/packages/platforms/netberg/x86-64/aurora-420-rangeley/onlp/builds/x86_64_netberg_aurora_420_rangeley/module/inc/x86_64_netberg_aurora_420_rangeley/x86_64_netberg_aurora_420_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_NETBERG_AURORA_420_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_NETBERG_AURORA_420_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_NETBERG_AURORA_420_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/auto/x86_64_netberg_aurora_620_rangeley.yml b/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/auto/x86_64_netberg_aurora_620_rangeley.yml index 8a6de78a..08600119 100755 --- a/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/auto/x86_64_netberg_aurora_620_rangeley.yml +++ b/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/auto/x86_64_netberg_aurora_620_rangeley.yml @@ -108,7 +108,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/inc/x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_porting.h b/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/inc/x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_porting.h index 0de01c60..5a8f89d8 100755 --- a/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/inc/x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_porting.h +++ b/packages/platforms/netberg/x86-64/aurora-620-rangeley/onlp/builds/x86_64_netberg_aurora_620_rangeley/module/inc/x86_64_netberg_aurora_620_rangeley/x86_64_netberg_aurora_620_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_NETBERG_AURORA_620_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_NETBERG_AURORA_620_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_NETBERG_AURORA_620_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/auto/x86_64_netberg_aurora_710.yml b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/auto/x86_64_netberg_aurora_710.yml index 3231dcbb..54898d79 100755 --- a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/auto/x86_64_netberg_aurora_710.yml +++ b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/auto/x86_64_netberg_aurora_710.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/inc/x86_64_netberg_aurora_710/x86_64_netberg_aurora_710_porting.h b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/inc/x86_64_netberg_aurora_710/x86_64_netberg_aurora_710_porting.h index 07c0e7f5..00142f35 100755 --- a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/inc/x86_64_netberg_aurora_710/x86_64_netberg_aurora_710_porting.h +++ b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/inc/x86_64_netberg_aurora_710/x86_64_netberg_aurora_710_porting.h @@ -59,16 +59,6 @@ #endif #endif -#ifndef X86_64_NETBERG_AURORA_710_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_NETBERG_AURORA_710_STRNCPY GLOBAL_STRNCPY - #elif X86_64_NETBERG_AURORA_710_CONFIG_PORTING_STDLIB == 1 - #define X86_64_NETBERG_AURORA_710_STRNCPY strncpy - #else - #error The macro X86_64_NETBERG_AURORA_710_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_NETBERG_AURORA_710_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_NETBERG_AURORA_710_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/src/sfpi.c b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/src/sfpi.c index 1bc51f04..93db29f3 100755 --- a/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/src/sfpi.c +++ b/packages/platforms/netberg/x86-64/aurora-710/onlp/builds/x86_64_netberg_aurora_710/module/src/sfpi.c @@ -97,7 +97,7 @@ onlp_sfpi_eeprom_read(int port, uint8_t data[256]) char eeprom_path[512], eeprom_addr[32]; memset(eeprom_path, 0, sizeof(eeprom_path)); memset(eeprom_addr, 0, sizeof(eeprom_addr)); - strncpy(eeprom_addr, "0050", sizeof(eeprom_addr)); + aim_strlcpy(eeprom_addr, "0050", sizeof(eeprom_addr)); memset(data, 0, 256); diff --git a/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/auto/x86_64_netberg_aurora_720_rangeley.yml b/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/auto/x86_64_netberg_aurora_720_rangeley.yml index 5cccd736..d14f8198 100755 --- a/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/auto/x86_64_netberg_aurora_720_rangeley.yml +++ b/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/auto/x86_64_netberg_aurora_720_rangeley.yml @@ -116,7 +116,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/inc/x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_porting.h b/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/inc/x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_porting.h index be815368..9e71a4dd 100755 --- a/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/inc/x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_porting.h +++ b/packages/platforms/netberg/x86-64/aurora-720-rangeley/onlp/builds/x86_64_netberg_aurora_720_rangeley/module/inc/x86_64_netberg_aurora_720_rangeley/x86_64_netberg_aurora_720_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_NETBERG_AURORA_720_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_NETBERG_AURORA_720_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_NETBERG_AURORA_720_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h b/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h deleted file mode 100644 index 5ba655a3..00000000 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************ - * - * - * Copyright 2016 NXP Semiconductor, Inc. - * - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ - -/********************************************************//** - * - * @file - * @brief arm64_nxp_layerscape Porting Macros. - * - * @addtogroup arm64_nxp_layerscape-porting - * @{ - * - ***********************************************************/ -#ifndef __ONLPSIM_PORTING_H__ -#define __ONLPSIM_PORTING_H__ - - -/* */ -#if ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 -#include -#include -#include -#include -#include -#endif - -#ifndef ONLPSIM_MALLOC - #if defined(GLOBAL_MALLOC) - #define ONLPSIM_MALLOC GLOBAL_MALLOC - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MALLOC malloc - #else - #error The macro ONLPSIM_MALLOC is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_FREE - #if defined(GLOBAL_FREE) - #define ONLPSIM_FREE GLOBAL_FREE - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_FREE free - #else - #error The macro ONLPSIM_FREE is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_MEMSET - #if defined(GLOBAL_MEMSET) - #define ONLPSIM_MEMSET GLOBAL_MEMSET - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MEMSET memset - #else - #error The macro ONLPSIM_MEMSET is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_MEMCPY - #if defined(GLOBAL_MEMCPY) - #define ONLPSIM_MEMCPY GLOBAL_MEMCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_MEMCPY memcpy - #else - #error The macro ONLPSIM_MEMCPY is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define ONLPSIM_STRNCPY GLOBAL_STRNCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRNCPY strncpy - #else - #error The macro ONLPSIM_STRNCPY is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_VSNPRINTF - #if defined(GLOBAL_VSNPRINTF) - #define ONLPSIM_VSNPRINTF GLOBAL_VSNPRINTF - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_VSNPRINTF vsnprintf - #else - #error The macro ONLPSIM_VSNPRINTF is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_SNPRINTF - #if defined(GLOBAL_SNPRINTF) - #define ONLPSIM_SNPRINTF GLOBAL_SNPRINTF - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_SNPRINTF snprintf - #else - #error The macro ONLPSIM_SNPRINTF is required but cannot be defined. - #endif -#endif - -#ifndef ONLPSIM_STRLEN - #if defined(GLOBAL_STRLEN) - #define ONLPSIM_STRLEN GLOBAL_STRLEN - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRLEN strlen - #else - #error The macro ONLPSIM_STRLEN is required but cannot be defined. - #endif -#endif - -/* */ - - -#endif /* __ONLPSIM_PORTING_H__ */ -/* @} */ diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_config.c b/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_config.c deleted file mode 100644 index 9d80fa0e..00000000 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_config.c +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************ - * - * - * Copyright 2016 NXP Semiconductor, Inc. - * - * Licensed under the Eclipse Public License, Version 1.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.eclipse.org/legal/epl-v10.html - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, - * either express or implied. See the License for the specific - * language governing permissions and limitations under the - * License. - * - * - ************************************************************ - * - * - * - ***********************************************************/ - -#include - -/* */ -#define __arm64_nxp_layerscape_config_STRINGIFY_NAME(_x) #_x -#define __arm64_nxp_layerscape_config_STRINGIFY_VALUE(_x) __arm64_nxp_layerscape_config_STRINGIFY_NAME(_x) -arm64_nxp_layerscape_config_settings_t arm64_nxp_layerscape_config_settings[] = -{ -#ifdef ONLPSIM_CONFIG_INCLUDE_LOGGING - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_LOGGING), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_LOGGING) }, -#else -{ ONLPSIM_CONFIG_INCLUDE_LOGGING(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT) }, -#else -{ ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_LOG_BITS_DEFAULT - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_BITS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_BITS_DEFAULT) }, -#else -{ ONLPSIM_CONFIG_LOG_BITS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, -#else -{ ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_PORTING_STDLIB - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_STDLIB), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_STDLIB) }, -#else -{ ONLPSIM_CONFIG_PORTING_STDLIB(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, -#else -{ ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_INCLUDE_UCLI - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_INCLUDE_UCLI), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_INCLUDE_UCLI) }, -#else -{ ONLPSIM_CONFIG_INCLUDE_UCLI(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif -#ifdef ONLPSIM_CONFIG_SFP_COUNT - { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ONLPSIM_CONFIG_SFP_COUNT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ONLPSIM_CONFIG_SFP_COUNT) }, -#else -{ ONLPSIM_CONFIG_SFP_COUNT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, -#endif - { NULL, NULL } -}; -#undef __arm64_nxp_layerscape_config_STRINGIFY_VALUE -#undef __arm64_nxp_layerscape_config_STRINGIFY_NAME - -const char* -arm64_nxp_layerscape_config_lookup(const char* setting) -{ - int i; - for(i = 0; arm64_nxp_layerscape_config_settings[i].name; i++) { - if(!strcmp(arm64_nxp_layerscape_config_settings[i].name, setting)) { - return arm64_nxp_layerscape_config_settings[i].value; - } - } - return NULL; -} - -int -arm64_nxp_layerscape_config_show(struct aim_pvs_s* pvs) -{ - int i; - for(i = 0; arm64_nxp_layerscape_config_settings[i].name; i++) { - aim_printf(pvs, "%s = %s\n", arm64_nxp_layerscape_config_settings[i].name, arm64_nxp_layerscape_config_settings[i].value); - } - return i; -} - -/* */ - diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/.gitignore b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/.gitignore similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/.gitignore rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/.gitignore diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/.module b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/.module similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/.module rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/.module diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/Makefile b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/Makefile similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/Makefile rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/Makefile diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/arm64_nxp_layerscape.doxy b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/arm64_nxp_layerscape.doxy similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/arm64_nxp_layerscape.doxy rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/arm64_nxp_layerscape.doxy diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/auto/arm64_nxp_layerscape.yml b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/auto/arm64_nxp_layerscape.yml similarity index 70% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/auto/arm64_nxp_layerscape.yml rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/auto/arm64_nxp_layerscape.yml index c973809e..a752e9f1 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/auto/arm64_nxp_layerscape.yml +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/auto/arm64_nxp_layerscape.yml @@ -24,45 +24,52 @@ ############################################################ cdefs: &cdefs -- ONLPSIM_CONFIG_INCLUDE_LOGGING: +- ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING: doc: "Include or exclude logging." default: 1 -- ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT: +- ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT: doc: "Default enabled log options." default: AIM_LOG_OPTIONS_DEFAULT -- ONLPSIM_CONFIG_LOG_BITS_DEFAULT: +- ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT: doc: "Default enabled log bits." default: AIM_LOG_BITS_DEFAULT -- ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT: +- ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT: doc: "Default enabled custom log bits." default: 0 -- ONLPSIM_CONFIG_PORTING_STDLIB: +- ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB: doc: "Default all porting macros to use the C standard libraries." default: 1 -- ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: +- ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: doc: "Include standard library headers for stdlib porting macros." - default: ONLPSIM_CONFIG_PORTING_STDLIB -- ONLPSIM_CONFIG_INCLUDE_UCLI: + default: ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB +- ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI: doc: "Include generic uCli support." default: 0 -- ONLPSIM_CONFIG_SFP_COUNT: +- ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT: doc: "SFP Count." default: 0 definitions: cdefs: - ONLPSIM_CONFIG_HEADER: + ARM64_NXP_LAYERSCAPE_CONFIG_HEADER: defs: *cdefs basename: arm64_nxp_layerscape_config + enum: + platform_id: + members: + - ARM64_NXP_LS2088ARDB_R0 + - ARM64_NXP_LS1043ARDB_R0 + - ARM64_NXP_LS1046ARDB_R0 + - ARM64_NXP_LS1088ARDB_R0 + portingmacro: - ONLPSIM: + ARM64_NXP_LAYERSCAPE: macros: - malloc - free - memset - memcpy - - strncpy - vsnprintf - snprintf - strlen diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/auto/make.mk b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/auto/make.mk similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/auto/make.mk rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/auto/make.mk diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape.x b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape.x similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape.x rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape.x diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h similarity index 60% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h index d33f0ecd..f8f0aa59 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_config.h @@ -32,96 +32,96 @@ * @{ * *****************************************************************************/ -#ifndef __ONLPSIM_CONFIG_H__ -#define __ONLPSIM_CONFIG_H__ +#ifndef __ARM64_NXP_LAYERSCAPE_CONFIG_H__ +#define __ARM64_NXP_LAYERSCAPE_CONFIG_H__ #ifdef GLOBAL_INCLUDE_CUSTOM_CONFIG #include #endif -#ifdef ONLPSIM_INCLUDE_CUSTOM_CONFIG +#ifdef ARM64_NXP_LAYERSCAPE_INCLUDE_CUSTOM_CONFIG #include #endif -/* */ +/* */ #include /** - * ONLPSIM_CONFIG_INCLUDE_LOGGING + * ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING * * Include or exclude logging. */ -#ifndef ONLPSIM_CONFIG_INCLUDE_LOGGING -#define ONLPSIM_CONFIG_INCLUDE_LOGGING 1 +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING +#define ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING 1 #endif /** - * ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT + * ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT * * Default enabled log options. */ -#ifndef ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT -#define ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT +#define ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT AIM_LOG_OPTIONS_DEFAULT #endif /** - * ONLPSIM_CONFIG_LOG_BITS_DEFAULT + * ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT * * Default enabled log bits. */ -#ifndef ONLPSIM_CONFIG_LOG_BITS_DEFAULT -#define ONLPSIM_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT +#define ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT AIM_LOG_BITS_DEFAULT #endif /** - * ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + * ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT * * Default enabled custom log bits. */ -#ifndef ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT -#define ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT +#define ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT 0 #endif /** - * ONLPSIM_CONFIG_PORTING_STDLIB + * ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB * * Default all porting macros to use the C standard libraries. */ -#ifndef ONLPSIM_CONFIG_PORTING_STDLIB -#define ONLPSIM_CONFIG_PORTING_STDLIB 1 +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB +#define ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB 1 #endif /** - * ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + * ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS * * Include standard library headers for stdlib porting macros. */ -#ifndef ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS -#define ONLPSIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ONLPSIM_CONFIG_PORTING_STDLIB +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS +#define ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB #endif /** - * ONLPSIM_CONFIG_INCLUDE_UCLI + * ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI * * Include generic uCli support. */ -#ifndef ONLPSIM_CONFIG_INCLUDE_UCLI -#define ONLPSIM_CONFIG_INCLUDE_UCLI 0 +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI +#define ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI 0 #endif /** - * ONLPSIM_CONFIG_SFP_COUNT + * ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT * * SFP Count. */ -#ifndef ONLPSIM_CONFIG_SFP_COUNT -#define ONLPSIM_CONFIG_SFP_COUNT 0 +#ifndef ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT +#define ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT 0 #endif @@ -154,9 +154,9 @@ const char* arm64_nxp_layerscape_config_lookup(const char* setting); */ int arm64_nxp_layerscape_config_show(struct aim_pvs_s* pvs); -/* */ +/* */ #include "arm64_nxp_layerscape_porting.h" -#endif /* __ONLPSIM_CONFIG_H__ */ +#endif /* __ARM64_NXP_LAYERSCAPE_CONFIG_H__ */ /* @} */ diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h similarity index 92% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h index d5d21343..563d2e1b 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_dox.h @@ -28,8 +28,8 @@ * arm64_nxp_layerscape Doxygen Header * ***********************************************************/ -#ifndef __ONLPSIM_DOX_H__ -#define __ONLPSIM_DOX_H__ +#ifndef __ARM64_NXP_LAYERSCAPE_DOX_H__ +#define __ARM64_NXP_LAYERSCAPE_DOX_H__ /** * @defgroup arm64_nxp_layerscape arm64_nxp_layerscape - onlpsim Description @@ -48,4 +48,4 @@ The documentation overview for this module should go here. * */ -#endif /* __ONLPSIM_DOX_H__ */ +#endif /* __ARM64_NXP_LAYERSCAPE_DOX_H__ */ diff --git a/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h new file mode 100644 index 00000000..d7e62393 --- /dev/null +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/inc/arm64_nxp_layerscape/arm64_nxp_layerscape_porting.h @@ -0,0 +1,123 @@ +/************************************************************ + * + * + * Copyright 2016 NXP Semiconductor, Inc. + * + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +/********************************************************//** + * + * @file + * @brief arm64_nxp_layerscape Porting Macros. + * + * @addtogroup arm64_nxp_layerscape-porting + * @{ + * + ***********************************************************/ +#ifndef __ARM64_NXP_LAYERSCAPE_PORTING_H__ +#define __ARM64_NXP_LAYERSCAPE_PORTING_H__ + + +/* */ +#if ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS == 1 +#include +#include +#include +#include +#include +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_MALLOC + #if defined(GLOBAL_MALLOC) + #define ARM64_NXP_LAYERSCAPE_MALLOC GLOBAL_MALLOC + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_MALLOC malloc + #else + #error The macro ARM64_NXP_LAYERSCAPE_MALLOC is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_FREE + #if defined(GLOBAL_FREE) + #define ARM64_NXP_LAYERSCAPE_FREE GLOBAL_FREE + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_FREE free + #else + #error The macro ARM64_NXP_LAYERSCAPE_FREE is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_MEMSET + #if defined(GLOBAL_MEMSET) + #define ARM64_NXP_LAYERSCAPE_MEMSET GLOBAL_MEMSET + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_MEMSET memset + #else + #error The macro ARM64_NXP_LAYERSCAPE_MEMSET is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_MEMCPY + #if defined(GLOBAL_MEMCPY) + #define ARM64_NXP_LAYERSCAPE_MEMCPY GLOBAL_MEMCPY + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_MEMCPY memcpy + #else + #error The macro ARM64_NXP_LAYERSCAPE_MEMCPY is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_VSNPRINTF + #if defined(GLOBAL_VSNPRINTF) + #define ARM64_NXP_LAYERSCAPE_VSNPRINTF GLOBAL_VSNPRINTF + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_VSNPRINTF vsnprintf + #else + #error The macro ARM64_NXP_LAYERSCAPE_VSNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_SNPRINTF + #if defined(GLOBAL_SNPRINTF) + #define ARM64_NXP_LAYERSCAPE_SNPRINTF GLOBAL_SNPRINTF + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_SNPRINTF snprintf + #else + #error The macro ARM64_NXP_LAYERSCAPE_SNPRINTF is required but cannot be defined. + #endif +#endif + +#ifndef ARM64_NXP_LAYERSCAPE_STRLEN + #if defined(GLOBAL_STRLEN) + #define ARM64_NXP_LAYERSCAPE_STRLEN GLOBAL_STRLEN + #elif ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB == 1 + #define ARM64_NXP_LAYERSCAPE_STRLEN strlen + #else + #error The macro ARM64_NXP_LAYERSCAPE_STRLEN is required but cannot be defined. + #endif +#endif + +/* */ + + +#endif /* __ARM64_NXP_LAYERSCAPE_PORTING_H__ */ +/* @} */ diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/make.mk b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/make.mk similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/make.mk rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/make.mk diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/Makefile b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/Makefile similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/Makefile rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/Makefile diff --git a/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_config.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_config.c new file mode 100644 index 00000000..ba6685f0 --- /dev/null +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_config.c @@ -0,0 +1,101 @@ +/************************************************************ + * + * + * Copyright 2016 NXP Semiconductor, Inc. + * + * Licensed under the Eclipse Public License, Version 1.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the specific + * language governing permissions and limitations under the + * License. + * + * + ************************************************************ + * + * + * + ***********************************************************/ + +#include + +/* */ +#define __arm64_nxp_layerscape_config_STRINGIFY_NAME(_x) #_x +#define __arm64_nxp_layerscape_config_STRINGIFY_VALUE(_x) __arm64_nxp_layerscape_config_STRINGIFY_NAME(_x) +arm64_nxp_layerscape_config_settings_t arm64_nxp_layerscape_config_settings[] = +{ +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_LOGGING(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_STDLIB(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif +#ifdef ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT + { __arm64_nxp_layerscape_config_STRINGIFY_NAME(ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT), __arm64_nxp_layerscape_config_STRINGIFY_VALUE(ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT) }, +#else +{ ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT(__arm64_nxp_layerscape_config_STRINGIFY_NAME), "__undefined__" }, +#endif + { NULL, NULL } +}; +#undef __arm64_nxp_layerscape_config_STRINGIFY_VALUE +#undef __arm64_nxp_layerscape_config_STRINGIFY_NAME + +const char* +arm64_nxp_layerscape_config_lookup(const char* setting) +{ + int i; + for(i = 0; arm64_nxp_layerscape_config_settings[i].name; i++) { + if(!strcmp(arm64_nxp_layerscape_config_settings[i].name, setting)) { + return arm64_nxp_layerscape_config_settings[i].value; + } + } + return NULL; +} + +int +arm64_nxp_layerscape_config_show(struct aim_pvs_s* pvs) +{ + int i; + for(i = 0; arm64_nxp_layerscape_config_settings[i].name; i++) { + aim_printf(pvs, "%s = %s\n", arm64_nxp_layerscape_config_settings[i].name, arm64_nxp_layerscape_config_settings[i].value); + } + return i; +} + +/* */ + diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_enums.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_enums.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_enums.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_enums.c diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_int.h b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_int.h similarity index 51% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_int.h rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_int.h index 624af194..3b0c6762 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_int.h +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_int.h @@ -1,21 +1,21 @@ /************************************************************ * - * + * * Copyright 2016 NXP Semiconductor, Inc. - * + * * Licensed under the Eclipse Public License, Version 1.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.eclipse.org/legal/epl-v10.html - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the * License. - * + * * ************************************************************ * @@ -23,23 +23,48 @@ * ***********************************************************/ -#ifndef __ONLPSIM_INT_H__ -#define __ONLPSIM_INT_H__ +#ifndef __ARM64_NXP_LAYERSCAPE_INT_H__ +#define __ARM64_NXP_LAYERSCAPE_INT_H__ #include /* */ /** platform_id */ typedef enum platform_id_e { - PLATFORM_ID_ARM64_NXP_LS2088ARDB_R0, - PLATFORM_ID_ARM64_NXP_LS1043ARDB_R0, - PLATFORM_ID_ARM64_NXP_LS1046ARDB_R0, - PLATFORM_ID_ARM64_NXP_LS1088ARDB_R0, - PLATFORM_ID_COUNT, - PLATFORM_ID_INVALID = -1, + PLATFORM_ID_ARM64_NXP_LS2088ARDB_R0, + PLATFORM_ID_ARM64_NXP_LS1043ARDB_R0, + PLATFORM_ID_ARM64_NXP_LS1046ARDB_R0, + PLATFORM_ID_ARM64_NXP_LS1088ARDB_R0, + PLATFORM_ID_LAST = PLATFORM_ID_ARM64_NXP_LS1088ARDB_R0, + PLATFORM_ID_COUNT, + PLATFORM_ID_INVALID = -1, } platform_id_t; +/** Strings macro. */ +#define PLATFORM_ID_STRINGS \ +{\ + "ARM64_NXP_LS2088ARDB_R0", \ + "ARM64_NXP_LS1043ARDB_R0", \ + "ARM64_NXP_LS1046ARDB_R0", \ + "ARM64_NXP_LS1088ARDB_R0", \ +} +/** Enum names. */ +const char* platform_id_name(platform_id_t e); + /** Enum values. */ int platform_id_value(const char* str, platform_id_t* e, int substr); -#endif /* __ONLPSIM_INT_H__ */ +/** Enum descriptions. */ +const char* platform_id_desc(platform_id_t e); + +/** validator */ +#define PLATFORM_ID_VALID(_e) \ + ( (0 <= (_e)) && ((_e) <= PLATFORM_ID_ARM64_NXP_LS1088ARDB_R0)) + +/** platform_id_map table. */ +extern aim_map_si_t platform_id_map[]; +/** platform_id_desc_map table. */ +extern aim_map_si_t platform_id_desc_map[]; +/* */ + +#endif /* __ARM64_NXP_LAYERSCAPE_INT_H__ */ diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.c similarity index 83% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.c index 384a4c5b..6dc25735 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.c +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.c @@ -30,9 +30,9 @@ * arm64_nxp_layerscape log struct. */ AIM_LOG_STRUCT_DEFINE( - ONLPSIM_CONFIG_LOG_OPTIONS_DEFAULT, - ONLPSIM_CONFIG_LOG_BITS_DEFAULT, + ARM64_NXP_LAYERSCAPE_CONFIG_LOG_OPTIONS_DEFAULT, + ARM64_NXP_LAYERSCAPE_CONFIG_LOG_BITS_DEFAULT, NULL, /* Custom log map */ - ONLPSIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT + ARM64_NXP_LAYERSCAPE_CONFIG_LOG_CUSTOM_BITS_DEFAULT ); diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.h b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.h similarity index 88% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.h rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.h index 58f6429c..bb1c5ab6 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_log.h +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_log.h @@ -23,10 +23,10 @@ * ***********************************************************/ -#ifndef __ONLPSIM_LOG_H__ -#define __ONLPSIM_LOG_H__ +#ifndef __ARM64_NXP_LAYERSCAPE_LOG_H__ +#define __ARM64_NXP_LAYERSCAPE_LOG_H__ #define AIM_LOG_MODULE_NAME arm64_nxp_layerscape #include -#endif /* __ONLPSIM_LOG_H__ */ +#endif /* __ARM64_NXP_LAYERSCAPE_LOG_H__ */ diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_module.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_module.c similarity index 87% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_module.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_module.c index eba43545..a55da982 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_module.c +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_module.c @@ -30,7 +30,7 @@ static int datatypes_init__(void) { -#define ONLPSIM_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); +#define ARM64_NXP_LAYERSCAPE_ENUMERATION_ENTRY(_enum_name, _desc) AIM_DATATYPE_MAP_REGISTER(_enum_name, _enum_name##_map, _desc, AIM_LOG_INTERNAL); #include return 0; } diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_ucli.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_ucli.c similarity index 97% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_ucli.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_ucli.c index 581c7c74..f3873542 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/arm64_nxp_layerscape_ucli.c +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/arm64_nxp_layerscape_ucli.c @@ -25,7 +25,7 @@ #include -#if ONLPSIM_CONFIG_INCLUDE_UCLI == 1 +#if ARM64_NXP_LAYERSCAPE_CONFIG_INCLUDE_UCLI == 1 #include #include diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/fani.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/fani.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/fani.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/fani.c diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/ledi.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/ledi.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/ledi.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/ledi.c diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/make.mk b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/make.mk similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/make.mk rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/make.mk diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/psui.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/psui.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/psui.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/psui.c diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/sfpi.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/sfpi.c similarity index 96% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/sfpi.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/sfpi.c index b4cbe1ac..4d00515b 100644 --- a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/sfpi.c +++ b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/sfpi.c @@ -25,7 +25,7 @@ #include #include "arm64_nxp_layerscape_log.h" -static int sfp_count__ = ONLPSIM_CONFIG_SFP_COUNT; +static int sfp_count__ = ARM64_NXP_LAYERSCAPE_CONFIG_SFP_COUNT; int onlp_sfpi_init(void) diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/sysi.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/sysi.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/sysi.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/sysi.c diff --git a/packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/thermali.c b/packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/thermali.c similarity index 100% rename from packages/platforms/nxp/arm64/any/arm64-nxp-layerscape/module/src/thermali.c rename to packages/platforms/nxp/arm64/any/arm64_nxp_layerscape/module/src/thermali.c diff --git a/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/auto/arm_qemu_armv7a.yml b/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/auto/arm_qemu_armv7a.yml index af4d5b24..7dc33181 100644 --- a/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/auto/arm_qemu_armv7a.yml +++ b/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/auto/arm_qemu_armv7a.yml @@ -62,7 +62,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/inc/arm_qemu_armv7a/arm_qemu_armv7a_porting.h b/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/inc/arm_qemu_armv7a/arm_qemu_armv7a_porting.h index fd7bbdab..f690ae3f 100644 --- a/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/inc/arm_qemu_armv7a/arm_qemu_armv7a_porting.h +++ b/packages/platforms/qemu/arm/arm-qemu-armv7a/onlp/builds/arm_qemu_armv7a/module/inc/arm_qemu_armv7a/arm_qemu_armv7a_porting.h @@ -85,16 +85,6 @@ #endif #endif -#ifndef ONLPSIM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define ONLPSIM_STRNCPY GLOBAL_STRNCPY - #elif ONLPSIM_CONFIG_PORTING_STDLIB == 1 - #define ONLPSIM_STRNCPY strncpy - #else - #error The macro ONLPSIM_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef ONLPSIM_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define ONLPSIM_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml index c4104d0f..1f242450 100644 --- a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml +++ b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/auto/quanta_sys_eeprom.yml @@ -41,7 +41,7 @@ definitions: - free - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h index e6ecb0f9..d9492837 100644 --- a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h +++ b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/inc/quanta_sys_eeprom/quanta_sys_eeprom_porting.h @@ -60,16 +60,6 @@ #endif #endif -#ifndef QUANTA_SYS_EEPROM_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define QUANTA_SYS_EEPROM_STRNCPY GLOBAL_STRNCPY - #elif QUANTA_SYS_EEPROM_CONFIG_PORTING_STDLIB == 1 - #define QUANTA_SYS_EEPROM_STRNCPY strncpy - #else - #error The macro QUANTA_SYS_EEPROM_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef QUANTA_SYS_EEPROM_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define QUANTA_SYS_EEPROM_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/src/eeprom.c b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/src/eeprom.c index 41039687..d9485b0e 100644 --- a/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/src/eeprom.c +++ b/packages/platforms/quanta/any/src/quanta_sys_eeprom/module/src/eeprom.c @@ -34,7 +34,7 @@ quanta_sys_eeprom_parse_data(const uint8_t* data, int size, } switch(code) { -#define EEPROM_STRCPY(_field) strncpy(rv->_field, (char*)p, clen) +#define EEPROM_STRCPY(_field) aim_strlcpy(rv->_field, (char*)p, clen) #define EEPROM_LONG(_field) rv->_field = (p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]) case 0x1: diff --git a/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/auto/powerpc_quanta_lb9.yml b/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/auto/powerpc_quanta_lb9.yml index b1e17af0..cf4c6676 100644 --- a/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/auto/powerpc_quanta_lb9.yml +++ b/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/auto/powerpc_quanta_lb9.yml @@ -110,7 +110,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h b/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h index 5347380a..8fda00ac 100644 --- a/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h +++ b/packages/platforms/quanta/powerpc/lb9/onlp/builds/powerpc_quanta_lb9/module/inc/powerpc_quanta_lb9/powerpc_quanta_lb9_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef POWERPC_QUANTA_LB9_R0_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_QUANTA_LB9_R0_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_QUANTA_LB9_R0_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_QUANTA_LB9_R0_STRNCPY strncpy - #else - #error The macro POWERPC_QUANTA_LB9_R0_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_QUANTA_LB9_R0_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_QUANTA_LB9_R0_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/auto/powerpc_quanta_ly2.yml b/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/auto/powerpc_quanta_ly2.yml index fe7e6305..d1878da1 100644 --- a/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/auto/powerpc_quanta_ly2.yml +++ b/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/auto/powerpc_quanta_ly2.yml @@ -110,7 +110,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h b/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h index 694782f8..1daeb5d3 100644 --- a/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h +++ b/packages/platforms/quanta/powerpc/ly2/onlp/builds/powerpc_quanta_ly2/module/inc/powerpc_quanta_ly2/powerpc_quanta_ly2_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef POWERPC_QUANTA_LY2_R0_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define POWERPC_QUANTA_LY2_R0_STRNCPY GLOBAL_STRNCPY - #elif POWERPC_QUANTA_LY2_R0_CONFIG_PORTING_STDLIB == 1 - #define POWERPC_QUANTA_LY2_R0_STRNCPY strncpy - #else - #error The macro POWERPC_QUANTA_LY2_R0_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef POWERPC_QUANTA_LY2_R0_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define POWERPC_QUANTA_LY2_R0_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/auto/x86_64_quanta_ix1_rangeley.yml b/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/auto/x86_64_quanta_ix1_rangeley.yml index c2fcda51..4517bd8f 100755 --- a/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/auto/x86_64_quanta_ix1_rangeley.yml +++ b/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/auto/x86_64_quanta_ix1_rangeley.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/inc/x86_64_quanta_ix1_rangeley/x86_64_quanta_ix1_rangeley_porting.h b/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/inc/x86_64_quanta_ix1_rangeley/x86_64_quanta_ix1_rangeley_porting.h index 3c7d795d..87a151d9 100755 --- a/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/inc/x86_64_quanta_ix1_rangeley/x86_64_quanta_ix1_rangeley_porting.h +++ b/packages/platforms/quanta/x86-64/ix1-rangeley/onlp/builds/x86_64_quanta_ix1_rangeley/module/inc/x86_64_quanta_ix1_rangeley/x86_64_quanta_ix1_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_IX1_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_IX1_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_IX1_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_IX1_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_IX1_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_IX1_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_IX1_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/auto/x86_64_quanta_ix1b_rglbmc.yml b/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/auto/x86_64_quanta_ix1b_rglbmc.yml index 8b791946..cf5969bf 100755 --- a/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/auto/x86_64_quanta_ix1b_rglbmc.yml +++ b/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/auto/x86_64_quanta_ix1b_rglbmc.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/inc/x86_64_quanta_ix1b_rglbmc/x86_64_quanta_ix1b_rglbmc_porting.h b/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/inc/x86_64_quanta_ix1b_rglbmc/x86_64_quanta_ix1b_rglbmc_porting.h index 13a89c1d..5b01e91b 100755 --- a/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/inc/x86_64_quanta_ix1b_rglbmc/x86_64_quanta_ix1b_rglbmc_porting.h +++ b/packages/platforms/quanta/x86-64/ix1b-rglbmc/onlp/builds/x86_64_quanta_ix1b_rglbmc/module/inc/x86_64_quanta_ix1b_rglbmc/x86_64_quanta_ix1b_rglbmc_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_IX1B_RGLBMC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_IX1B_RGLBMC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_IX1B_RGLBMC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_IX1B_RGLBMC_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_IX1B_RGLBMC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_IX1B_RGLBMC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_IX1B_RGLBMC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/auto/x86_64_quanta_ix2_rangeley.yml b/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/auto/x86_64_quanta_ix2_rangeley.yml index 9774022e..aefe2472 100755 --- a/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/auto/x86_64_quanta_ix2_rangeley.yml +++ b/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/auto/x86_64_quanta_ix2_rangeley.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/inc/x86_64_quanta_ix2_rangeley/x86_64_quanta_ix2_rangeley_porting.h b/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/inc/x86_64_quanta_ix2_rangeley/x86_64_quanta_ix2_rangeley_porting.h index f98fe673..ac355777 100755 --- a/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/inc/x86_64_quanta_ix2_rangeley/x86_64_quanta_ix2_rangeley_porting.h +++ b/packages/platforms/quanta/x86-64/ix2-rangeley/onlp/builds/x86_64_quanta_ix2_rangeley/module/inc/x86_64_quanta_ix2_rangeley/x86_64_quanta_ix2_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_IX2_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_IX2_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_IX2_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_IX2_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_IX2_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_IX2_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_IX2_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/auto/x86_64_quanta_ix7_rglbmc.yml b/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/auto/x86_64_quanta_ix7_rglbmc.yml index 0fcb7c86..42f8838c 100644 --- a/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/auto/x86_64_quanta_ix7_rglbmc.yml +++ b/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/auto/x86_64_quanta_ix7_rglbmc.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/inc/x86_64_quanta_ix7_rglbmc/x86_64_quanta_ix7_rglbmc_porting.h b/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/inc/x86_64_quanta_ix7_rglbmc/x86_64_quanta_ix7_rglbmc_porting.h index b32454a3..11864e14 100644 --- a/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/inc/x86_64_quanta_ix7_rglbmc/x86_64_quanta_ix7_rglbmc_porting.h +++ b/packages/platforms/quanta/x86-64/ix7-rglbmc/onlp/builds/x86_64_quanta_ix7_rglbmc/module/inc/x86_64_quanta_ix7_rglbmc/x86_64_quanta_ix7_rglbmc_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_IX7_RGLBMC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_IX7_RGLBMC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_IX7_RGLBMC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_IX7_RGLBMC_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_IX7_RGLBMC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_IX7_RGLBMC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_IX7_RGLBMC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/auto/x86_64_quanta_ix8_rglbmc.yml b/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/auto/x86_64_quanta_ix8_rglbmc.yml index 36f1796c..64688189 100644 --- a/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/auto/x86_64_quanta_ix8_rglbmc.yml +++ b/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/auto/x86_64_quanta_ix8_rglbmc.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/inc/x86_64_quanta_ix8_rglbmc/x86_64_quanta_ix8_rglbmc_porting.h b/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/inc/x86_64_quanta_ix8_rglbmc/x86_64_quanta_ix8_rglbmc_porting.h index 509b038a..3494316e 100644 --- a/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/inc/x86_64_quanta_ix8_rglbmc/x86_64_quanta_ix8_rglbmc_porting.h +++ b/packages/platforms/quanta/x86-64/ix8-rglbmc/onlp/builds/x86_64_quanta_ix8_rglbmc/module/inc/x86_64_quanta_ix8_rglbmc/x86_64_quanta_ix8_rglbmc_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_IX8_RGLBMC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_IX8_RGLBMC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_IX8_RGLBMC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_IX8_RGLBMC_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_IX8_RGLBMC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_IX8_RGLBMC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_IX8_RGLBMC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/auto/x86_64_quanta_ly4r.yml b/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/auto/x86_64_quanta_ly4r.yml index b3c5da54..532b9ebd 100755 --- a/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/auto/x86_64_quanta_ly4r.yml +++ b/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/auto/x86_64_quanta_ly4r.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/inc/x86_64_quanta_ly4r/x86_64_quanta_ly4r_porting.h b/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/inc/x86_64_quanta_ly4r/x86_64_quanta_ly4r_porting.h index 91bc6709..cceec514 100755 --- a/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/inc/x86_64_quanta_ly4r/x86_64_quanta_ly4r_porting.h +++ b/packages/platforms/quanta/x86-64/ly4r/onlp/builds/x86_64_quanta_ly4r/module/inc/x86_64_quanta_ly4r/x86_64_quanta_ly4r_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_LY4R_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_LY4R_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_LY4R_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_LY4R_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_LY4R_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_LY4R_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_LY4R_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/auto/x86_64_quanta_ly6_rangeley.yml b/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/auto/x86_64_quanta_ly6_rangeley.yml index a9e0ffdb..43f5fb4d 100644 --- a/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/auto/x86_64_quanta_ly6_rangeley.yml +++ b/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/auto/x86_64_quanta_ly6_rangeley.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/inc/x86_64_quanta_ly6_rangeley/x86_64_quanta_ly6_rangeley_porting.h b/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/inc/x86_64_quanta_ly6_rangeley/x86_64_quanta_ly6_rangeley_porting.h index c6b66811..25bbfa23 100644 --- a/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/inc/x86_64_quanta_ly6_rangeley/x86_64_quanta_ly6_rangeley_porting.h +++ b/packages/platforms/quanta/x86-64/ly6-rangeley/onlp/builds/x86_64_quanta_ly6_rangeley/module/inc/x86_64_quanta_ly6_rangeley/x86_64_quanta_ly6_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_LY6_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_LY6_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_LY6_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_LY6_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_LY6_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_LY6_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_LY6_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/auto/x86_64_quanta_ly7_rglbmc.yml b/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/auto/x86_64_quanta_ly7_rglbmc.yml index 5d056542..ff4a88a5 100755 --- a/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/auto/x86_64_quanta_ly7_rglbmc.yml +++ b/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/auto/x86_64_quanta_ly7_rglbmc.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/inc/x86_64_quanta_ly7_rglbmc/x86_64_quanta_ly7_rglbmc_porting.h b/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/inc/x86_64_quanta_ly7_rglbmc/x86_64_quanta_ly7_rglbmc_porting.h index 32b963fa..0518955a 100755 --- a/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/inc/x86_64_quanta_ly7_rglbmc/x86_64_quanta_ly7_rglbmc_porting.h +++ b/packages/platforms/quanta/x86-64/ly7-rglbmc/onlp/builds/x86_64_quanta_ly7_rglbmc/module/inc/x86_64_quanta_ly7_rglbmc/x86_64_quanta_ly7_rglbmc_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_LY7_RGLBMC_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_LY7_RGLBMC_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_LY7_RGLBMC_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_LY7_RGLBMC_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_LY7_RGLBMC_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_LY7_RGLBMC_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_LY7_RGLBMC_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/auto/x86_64_quanta_ly8_rangeley.yml b/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/auto/x86_64_quanta_ly8_rangeley.yml index f8d6243d..d29956bb 100644 --- a/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/auto/x86_64_quanta_ly8_rangeley.yml +++ b/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/auto/x86_64_quanta_ly8_rangeley.yml @@ -128,7 +128,7 @@ definitions: macros: - memset - memcpy - - strncpy + - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/inc/x86_64_quanta_ly8_rangeley/x86_64_quanta_ly8_rangeley_porting.h b/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/inc/x86_64_quanta_ly8_rangeley/x86_64_quanta_ly8_rangeley_porting.h index 10c8ae4a..38ce98f6 100644 --- a/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/inc/x86_64_quanta_ly8_rangeley/x86_64_quanta_ly8_rangeley_porting.h +++ b/packages/platforms/quanta/x86-64/ly8-rangeley/onlp/builds/x86_64_quanta_ly8_rangeley/module/inc/x86_64_quanta_ly8_rangeley/x86_64_quanta_ly8_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_LY8_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_LY8_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_LY8_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_LY8_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_LY8_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_LY8_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_LY8_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF diff --git a/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/auto/x86_64_quanta_ly9_rangeley.yml b/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/auto/x86_64_quanta_ly9_rangeley.yml index c72474ea..c4ba5a5b 100755 --- a/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/auto/x86_64_quanta_ly9_rangeley.yml +++ b/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/auto/x86_64_quanta_ly9_rangeley.yml @@ -128,7 +128,6 @@ definitions: macros: - memset - memcpy - - strncpy - vsnprintf - snprintf - strlen diff --git a/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/inc/x86_64_quanta_ly9_rangeley/x86_64_quanta_ly9_rangeley_porting.h b/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/inc/x86_64_quanta_ly9_rangeley/x86_64_quanta_ly9_rangeley_porting.h index 7a08b3cb..ad34056c 100755 --- a/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/inc/x86_64_quanta_ly9_rangeley/x86_64_quanta_ly9_rangeley_porting.h +++ b/packages/platforms/quanta/x86-64/ly9-rangeley/onlp/builds/x86_64_quanta_ly9_rangeley/module/inc/x86_64_quanta_ly9_rangeley/x86_64_quanta_ly9_rangeley_porting.h @@ -40,16 +40,6 @@ #endif #endif -#ifndef X86_64_QUANTA_LY9_RANGELEY_STRNCPY - #if defined(GLOBAL_STRNCPY) - #define X86_64_QUANTA_LY9_RANGELEY_STRNCPY GLOBAL_STRNCPY - #elif X86_64_QUANTA_LY9_RANGELEY_CONFIG_PORTING_STDLIB == 1 - #define X86_64_QUANTA_LY9_RANGELEY_STRNCPY strncpy - #else - #error The macro X86_64_QUANTA_LY9_RANGELEY_STRNCPY is required but cannot be defined. - #endif -#endif - #ifndef X86_64_QUANTA_LY9_RANGELEY_VSNPRINTF #if defined(GLOBAL_VSNPRINTF) #define X86_64_QUANTA_LY9_RANGELEY_VSNPRINTF GLOBAL_VSNPRINTF