Lines Matching refs:im
46 struct ll_cache *im in ll_get_by_index() local
48 if (im->index == index) in ll_get_by_index()
49 return im; in ll_get_by_index()
71 struct ll_cache *im in ll_get_by_name() local
74 if (strncmp(im->name, name, IFNAMSIZ) == 0) in ll_get_by_name()
75 return im; in ll_get_by_name()
87 struct ll_cache *im; in ll_remember_index() local
96 im = ll_get_by_index(ifi->ifi_index); in ll_remember_index()
98 if (im) { in ll_remember_index()
99 hlist_del(&im->name_hash); in ll_remember_index()
100 hlist_del(&im->idx_hash); in ll_remember_index()
101 free(im); in ll_remember_index()
111 if (im) { in ll_remember_index()
113 if (strcmp(im->name, ifname) != 0) { in ll_remember_index()
114 hlist_del(&im->name_hash); in ll_remember_index()
116 hlist_add_head(&im->name_hash, &name_head[h]); in ll_remember_index()
119 im->flags = ifi->ifi_flags; in ll_remember_index()
123 im = malloc(sizeof(*im) + strlen(ifname) + 1); in ll_remember_index()
124 if (im == NULL) in ll_remember_index()
126 im->index = ifi->ifi_index; in ll_remember_index()
127 strcpy(im->name, ifname); in ll_remember_index()
128 im->type = ifi->ifi_type; in ll_remember_index()
129 im->flags = ifi->ifi_flags; in ll_remember_index()
132 hlist_add_head(&im->idx_hash, &idx_head[h]); in ll_remember_index()
135 hlist_add_head(&im->name_hash, &name_head[h]); in ll_remember_index()
142 const struct ll_cache *im; in ll_idx_n2a() local
147 im = ll_get_by_index(idx); in ll_idx_n2a()
148 if (im) in ll_idx_n2a()
149 return im->name; in ll_idx_n2a()
166 const struct ll_cache *im; in ll_index_to_type() local
171 im = ll_get_by_index(idx); in ll_index_to_type()
172 return im ? im->type : -1; in ll_index_to_type()
177 const struct ll_cache *im; in ll_index_to_flags() local
182 im = ll_get_by_index(idx); in ll_index_to_flags()
183 return im ? im->flags : -1; in ll_index_to_flags()
188 const struct ll_cache *im; in ll_name_to_index() local
194 im = ll_get_by_name(name); in ll_name_to_index()
195 if (im) in ll_name_to_index()
196 return im->index; in ll_name_to_index()