static lagopus_result_t snmp_initialize(void) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; ret = lagopus_rwlock_create(&(conf.s_lck)); if (ret != LAGOPUS_RESULT_OK) { lagopus_perror(ret); lagopus_exit_fatal("Can't initialize the configurator lock.\n"); free((void *)(conf.s_lck)); } else { if (ret == LAGOPUS_RESULT_OK) { s_wlock_snmp_conf(&conf); { conf.ping_interval = DEFAULT_SNMPMGR_AGENTX_PING_INTERVAL_SEC; conf.agentx_sock = strdup(DEFAULT_SNMPMGR_AGENTX_SOCKET); conf.is_enabled = false; } s_unlock_snmp_conf(&conf); return LAGOPUS_RESULT_OK; } } return ret; }
lagopus_result_t lagopus_hashmap_create(lagopus_hashmap_t *retptr, lagopus_hashmap_type_t t, lagopus_hashmap_value_freeup_proc_t proc) { lagopus_result_t ret = LAGOPUS_RESULT_ANY_FAILURES; lagopus_hashmap_t hm; if (retptr != NULL) { *retptr = NULL; hm = (lagopus_hashmap_t)malloc(sizeof(*hm)); if (hm != NULL) { if ((ret = lagopus_rwlock_create(&(hm->m_lock))) == LAGOPUS_RESULT_OK) { hm->m_type = t; InitHashTable(&(hm->m_hashtable), (unsigned int)t); hm->m_del_proc = proc; hm->m_n_entries = 0; hm->m_is_operational = true; *retptr = hm; ret = LAGOPUS_RESULT_OK; } else { free((void *)hm); } } else { ret = LAGOPUS_RESULT_NO_MEMORY; } } else { ret = LAGOPUS_RESULT_INVALID_ARGS; } return ret; }
static lagopus_result_t s_setup(const lagopus_pipeline_stage_t *sptr) { (void)sptr; (void)lagopus_rwlock_create(&s_lock); lagopus_msg_debug(1, "called.\n"); return LAGOPUS_RESULT_OK; }
/** * Initialize. * Create table for interface information. */ lagopus_result_t rib_notifier_init() { lagopus_result_t rv; lagopus_rwlock_create(&ifinfo_lock); rv = lagopus_hashmap_create(&ifinfo_hashmap, LAGOPUS_HASHMAP_TYPE_ONE_WORD, ifinfo_entry_free); return rv; }