Lines Matching refs:obj

24 static inline struct nl_object_ops *obj_ops(struct nl_object *obj)  in obj_ops()  argument
26 if (!obj->ce_ops) in obj_ops()
29 return obj->ce_ops; in obj_ops()
94 struct nl_object *nl_object_clone(struct nl_object *obj) in nl_object_clone() argument
97 struct nl_object_ops *ops = obj_ops(obj); in nl_object_clone()
109 new->ce_ops = obj->ce_ops; in nl_object_clone()
110 new->ce_msgtype = obj->ce_msgtype; in nl_object_clone()
111 new->ce_mask = obj->ce_mask; in nl_object_clone()
114 memcpy((void *)new + doff, (void *)obj + doff, size); in nl_object_clone()
117 if (ops->oo_clone(new, obj) < 0) { in nl_object_clone()
133 void nl_object_free(struct nl_object *obj) in nl_object_free() argument
135 struct nl_object_ops *ops = obj_ops(obj); in nl_object_free()
137 if (obj->ce_refcnt > 0) in nl_object_free()
140 if (obj->ce_cache) in nl_object_free()
141 nl_cache_remove(obj); in nl_object_free()
144 ops->oo_free_data(obj); in nl_object_free()
146 free(obj); in nl_object_free()
148 NL_DBG(4, "Freed object %p\n", obj); in nl_object_free()
162 void nl_object_get(struct nl_object *obj) in nl_object_get() argument
164 obj->ce_refcnt++; in nl_object_get()
166 obj, obj->ce_refcnt); in nl_object_get()
173 void nl_object_put(struct nl_object *obj) in nl_object_put() argument
175 if (!obj) in nl_object_put()
178 obj->ce_refcnt--; in nl_object_put()
180 obj, obj->ce_refcnt); in nl_object_put()
182 if (obj->ce_refcnt < 0) in nl_object_put()
185 if (obj->ce_refcnt <= 0) in nl_object_put()
186 nl_object_free(obj); in nl_object_put()
194 int nl_object_shared(struct nl_object *obj) in nl_object_shared() argument
196 return obj->ce_refcnt > 1; in nl_object_shared()
210 void nl_object_mark(struct nl_object *obj) in nl_object_mark() argument
212 obj->ce_flags |= NL_OBJ_MARK; in nl_object_mark()
219 void nl_object_unmark(struct nl_object *obj) in nl_object_unmark() argument
221 obj->ce_flags &= ~NL_OBJ_MARK; in nl_object_unmark()
229 int nl_object_is_marked(struct nl_object *obj) in nl_object_is_marked() argument
231 return (obj->ce_flags & NL_OBJ_MARK); in nl_object_is_marked()
246 void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params) in nl_object_dump() argument
248 dump_from_ops(obj, params); in nl_object_dump()
315 int nl_object_match_filter(struct nl_object *obj, struct nl_object *filter) in nl_object_match_filter() argument
317 struct nl_object_ops *ops = obj_ops(obj); in nl_object_match_filter()
322 return !(ops->oo_compare(obj, filter, filter->ce_mask, in nl_object_match_filter()
338 char *nl_object_attrs2str(struct nl_object *obj, uint32_t attrs, in nl_object_attrs2str() argument
341 struct nl_object_ops *ops = obj_ops(obj); in nl_object_attrs2str()
359 char *nl_object_attr_list(struct nl_object *obj, char *buf, size_t len) in nl_object_attr_list() argument
361 return nl_object_attrs2str(obj, obj->ce_mask, buf, len); in nl_object_attr_list()
371 int nl_object_get_refcnt(struct nl_object *obj) in nl_object_get_refcnt() argument
373 return obj->ce_refcnt; in nl_object_get_refcnt()
376 struct nl_cache *nl_object_get_cache(struct nl_object *obj) in nl_object_get_cache() argument
378 return obj->ce_cache; in nl_object_get_cache()