• Home
  • Raw
  • Download

Lines Matching refs:ifname_map

124 struct ifname_map {  struct
132 static struct ifname_map *ifname_map_alloc(const char *bus_name, in ifname_map_alloc() argument
137 struct ifname_map *ifname_map; in ifname_map_alloc() local
139 ifname_map = calloc(1, sizeof(*ifname_map)); in ifname_map_alloc()
140 if (!ifname_map) in ifname_map_alloc()
142 ifname_map->bus_name = strdup(bus_name); in ifname_map_alloc()
143 ifname_map->dev_name = strdup(dev_name); in ifname_map_alloc()
144 ifname_map->port_index = port_index; in ifname_map_alloc()
145 ifname_map->ifname = strdup(ifname); in ifname_map_alloc()
146 if (!ifname_map->bus_name || !ifname_map->dev_name || in ifname_map_alloc()
147 !ifname_map->ifname) { in ifname_map_alloc()
148 free(ifname_map->ifname); in ifname_map_alloc()
149 free(ifname_map->dev_name); in ifname_map_alloc()
150 free(ifname_map->bus_name); in ifname_map_alloc()
151 free(ifname_map); in ifname_map_alloc()
154 return ifname_map; in ifname_map_alloc()
157 static void ifname_map_free(struct ifname_map *ifname_map) in ifname_map_free() argument
159 free(ifname_map->ifname); in ifname_map_free()
160 free(ifname_map->dev_name); in ifname_map_free()
161 free(ifname_map->bus_name); in ifname_map_free()
162 free(ifname_map); in ifname_map_free()
361 struct ifname_map *ifname_map; in ifname_map_cb() local
379 ifname_map = ifname_map_alloc(bus_name, dev_name, in ifname_map_cb()
381 if (!ifname_map) in ifname_map_cb()
383 list_add(&ifname_map->list, &dl->ifname_map_list); in ifname_map_cb()
390 struct ifname_map *ifname_map, *tmp; in ifname_map_fini() local
392 list_for_each_entry_safe(ifname_map, tmp, in ifname_map_fini()
394 list_del(&ifname_map->list); in ifname_map_fini()
395 ifname_map_free(ifname_map); in ifname_map_fini()
421 struct ifname_map *ifname_map; in ifname_map_lookup() local
423 list_for_each_entry(ifname_map, &dl->ifname_map_list, list) { in ifname_map_lookup()
424 if (strcmp(ifname, ifname_map->ifname) == 0) { in ifname_map_lookup()
425 *p_bus_name = ifname_map->bus_name; in ifname_map_lookup()
426 *p_dev_name = ifname_map->dev_name; in ifname_map_lookup()
427 *p_port_index = ifname_map->port_index; in ifname_map_lookup()
438 struct ifname_map *ifname_map; in ifname_map_rev_lookup() local
440 list_for_each_entry(ifname_map, &dl->ifname_map_list, list) { in ifname_map_rev_lookup()
441 if (strcmp(bus_name, ifname_map->bus_name) == 0 && in ifname_map_rev_lookup()
442 strcmp(dev_name, ifname_map->dev_name) == 0 && in ifname_map_rev_lookup()
443 port_index == ifname_map->port_index) { in ifname_map_rev_lookup()
444 *p_ifname = ifname_map->ifname; in ifname_map_rev_lookup()