Lines Matching refs:obj

24 static inline struct nl_object_ops *obj_ops(struct nl_object *obj)
26 if (!obj->ce_ops)
29 return obj->ce_ops;
91 * @arg obj object to inherite data from
94 struct nl_object *nl_object_clone(struct nl_object *obj)
97 struct nl_object_ops *ops = obj_ops(obj);
109 new->ce_ops = obj->ce_ops;
110 new->ce_msgtype = obj->ce_msgtype;
111 new->ce_mask = obj->ce_mask;
114 memcpy((void *)new + doff, (void *)obj + doff, size);
117 if (ops->oo_clone(new, obj) < 0) {
129 * @arg obj object to free
133 void nl_object_free(struct nl_object *obj)
135 struct nl_object_ops *ops = obj_ops(obj);
137 if (obj->ce_refcnt > 0)
140 if (obj->ce_cache)
141 nl_cache_remove(obj);
144 ops->oo_free_data(obj);
146 free(obj);
148 NL_DBG(4, "Freed object %p\n", obj);
160 * @arg obj object to acquire reference from
162 void nl_object_get(struct nl_object *obj)
164 obj->ce_refcnt++;
166 obj, obj->ce_refcnt);
171 * @arg obj object to release reference from
173 void nl_object_put(struct nl_object *obj)
175 if (!obj)
178 obj->ce_refcnt--;
180 obj, obj->ce_refcnt);
182 if (obj->ce_refcnt < 0)
185 if (obj->ce_refcnt <= 0)
186 nl_object_free(obj);
191 * @arg obj object to check
194 int nl_object_shared(struct nl_object *obj)
196 return obj->ce_refcnt > 1;
208 * @arg obj Object to mark
210 void nl_object_mark(struct nl_object *obj)
212 obj->ce_flags |= NL_OBJ_MARK;
217 * @arg obj Object to unmark
219 void nl_object_unmark(struct nl_object *obj)
221 obj->ce_flags &= ~NL_OBJ_MARK;
226 * @arg obj Object to check
229 int nl_object_is_marked(struct nl_object *obj)
231 return (obj->ce_flags & NL_OBJ_MARK);
243 * @arg obj object to dump
246 void nl_object_dump(struct nl_object *obj, struct nl_dump_params *params)
248 dump_from_ops(obj, params);
308 * @arg obj object to check
315 int nl_object_match_filter(struct nl_object *obj, struct nl_object *filter)
317 struct nl_object_ops *ops = obj_ops(obj);
322 return !(ops->oo_compare(obj, filter, filter->ce_mask,
328 * @arg obj object of same type as attribute bitmask
338 char *nl_object_attrs2str(struct nl_object *obj, uint32_t attrs,
341 struct nl_object_ops *ops = obj_ops(obj);
353 * @arg obj an object
359 char *nl_object_attr_list(struct nl_object *obj, char *buf, size_t len)
361 return nl_object_attrs2str(obj, obj->ce_mask, buf, len);
371 int nl_object_get_refcnt(struct nl_object *obj)
373 return obj->ce_refcnt;
376 struct nl_cache *nl_object_get_cache(struct nl_object *obj)
378 return obj->ce_cache;