| 132 | ****************************************************************************/ |
| 133 | |
| 134 | static int find_devnum(FAR const char *devfmt) |
| 135 | { |
| 136 | FAR struct net_driver_s *curr; |
| 137 | size_t fmt_size; |
| 138 | int result = 0; |
| 139 | |
| 140 | fmt_size = strlen(devfmt); |
| 141 | |
| 142 | /* Assumed that devfmt is xxx%d */ |
| 143 | |
| 144 | DEBUGASSERT(fmt_size > 2); |
| 145 | fmt_size -= 2; |
| 146 | |
| 147 | /* Search the list of currently registered network devices */ |
| 148 | |
| 149 | for (curr = g_netdevices; curr; curr = curr->flink ) |
| 150 | { |
| 151 | /* Does this device name match the format we were given? */ |
| 152 | |
| 153 | if (strncmp(curr->d_ifname, devfmt, fmt_size) == 0) |
| 154 | { |
| 155 | /* Yes.. increment the candidate device number */ |
| 156 | |
| 157 | result++; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /* Return this next device number for this format */ |
| 162 | |
| 163 | return result; |
| 164 | } |
| 165 | |
| 166 | /**************************************************************************** |
| 167 | * Name: get_ifindex |
no test coverage detected