Lines Matching refs:cb
208 struct nl_cb *cb; in nl_cb_alloc() local
213 cb = calloc(1, sizeof(*cb)); in nl_cb_alloc()
214 if (!cb) in nl_cb_alloc()
217 cb->cb_refcnt = 1; in nl_cb_alloc()
220 nl_cb_set(cb, i, kind, NULL, NULL); in nl_cb_alloc()
222 nl_cb_err(cb, kind, NULL, NULL); in nl_cb_alloc()
224 return cb; in nl_cb_alloc()
235 struct nl_cb *cb; in nl_cb_clone() local
237 cb = nl_cb_alloc(NL_CB_DEFAULT); in nl_cb_clone()
238 if (!cb) in nl_cb_clone()
241 memcpy(cb, orig, sizeof(*orig)); in nl_cb_clone()
242 cb->cb_refcnt = 1; in nl_cb_clone()
244 return cb; in nl_cb_clone()
247 struct nl_cb *nl_cb_get(struct nl_cb *cb) in nl_cb_get() argument
249 cb->cb_refcnt++; in nl_cb_get()
251 return cb; in nl_cb_get()
254 void nl_cb_put(struct nl_cb *cb) in nl_cb_put() argument
256 if (!cb) in nl_cb_put()
259 cb->cb_refcnt--; in nl_cb_put()
261 if (cb->cb_refcnt < 0) in nl_cb_put()
264 if (cb->cb_refcnt <= 0) in nl_cb_put()
265 free(cb); in nl_cb_put()
285 int nl_cb_set(struct nl_cb *cb, enum nl_cb_type type, enum nl_cb_kind kind, in nl_cb_set() argument
295 cb->cb_set[type] = func; in nl_cb_set()
296 cb->cb_args[type] = arg; in nl_cb_set()
298 cb->cb_set[type] = cb_def[type][kind]; in nl_cb_set()
299 cb->cb_args[type] = arg; in nl_cb_set()
314 int nl_cb_set_all(struct nl_cb *cb, enum nl_cb_kind kind, in nl_cb_set_all() argument
320 err = nl_cb_set(cb, i, kind, func, arg); in nl_cb_set_all()
335 int nl_cb_err(struct nl_cb *cb, enum nl_cb_kind kind, in nl_cb_err() argument
342 cb->cb_err = func; in nl_cb_err()
343 cb->cb_err_arg = arg; in nl_cb_err()
345 cb->cb_err = cb_err_def[kind]; in nl_cb_err()
346 cb->cb_err_arg = arg; in nl_cb_err()
364 void nl_cb_overwrite_recvmsgs(struct nl_cb *cb, in nl_cb_overwrite_recvmsgs() argument
367 cb->cb_recvmsgs_ow = func; in nl_cb_overwrite_recvmsgs()
375 void nl_cb_overwrite_recv(struct nl_cb *cb, in nl_cb_overwrite_recv() argument
379 cb->cb_recv_ow = func; in nl_cb_overwrite_recv()
387 void nl_cb_overwrite_send(struct nl_cb *cb, in nl_cb_overwrite_send() argument
390 cb->cb_send_ow = func; in nl_cb_overwrite_send()