• Home
  • Raw
  • Download

Lines Matching refs:mngr

77 	struct nl_cache_mngr *mngr = arg;  in event_input()  local
87 mngr, msg); in event_input()
93 if (mngr->cm_protocol != protocol) in event_input()
96 for (i = 0; i < mngr->cm_nassocs; i++) { in event_input()
97 if (mngr->cm_assocs[i].ca_cache) { in event_input()
98 ops = mngr->cm_assocs[i].ca_cache->c_ops; in event_input()
109 msg, mngr->cm_assocs[i].ca_cache); in event_input()
110 p.pp_arg = &mngr->cm_assocs[i]; in event_input()
146 struct nl_cache_mngr *mngr; in nl_cache_mngr_alloc() local
153 mngr = calloc(1, sizeof(*mngr)); in nl_cache_mngr_alloc()
154 if (!mngr) in nl_cache_mngr_alloc()
164 mngr->cm_sock = sk; in nl_cache_mngr_alloc()
165 mngr->cm_nassocs = NASSOC_INIT; in nl_cache_mngr_alloc()
166 mngr->cm_protocol = protocol; in nl_cache_mngr_alloc()
167 mngr->cm_flags = flags; in nl_cache_mngr_alloc()
168 mngr->cm_assocs = calloc(mngr->cm_nassocs, in nl_cache_mngr_alloc()
170 if (!mngr->cm_assocs) in nl_cache_mngr_alloc()
174 nl_socket_disable_seq_check(mngr->cm_sock); in nl_cache_mngr_alloc()
176 if ((err = nl_connect(mngr->cm_sock, protocol)) < 0) in nl_cache_mngr_alloc()
179 if ((err = nl_socket_set_nonblocking(mngr->cm_sock)) < 0) in nl_cache_mngr_alloc()
183 mngr->cm_sync_sock = nl_socket_alloc(); in nl_cache_mngr_alloc()
184 if (!mngr->cm_sync_sock) { in nl_cache_mngr_alloc()
188 if ((err = nl_connect(mngr->cm_sync_sock, protocol)) < 0) in nl_cache_mngr_alloc()
192 mngr, protocol, mngr->cm_nassocs); in nl_cache_mngr_alloc()
194 *result = mngr; in nl_cache_mngr_alloc()
198 nl_socket_free(mngr->cm_sync_sock); in nl_cache_mngr_alloc()
200 nl_cache_mngr_free(mngr); in nl_cache_mngr_alloc()
237 static int nl_cache_mngr_set_change_func_v2(struct nl_cache_mngr *mngr, in nl_cache_mngr_set_change_func_v2() argument
248 if (ops->co_protocol != mngr->cm_protocol) in nl_cache_mngr_set_change_func_v2()
254 for (i = 0; i < mngr->cm_nassocs; i++) in nl_cache_mngr_set_change_func_v2()
255 if (mngr->cm_assocs[i].ca_cache == cache) in nl_cache_mngr_set_change_func_v2()
258 if (i >= mngr->cm_nassocs) { in nl_cache_mngr_set_change_func_v2()
262 mngr->cm_assocs[i].ca_change_v2 = cb; in nl_cache_mngr_set_change_func_v2()
263 mngr->cm_assocs[i].ca_change_data = data; in nl_cache_mngr_set_change_func_v2()
293 int nl_cache_mngr_add_cache(struct nl_cache_mngr *mngr, struct nl_cache *cache, in nl_cache_mngr_add_cache() argument
304 if (ops->co_protocol != mngr->cm_protocol) in nl_cache_mngr_add_cache()
310 for (i = 0; i < mngr->cm_nassocs; i++) in nl_cache_mngr_add_cache()
311 if (mngr->cm_assocs[i].ca_cache && in nl_cache_mngr_add_cache()
312 mngr->cm_assocs[i].ca_cache->c_ops == ops) in nl_cache_mngr_add_cache()
315 for (i = 0; i < mngr->cm_nassocs; i++) in nl_cache_mngr_add_cache()
316 if (!mngr->cm_assocs[i].ca_cache) in nl_cache_mngr_add_cache()
319 if (i >= mngr->cm_nassocs) { in nl_cache_mngr_add_cache()
321 int cm_nassocs = mngr->cm_nassocs + NASSOC_EXPAND; in nl_cache_mngr_add_cache()
323 cm_assocs = realloc(mngr->cm_assocs, in nl_cache_mngr_add_cache()
328 memset(cm_assocs + mngr->cm_nassocs, 0, in nl_cache_mngr_add_cache()
330 mngr->cm_assocs = cm_assocs; in nl_cache_mngr_add_cache()
331 mngr->cm_nassocs = cm_nassocs; in nl_cache_mngr_add_cache()
334 "to %d\n", mngr, mngr->cm_nassocs); in nl_cache_mngr_add_cache()
338 err = nl_socket_add_membership(mngr->cm_sock, grp->ag_group); in nl_cache_mngr_add_cache()
343 err = nl_cache_refill(mngr->cm_sync_sock, cache); in nl_cache_mngr_add_cache()
347 mngr->cm_assocs[i].ca_cache = cache; in nl_cache_mngr_add_cache()
348 mngr->cm_assocs[i].ca_change = cb; in nl_cache_mngr_add_cache()
349 mngr->cm_assocs[i].ca_change_data = data; in nl_cache_mngr_add_cache()
351 if (mngr->cm_flags & NL_AUTO_PROVIDE) in nl_cache_mngr_add_cache()
355 cache, nl_cache_name(cache), mngr); in nl_cache_mngr_add_cache()
361 nl_socket_drop_membership(mngr->cm_sock, grp->ag_group); in nl_cache_mngr_add_cache()
391 int nl_cache_mngr_add_cache_v2(struct nl_cache_mngr *mngr, struct nl_cache *cache, in nl_cache_mngr_add_cache_v2() argument
394 err = nl_cache_mngr_add_cache(mngr, cache, NULL, NULL); in nl_cache_mngr_add_cache_v2()
398 return nl_cache_mngr_set_change_func_v2(mngr, cache, cb, data); in nl_cache_mngr_add_cache_v2()
432 int nl_cache_mngr_add(struct nl_cache_mngr *mngr, const char *name, in nl_cache_mngr_add() argument
448 err = nl_cache_mngr_add_cache(mngr, cache, cb, data); in nl_cache_mngr_add()
471 int nl_cache_mngr_get_fd(struct nl_cache_mngr *mngr) in nl_cache_mngr_get_fd() argument
473 return nl_socket_get_fd(mngr->cm_sock); in nl_cache_mngr_get_fd()
495 int nl_cache_mngr_poll(struct nl_cache_mngr *mngr, int timeout) in nl_cache_mngr_poll() argument
499 .fd = nl_socket_get_fd(mngr->cm_sock), in nl_cache_mngr_poll()
503 NL_DBG(3, "Cache manager %p, poll() fd %d\n", mngr, fds.fd); in nl_cache_mngr_poll()
505 NL_DBG(3, "Cache manager %p, poll() returned %d\n", mngr, ret); in nl_cache_mngr_poll()
508 mngr, errno, nl_strerror_l(errno)); in nl_cache_mngr_poll()
516 return nl_cache_mngr_data_ready(mngr); in nl_cache_mngr_poll()
534 int nl_cache_mngr_data_ready(struct nl_cache_mngr *mngr) in nl_cache_mngr_data_ready() argument
540 mngr, nl_socket_get_fd(mngr->cm_sock)); in nl_cache_mngr_data_ready()
542 cb = nl_cb_clone(mngr->cm_sock->s_cb); in nl_cache_mngr_data_ready()
546 nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, event_input, mngr); in nl_cache_mngr_data_ready()
548 while ((err = nl_recvmsgs_report(mngr->cm_sock, cb)) > 0) { in nl_cache_mngr_data_ready()
550 mngr, err); in nl_cache_mngr_data_ready()
570 void nl_cache_mngr_info(struct nl_cache_mngr *mngr, struct nl_dump_params *p) in nl_cache_mngr_info() argument
575 nl_dump_line(p, "cache-manager <%p>\n", mngr); in nl_cache_mngr_info()
577 nl_nlfamily2str(mngr->cm_protocol, buf, sizeof(buf))); in nl_cache_mngr_info()
578 nl_dump_line(p, " .flags = %#x\n", mngr->cm_flags); in nl_cache_mngr_info()
579 nl_dump_line(p, " .nassocs = %u\n", mngr->cm_nassocs); in nl_cache_mngr_info()
580 nl_dump_line(p, " .sock = <%p>\n", mngr->cm_sock); in nl_cache_mngr_info()
582 for (i = 0; i < mngr->cm_nassocs; i++) { in nl_cache_mngr_info()
583 struct nl_cache_assoc *assoc = &mngr->cm_assocs[i]; in nl_cache_mngr_info()
609 void nl_cache_mngr_free(struct nl_cache_mngr *mngr) in nl_cache_mngr_free() argument
613 if (!mngr) in nl_cache_mngr_free()
616 if (mngr->cm_sock) in nl_cache_mngr_free()
617 nl_close(mngr->cm_sock); in nl_cache_mngr_free()
619 if (mngr->cm_sync_sock) { in nl_cache_mngr_free()
620 nl_close(mngr->cm_sync_sock); in nl_cache_mngr_free()
621 nl_socket_free(mngr->cm_sync_sock); in nl_cache_mngr_free()
624 if (mngr->cm_flags & NL_ALLOCATED_SOCK) in nl_cache_mngr_free()
625 nl_socket_free(mngr->cm_sock); in nl_cache_mngr_free()
627 for (i = 0; i < mngr->cm_nassocs; i++) { in nl_cache_mngr_free()
628 if (mngr->cm_assocs[i].ca_cache) { in nl_cache_mngr_free()
629 nl_cache_mngt_unprovide(mngr->cm_assocs[i].ca_cache); in nl_cache_mngr_free()
630 nl_cache_free(mngr->cm_assocs[i].ca_cache); in nl_cache_mngr_free()
634 free(mngr->cm_assocs); in nl_cache_mngr_free()
636 NL_DBG(1, "Cache manager %p freed\n", mngr); in nl_cache_mngr_free()
638 free(mngr); in nl_cache_mngr_free()