/* * openib_backend_get_updown_data * * openib backend module get_updown_data function */ static int openib_backend_get_updown_data(nodeupdown_t nodeupdown_handle, const char *hostname, unsigned int port, unsigned int timeout_len, char *reserved) { osm_bind_handle_t bind_handle; ib_node_record_t *node_record = NULL; ib_net16_t attr_offset = ib_get_attr_offset(sizeof(*node_record)); ib_api_status_t status = IB_SUCCESS; int rc = 0; int i = 0; rc = _get_bind_handle(nodeupdown_handle, &bind_handle); if (rc != 0) { return (rc); } status = _get_all_records(nodeupdown_handle, bind_handle, IB_MAD_ATTR_NODE_RECORD, attr_offset, 0); if (status != IB_SUCCESS) { return (-1); } for (i = 0; i < _openib_result.result_cnt; i++) { ib_node_info_t *p_ni = NULL; node_record = osmv_get_query_node_rec(_openib_result.p_result_madw, i); p_ni = &(node_record->node_info); if (p_ni->node_type == IB_NODE_TYPE_CA) { nodeupdown_add_up_node(nodeupdown_handle, (char *)node_record->node_desc.description); } } _return_mad(); osm_mad_pool_destroy(&_openib_mad_pool); osm_vendor_delete(&_openib_vendor); return (0); }
osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log, IN const uint32_t timeout) { ib_api_status_t status; umadt_obj_t *p_umadt_obj; OSM_LOG_ENTER(p_log); p_umadt_obj = malloc(sizeof(umadt_obj_t)); if (p_umadt_obj) { memset(p_umadt_obj, 0, sizeof(umadt_obj_t)); status = osm_vendor_init((osm_vendor_t *) p_umadt_obj, p_log, timeout); if (status != IB_SUCCESS) { osm_vendor_delete((osm_vendor_t **) & p_umadt_obj); } } else { printf ("osm_vendor_construct: ERROR! Unable to create Umadt object!\n"); } OSM_LOG_EXIT(p_log); return ((osm_vendor_t *) p_umadt_obj); }
/********************************************************************** * Create and Initialize osm_vendor_t Object **********************************************************************/ osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log, IN const uint32_t timeout) { ib_api_status_t status; osm_vendor_t *p_vend; OSM_LOG_ENTER(p_log); CL_ASSERT(p_log); p_vend = malloc(sizeof(*p_vend)); if (p_vend != NULL) { memset(p_vend, 0, sizeof(*p_vend)); status = osm_vendor_init(p_vend, p_log, timeout); if (status != IB_SUCCESS) { osm_vendor_delete(&p_vend); } } else { osm_log(p_vend->p_log, OSM_LOG_ERROR, "osm_vendor_new: ERR 5007: " "Fail to allocate vendor object.\n"); } OSM_LOG_EXIT(p_log); return (p_vend); }
osm_vendor_t *osm_vendor_new(IN osm_log_t * const p_log, IN const uint32_t timeout) { ib_api_status_t status; osm_vendor_t *p_vend; OSM_LOG_ENTER(p_log); CL_ASSERT(p_log); p_vend = malloc(sizeof(*p_vend)); if (p_vend != NULL) { memset(p_vend, 0, sizeof(*p_vend)); status = osm_vendor_init(p_vend, p_log, timeout); if (status != IB_SUCCESS) { osm_vendor_delete(&p_vend); } } OSM_LOG_EXIT(p_log); return (p_vend); }