Lines Matching refs:loc
63 struct rtnl_pktloc *loc; in __pktloc_lookup() local
67 nl_list_for_each_entry(loc, &pktloc_name_ht[hash], list) { in __pktloc_lookup()
68 if (!strcasecmp(loc->name, name)) { in __pktloc_lookup()
69 loc->refcnt++; in __pktloc_lookup()
70 *result = loc; in __pktloc_lookup()
80 static void rtnl_pktloc_free(struct rtnl_pktloc *loc) in rtnl_pktloc_free() argument
82 if (!loc) in rtnl_pktloc_free()
85 free(loc->name); in rtnl_pktloc_free()
86 free(loc); in rtnl_pktloc_free()
119 struct rtnl_pktloc *loc, *n; in read_pktlocs() local
121 nl_list_for_each_entry_safe(loc, n, &pktloc_name_ht[i], list) in read_pktlocs()
122 rtnl_pktloc_put(loc); in read_pktlocs()
189 struct rtnl_pktloc *loc; in rtnl_pktloc_alloc() local
191 if (!(loc = calloc(1, sizeof(*loc)))) in rtnl_pktloc_alloc()
194 loc->refcnt = 1; in rtnl_pktloc_alloc()
195 nl_init_list_head(&loc->list); in rtnl_pktloc_alloc()
197 return loc; in rtnl_pktloc_alloc()
204 void rtnl_pktloc_put(struct rtnl_pktloc *loc) in rtnl_pktloc_put() argument
206 if (!loc) in rtnl_pktloc_put()
209 loc->refcnt--; in rtnl_pktloc_put()
210 if (loc->refcnt <= 0) in rtnl_pktloc_put()
211 rtnl_pktloc_free(loc); in rtnl_pktloc_put()
220 int rtnl_pktloc_add(struct rtnl_pktloc *loc) in rtnl_pktloc_add() argument
224 if (__pktloc_lookup(loc->name, &l) == 0) { in rtnl_pktloc_add()
231 loc->name, loc->align, loc->layer, loc->offset, in rtnl_pktloc_add()
232 loc->mask, loc->shift, loc->refcnt); in rtnl_pktloc_add()
234 nl_list_add_tail(&loc->list, &pktloc_name_ht[pktloc_hash(loc->name)]); in rtnl_pktloc_add()
241 struct rtnl_pktloc *loc; in rtnl_pktloc_foreach() local
248 nl_list_for_each_entry(loc, &pktloc_name_ht[i], list) in rtnl_pktloc_foreach()
249 cb(loc, arg); in rtnl_pktloc_foreach()