Lines Matching refs:loc
62 struct rtnl_pktloc *loc; in __pktloc_lookup() local
66 nl_list_for_each_entry(loc, &pktloc_name_ht[hash], list) { in __pktloc_lookup()
67 if (!strcasecmp(loc->name, name)) { in __pktloc_lookup()
68 loc->refcnt++; in __pktloc_lookup()
69 *result = loc; in __pktloc_lookup()
79 static void rtnl_pktloc_free(struct rtnl_pktloc *loc) in rtnl_pktloc_free() argument
81 if (!loc) in rtnl_pktloc_free()
84 free(loc->name); in rtnl_pktloc_free()
85 free(loc); in rtnl_pktloc_free()
116 struct rtnl_pktloc *loc, *n; in read_pktlocs() local
118 nl_list_for_each_entry_safe(loc, n, &pktloc_name_ht[i], list) in read_pktlocs()
119 rtnl_pktloc_put(loc); in read_pktlocs()
186 struct rtnl_pktloc *loc; in rtnl_pktloc_alloc() local
188 if (!(loc = calloc(1, sizeof(*loc)))) in rtnl_pktloc_alloc()
191 loc->refcnt = 1; in rtnl_pktloc_alloc()
192 nl_init_list_head(&loc->list); in rtnl_pktloc_alloc()
194 return loc; in rtnl_pktloc_alloc()
201 void rtnl_pktloc_put(struct rtnl_pktloc *loc) in rtnl_pktloc_put() argument
203 if (!loc) in rtnl_pktloc_put()
206 loc->refcnt--; in rtnl_pktloc_put()
207 if (loc->refcnt <= 0) in rtnl_pktloc_put()
208 rtnl_pktloc_free(loc); in rtnl_pktloc_put()
217 int rtnl_pktloc_add(struct rtnl_pktloc *loc) in rtnl_pktloc_add() argument
221 if (__pktloc_lookup(loc->name, &l) == 0) { in rtnl_pktloc_add()
228 loc->name, loc->align, loc->layer, loc->offset, in rtnl_pktloc_add()
229 loc->mask, loc->shift, loc->refcnt); in rtnl_pktloc_add()
231 nl_list_add_tail(&loc->list, &pktloc_name_ht[pktloc_hash(loc->name)]); in rtnl_pktloc_add()
238 struct rtnl_pktloc *loc; in rtnl_pktloc_foreach() local
245 nl_list_for_each_entry(loc, &pktloc_name_ht[i], list) in rtnl_pktloc_foreach()
246 cb(loc, arg); in rtnl_pktloc_foreach()