osaf/libs/core/common/include/ncs_main_pub.h | 1 - osaf/libs/core/common/ncs_main_pub.c | 123 ------------------------------ osaf/libs/core/include/ncs_main_papi.h | 67 +---------------- 3 files changed, 1 insertions(+), 190 deletions(-)
diff --git a/osaf/libs/core/common/include/ncs_main_pub.h b/osaf/libs/core/common/include/ncs_main_pub.h --- a/osaf/libs/core/common/include/ncs_main_pub.h +++ b/osaf/libs/core/common/include/ncs_main_pub.h @@ -40,7 +40,6 @@ **** Utility APIs defined in ncs_main_pub.c **** \***********************************************************************/ -char ncs_util_get_char_option(int argc, char *argv[], char *arg_prefix); char *ncs_util_search_argv_list(int argc, char *argv[], char *arg_prefix); uint32_t file_get_word(FILE **fp, char *o_chword); uint32_t file_get_string(FILE **fp, char *o_chword); diff --git a/osaf/libs/core/common/ncs_main_pub.c b/osaf/libs/core/common/ncs_main_pub.c --- a/osaf/libs/core/common/ncs_main_pub.c +++ b/osaf/libs/core/common/ncs_main_pub.c @@ -656,80 +656,6 @@ uint32_t mainget_node_id(uint32_t *node_ return (res); } -/* Fetchs the chassis type string */ -uint32_t ncs_get_chassis_type(uint32_t i_max_len, char *o_chassis_type) -{ - FILE *fp; - uint32_t res = NCSCC_RC_SUCCESS; - uint32_t d_len, f_len; - uint32_t file_size = 0; - char temp_ncs_config_root[MAX_NCS_CONFIG_FILEPATH_LEN + 1]; - - if ((res = ncs_set_config_root()) != NCSCC_RC_SUCCESS) - return NCSCC_RC_FAILURE; - - memset(temp_ncs_config_root, 0, sizeof(temp_ncs_config_root)); - - strncpy(temp_ncs_config_root, ncs_config_root, sizeof(temp_ncs_config_root) - 1); - - if (i_max_len > NCS_MAX_CHASSIS_TYPE_LEN) - return NCSCC_RC_FAILURE; - - d_len = strlen(temp_ncs_config_root); - - f_len = strlen("/chassis_type"); - if ((d_len + f_len) >= MAX_NCS_CONFIG_FILEPATH_LEN) { - TRACE_4("\n Filename too long \n"); - return NCSCC_RC_FAILURE; - } - - /* Hack ncs_config_root to construct path */ - sprintf(temp_ncs_config_root + d_len, "%s", "/chassis_type"); - fp = fopen(temp_ncs_config_root, "r"); - if (fp == NULL) { - TRACE_4("\nNCS: Couldn't open %s/chassis_type \n", temp_ncs_config_root); - return NCSCC_RC_FAILURE; - } - - /* positions the file pointer to the end of the file */ - if (0 != fseek(fp, 0L, SEEK_END)) { - TRACE_4("fseek call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* gets the file pointer offset from the start of the file */ - file_size = ftell(fp); - if (file_size == -1) { - TRACE_4("ftell call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* validating the file size */ - if ((file_size > NCS_MAX_CHASSIS_TYPE_LEN + 1) || (file_size > i_max_len + 1) || (file_size == 0)) { - TRACE_4("Some thing wrong with chassis_type file \n"); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - /* positions the file pointer to the end of the file */ - if (0 != fseek(fp, 0L, SEEK_SET)) { - TRACE_4("fseek call failed with errno %d \n", errno); - fclose(fp); - return NCSCC_RC_FAILURE; - } - - do { - /* reads the chassis type string from the file and copies into the user provided buffer */ - file_get_string(&fp, o_chassis_type); - - fclose(fp); - - } while (0); - - return (res); -} static uint32_t ncs_set_config_root(void) { @@ -860,28 +786,6 @@ uint32_t ncs_update_sys_param_args(void) return NCSCC_RC_SUCCESS; } -/***************************************************************************\ - - PROCEDURE : ncs_util_get_char_option - -\***************************************************************************/ -char ncs_util_get_char_option(int argc, char *argv[], char *arg_prefix) -{ - char char_option; - char *p_field; - - p_field = ncs_util_search_argv_list(argc, argv, arg_prefix); - if (p_field == NULL) { - return 0; - } - if (sscanf(p_field + strlen(arg_prefix), "%c", &char_option) != 1) { - return 0; - } - if (isupper(char_option)) - char_option = (char)tolower(char_option); - - return char_option; -} /***************************************************************************\ @@ -901,33 +805,6 @@ char *ncs_util_search_argv_list(int argc return NULL; } -/**************************************************************************** - Name : ncs_get_node_id_from_phyinfo - - Description : This function combines chassis id ,physical - slot id and sub slot id into node_id - - Arguments : i_chassis_id - chassis id - i_phy_slot_id - physical slot id - i_sub_slot_id - slot id - *o_node_id - node_id - - Return Values : On Failure NCSCC_RC_FAILURE - On Success NCSCC_RC_SUCCESS - - Notes : None. -******************************************************************************/ -uint8_t ncs_get_node_id_from_phyinfo(NCS_CHASSIS_ID i_chassis_id, NCS_PHY_SLOT_ID i_phy_slot_id, - NCS_SUB_SLOT_ID i_sub_slot_id, NCS_NODE_ID *o_node_id) -{ - if (o_node_id == NULL) - return NCSCC_RC_FAILURE; - - *o_node_id = ((NCS_CHASSIS_ID)i_chassis_id << 16) | - ((NCS_NODE_ID)i_phy_slot_id << 8) | (NCS_NODE_ID)i_sub_slot_id; - - return NCSCC_RC_SUCCESS; -} /**************************************************************************** Name : ncs_get_phyinfo_from_node_id diff --git a/osaf/libs/core/include/ncs_main_papi.h b/osaf/libs/core/include/ncs_main_papi.h --- a/osaf/libs/core/include/ncs_main_papi.h +++ b/osaf/libs/core/include/ncs_main_papi.h @@ -74,46 +74,6 @@ extern "C" { void ncs_mds_shutdown(void); void ncs_leap_shutdown(void); -#define m_NCS_GET_CHASSIS_TYPE(i_max_len, o_chassis_type )\ - ncs_get_chassis_type( i_max_len, o_chassis_type ) - -/***********************************************************************\ -Name: m_NCS_GET_CHASSIS_TYPE - -Arguments: - -i_max_len: The maximum number of bytes to be read into the "o_chassis_type" - buffer _excluding_ the null-terminating character. It should be - set to NCS_MAX_CHASSIS_TYPE_LEN to accomodate the longest - chassis-type string accepted - -o_chassis_type: An "out" argument which will contain the chassis-type string - when this function returns success. It should be of size - "NCS_MAX_CHASSIS_TYPE_LEN+1" to accomodate the longest - chassis-type string accepted - -Return Values: - NCSCC_RC_SUCCESS: - NCSCC_RC_FAILURE: - -Description: - This API fetches the chassis-type string into the user-provided - buffer. It reads upto "NCS_MAX_CHASSIS_TYPE_LEN" or "i_max_len" - (whichever is lesser) bytes from the PKGSYSCONFDIR/chassis_type - file into the "o_chassis_type" buffer. - A null-terminating character is inserted after that. - - It is assumed that the chassis-type string contains printable - characters only and does not contain white-space characters in - it (" ", "\n", etc.). Furthermore, the PKGSYSCONFDIR/chassis_type - file will be assumed to be a single lined text file (containing the - characters comprising the chassis-type string followed by a - newline character.) -\***********************************************************************/ - uint32_t ncs_get_chassis_type(uint32_t i_max_len, char *o_chassis_type); - -/* Excluding null character byte for string termination */ -#define NCS_MAX_CHASSIS_TYPE_LEN (40) /***********************************************************************\ m_NCS_GET_NODE_ID: This function returns a node-id (in the SAF sense). @@ -128,37 +88,12 @@ Description: NCS_NODE_ID ncs_get_node_id(void); #define m_NCS_GET_NODE_ID ncs_get_node_id() -#define m_NCS_GET_NODE_ID_FROM_PHYINFO( i_chassis_id, i_phy_slot_id ,\ - i_sub_slot_id, o_node_id)\ - ncs_get_node_id_from_phyinfo( i_chassis_id ,\ - i_phy_slot_id, i_sub_slot_id, o_node_id) - -/**************************************************************************** - Name : ncs_get_node_id_from_phyinfo - - Description : This function combines chassis id ,physical - slot id and sub slot id into node_id - - Arguments : i_chassis_id - chassis id - i_phy_slot_id - physical slot id - i_sub_slot_id - slot id - *o_node_id - node_id - - Return Values : On Failure NCSCC_RC_FAILURE - On Success NCSCC_RC_SUCCESS - - Notes : None. - ******************************************************************************/ - - uint8_t ncs_get_node_id_from_phyinfo(NCS_CHASSIS_ID i_chassis_id, - NCS_PHY_SLOT_ID i_phy_slot_id, - NCS_SUB_SLOT_ID i_sub_slot_id, NCS_NODE_ID *o_node_id); #define m_NCS_GET_PHYINFO_FROM_NODE_ID( i_node_id, o_chassis_id, o_phy_slot_id ,\ o_sub_slot_id) ncs_get_phyinfo_from_node_id( i_node_id,\ o_chassis_id , o_phy_slot_id, o_sub_slot_id) /**************************************************************************** - Name : ncs_get_node_id_from_phyinfo + Name : ncs_get_phyinfo_from_node_id Description : This function extracts node_id from chassis id ,physical slot id and sub slot id into node_id ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel